diff options
author | Mateusz Kaduk <mateusz.kaduk@gmail.com> | 2005-05-21 08:48:54 +0000 |
---|---|---|
committer | Mateusz Kaduk <mateusz.kaduk@gmail.com> | 2005-05-21 08:48:54 +0000 |
commit | b89398608993f2e50b7c7edd8aabe7cb1c1c216b (patch) | |
tree | ba71bfec8ce7fc3955f58bd24da702f86325528e /src/gui | |
parent | 77436e727119ae4d762d426efcd1d84748f9edea (diff) | |
download | mana-b89398608993f2e50b7c7edd8aabe7cb1c1c216b.tar.gz mana-b89398608993f2e50b7c7edd8aabe7cb1c1c216b.tar.bz2 mana-b89398608993f2e50b7c7edd8aabe7cb1c1c216b.tar.xz mana-b89398608993f2e50b7c7edd8aabe7cb1c1c216b.zip |
Fixed menu so it is working..
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/menu.cpp | 19 | ||||
-rw-r--r-- | src/gui/menu.h | 7 | ||||
-rw-r--r-- | src/gui/menuitem.cpp | 1 |
3 files changed, 18 insertions, 9 deletions
diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index 74721d09..8018b561 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -23,10 +23,10 @@ #include "menu.h" -Menu::Menu(const std::string& menulabel, std::vector<MenuItem>& items): +Menu::Menu(const std::string& menulabel, std::vector<MenuItem *> items): Window(menulabel) { - setContentSize(40,60); + setContentSize(52,60); fill(items); } @@ -34,12 +34,19 @@ Menu::~Menu() { } -void Menu::fill(std::vector<MenuItem>& items) +void Menu::fill(std::vector<MenuItem *> items) { - for(std::vector<MenuItem>::iterator item = items.begin(); + int i=0; + + for(std::vector<MenuItem *>::iterator item = items.begin(); item != items.end(); ++item) { - item->setPosition(0,0); - add(&*item); + MenuItem *optr; + optr = *item; + optr->setSize(50,10); + optr->setPosition(0,i); + i=i+10; + add(*item); } } + diff --git a/src/gui/menu.h b/src/gui/menu.h index a726e6a8..5d905c86 100644 --- a/src/gui/menu.h +++ b/src/gui/menu.h @@ -33,14 +33,17 @@ class Menu : public Window { /** * Constructor. */ - Menu(const std::string& menulabel, std::vector<MenuItem>& items); + Menu(const std::string& menulabel, std::vector<MenuItem *> items); /** * Destructor. */ ~Menu(); - void fill(std::vector<MenuItem>& items); + /** + * Fill menu with menuitems + */ + void fill(std::vector<MenuItem *> items); }; diff --git a/src/gui/menuitem.cpp b/src/gui/menuitem.cpp index 4bc073be..490e2f61 100644 --- a/src/gui/menuitem.cpp +++ b/src/gui/menuitem.cpp @@ -57,7 +57,6 @@ MenuItem::MenuItem(const std::string& label): } } addMouseListener(this); - setSize(50,10); } MenuItem::~MenuItem() |