Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-10-13 15:38:03 +0000
committerStijn Buys <ingar@osirion.org>2012-10-13 15:38:03 +0000
commit5dea1a263136c4cbe011de3325605dd3dc4523af (patch)
tree6da09a6007a148d5fe13254f275bb68b71242429 /src/client/mainmenu.cc
parent3b8ea0849fac5532d61a90608bda876cf518ba1b (diff)
Added dialog infrastructure.
Diffstat (limited to 'src/client/mainmenu.cc')
-rw-r--r--src/client/mainmenu.cc49
1 files changed, 44 insertions, 5 deletions
diff --git a/src/client/mainmenu.cc b/src/client/mainmenu.cc
index cfed85f..7271bcf 100644
--- a/src/client/mainmenu.cc
+++ b/src/client/mainmenu.cc
@@ -5,6 +5,7 @@
*/
#include "client/buttonmenu.h"
+#include "client/dialog.h"
#include "client/mainmenu.h"
#include "client/savegamemenu.h"
#include "core/core.h"
@@ -62,6 +63,7 @@ void MainMenu::load_definitions()
con_debug << " Loading menu definitions..." << std::endl;
+ Dialog *dialog = 0;
ui::Label *label = 0;
ui::Button *button = 0;
ButtonMenu *menu = 0;
@@ -72,6 +74,13 @@ void MainMenu::load_definitions()
if (ini.got_section()) {
if (ini.got_section("menu")) {
+ dialog = 0;
+ menu = 0;
+ continue;
+
+ // dialog
+ } else if (ini.got_section("dialog")) {
+ dialog = 0;
menu = 0;
continue;
@@ -83,6 +92,7 @@ void MainMenu::load_definitions()
} else {
button = menu->add_button();
}
+ continue;
// menu label
} else if (ini.got_section("label")) {
@@ -92,6 +102,7 @@ void MainMenu::load_definitions()
} else {
label = menu->add_label();
}
+ continue;
} else {
ini.unknown_section();
@@ -99,18 +110,46 @@ void MainMenu::load_definitions()
}
} else if (ini.got_key()) {
-
- if (ini.in_section("menu")) {
+
+ if (ini.in_section("dialog")) {
+ if (!dialog) {
+ if (ini.got_key_label("label", strval)) {
+ dialog = new Dialog(this);
+ dialog->set_label(strval);
+ }
+ } else {
+
+ if (ini.got_key_label("label", strval)) {
+ dialog->set_label(strval);
+
+ } else if (ini.got_key_string("text", strval)) {
+ dialog->set_text(strval);
+
+ } else if (ini.got_key_string("button", strval)) {
+ dialog->set_button(strval);
+
+ } else if (ini.got_key_string("command", strval)) {
+ for (size_t i = 0; i <= strval.size(); i++) {
+ if (strval[i] == ',') strval[i] = ';';
+ }
+ aux::strip_quotes(strval);
+ dialog->set_command(strval);
+ } else {
+ ini.unknown_key();
+ }
+ }
+
+ } else if (ini.in_section("menu")) {
- if (ini.got_key_string("label", strval)) {
- aux::to_label(strval);
+ if (ini.got_key_label("label", strval)) {
for (ui::Widget::Children::iterator child = children().begin(); child != children().end(); ++child) {
if ((*child)->label().compare(strval) == 0) {
+ // assert child is a menu
menu = static_cast<ButtonMenu*>((*child));
}
}
-
+
if (!menu) {
menu = new ButtonMenu(this, strval.c_str());
}