diff options
author | Stijn Buys <ingar@osirion.org> | 2011-09-04 17:54:51 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-09-04 17:54:51 +0000 |
commit | 69eed715f80c24c2435c82bb9fa1954697bf3af0 (patch) | |
tree | a21aa14d2ecfa86b94d3b122c2c972d758425782 /src/ui/menu.cc | |
parent | edd5dfcd15198f5d5d277835fdf75108eb67472d (diff) |
Moved main menu infrastructure into client namespace,
removed ui::Container and ui::Menu classes.
Diffstat (limited to 'src/ui/menu.cc')
-rw-r--r-- | src/ui/menu.cc | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/src/ui/menu.cc b/src/ui/menu.cc deleted file mode 100644 index c4dc214..0000000 --- a/src/ui/menu.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - ui/menu.cc - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 -*/ - -#include "filesystem/filesystem.h" -#include "ui/label.h" -#include "ui/button.h" -#include "ui/menu.h" -#include "ui/ui.h" - -namespace ui -{ - -Menu::Menu(Window *parent, const char *label) : Window(parent) -{ - set_label(label); - set_border(false); - set_background(false); - - menu_background = new Bitmap(this); - menu_container = new Container(this); - - hide(); -} - -Menu::~Menu() -{ - // menu_container and menu_background are deleted by Widget::~Widget() -} - -void Menu::set_background_texture(const char *texture) -{ - menu_background->set_texture(texture); -} - -void Menu::set_background_texture(const std::string &texture) -{ - menu_background->set_texture(texture); -} - -Label *Menu::add_label(char const * text) -{ - Label *label = new Label(menu_container, text); - label->set_alignment(AlignCenter); - label->set_border(false); - label->set_font(ui::root()->font_large()); - return label; -} - -Button *Menu::add_button(char const *text, char const *command) -{ - return new Button(menu_container, text, command); -} - -void Menu::resize() -{ - set_size(parent()->size()); - menu_background->set_size(size()); - menu_container->set_location(ui::UI::elementsize.height(), (height() - menu_container->height()) / 2.0f); -} - -bool Menu::on_keypress(const int key, const unsigned int modifier) -{ - switch (key) { - - case SDLK_ESCAPE: - if (visible()) { - this->hide(); - return true; - } - break; - - default: - break; - } - - return Window::on_keypress(key, modifier); -} - -} |