diff options
author | Mateusz Kaduk <mateusz.kaduk@gmail.com> | 2005-05-17 08:45:55 +0000 |
---|---|---|
committer | Mateusz Kaduk <mateusz.kaduk@gmail.com> | 2005-05-17 08:45:55 +0000 |
commit | 3fc2cd109a51e6a38783eb5438098d9a962bc655 (patch) | |
tree | 0c18618ac4d6ac58e9cad8d9a7a8ff47f7a3d342 /src/gui | |
parent | 84fd76cd43e2d7c8e647e78eabc47279cfade973 (diff) | |
download | mana-3fc2cd109a51e6a38783eb5438098d9a962bc655.tar.gz mana-3fc2cd109a51e6a38783eb5438098d9a962bc655.tar.bz2 mana-3fc2cd109a51e6a38783eb5438098d9a962bc655.tar.xz mana-3fc2cd109a51e6a38783eb5438098d9a962bc655.zip |
Alt+m for testing menu, menuitems the same as button
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/buddywindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/menu.cpp | 17 | ||||
-rw-r--r-- | src/gui/menu.h | 15 |
3 files changed, 27 insertions, 10 deletions
diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp index 2e81c798..b57b32dd 100644 --- a/src/gui/buddywindow.cpp +++ b/src/gui/buddywindow.cpp @@ -22,7 +22,7 @@ */ #include "buddywindow.h" -#include "menuitem.h" +#include "menu.h" BuddyWindow::BuddyWindow(): Window("Buddys") @@ -38,9 +38,6 @@ BuddyWindow::BuddyWindow(): add(scrollArea); addBuddy("Usiu"); // for testing - MenuItem *item = new MenuItem("Test"); - item->setPosition(0, 200 - item->getHeight()); - add(item); } BuddyWindow::~BuddyWindow() diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index c74ca5ea..74721d09 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -23,8 +23,23 @@ #include "menu.h" -Menu::Menu(const std::vector<MenuItem>& items) +Menu::Menu(const std::string& menulabel, std::vector<MenuItem>& items): + Window(menulabel) { + setContentSize(40,60); + fill(items); +} +Menu::~Menu() +{ } +void Menu::fill(std::vector<MenuItem>& items) +{ + for(std::vector<MenuItem>::iterator item = items.begin(); + item != items.end(); ++item) + { + item->setPosition(0,0); + add(&*item); + } +} diff --git a/src/gui/menu.h b/src/gui/menu.h index 3d24827a..a726e6a8 100644 --- a/src/gui/menu.h +++ b/src/gui/menu.h @@ -26,17 +26,22 @@ #include <guichan.hpp> #include "menuitem.h" +#include "window.h" -class Menu : public gcn::Widget -{ +class Menu : public Window { public: /** * Constructor. */ - Menu(const std::vector<MenuItem>& items); + Menu(const std::string& menulabel, std::vector<MenuItem>& items); + + /** + * Destructor. + */ + ~Menu(); + + void fill(std::vector<MenuItem>& items); - private: - int i; }; #endif /* _TMW_MENU_H */ |