From 9d39702824e8fae5127e09fb5a05b521b48cd028 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 9 Nov 2008 11:43:28 +0000 Subject: docking menus --- src/ui/menu.cc | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'src/ui/menu.cc') diff --git a/src/ui/menu.cc b/src/ui/menu.cc index 8421f7f..36599be 100644 --- a/src/ui/menu.cc +++ b/src/ui/menu.cc @@ -47,16 +47,11 @@ void Menu::load() std::string strval; Button *button = 0; Label *label = 0; - float w = menu_container->childsize().width(); - float h = menu_container->childsize().height(); - float m = menu_container->margin(); while (ini.getline()) { if (ini.got_section()) { - - //con_debug << " " << ini.name() << " [" << ini.section() << "]" << std::endl; - if (ini.got_section("menu")) { + continue; } else if (ini.got_section("button")) { button = add_button(); @@ -67,31 +62,23 @@ void Menu::load() } else if (ini.got_section()) { ini.unknown_section(); } - - } else if (ini.got_key()) { - - //con_debug << " " << ini.name() << " " << ini.key() << "=" << ini.value() << std::endl; - + } else if (ini.got_key()) { if (ini.in_section("menu")) { if (ini.got_key_string("background", strval)) { menu_background->set_texture(strval); - } else if (ini.got_key_float("elementwidth", w)) { - menu_container->set_childsize(w,h); - } else if (ini.got_key_float("elementheight", h)) { - menu_container->set_childsize(w,h); - } else if (ini.got_key_float("elementmargin", m)) { - menu_container->set_margin(m); } else { ini.unkown_key(); } } else if (ini.in_section("button")) { if (ini.got_key_string("text", strval)) { + aux::strip_quotes(strval); button->set_text(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); button->set_command(strval); } else if (ini.got_key_string("align", strval)) { @@ -157,7 +144,7 @@ void Menu::resize() { set_size(parent()->size()); menu_background->set_size(size()); - menu_container->set_location(menu_container->childsize().width() * 0.25, (height() - menu_container->height()) / 2.0f); + menu_container->set_location(UI::elementsize.width() * 0.25, (height() - menu_container->height()) / 2.0f); } } -- cgit v1.2.3