summaryrefslogtreecommitdiff
path: root/src/game/GameView.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-24 18:22:58 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-24 18:22:58 (GMT)
commitba802b3243c3e1721a84126e2bed6c3b24532b27 (patch)
tree858767f6f853c798809b5c595cd813e493cd75b8 /src/game/GameView.cpp
parentf5547f267b9e73be3d8153df3dd36d7e3b69a2d9 (diff)
downloadpowder-ba802b3243c3e1721a84126e2bed6c3b24532b27.zip
powder-ba802b3243c3e1721a84126e2bed6c3b24532b27.tar.gz
Element search
Diffstat (limited to 'src/game/GameView.cpp')
-rw-r--r--src/game/GameView.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index 5593d4b..29e7042 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -238,6 +238,21 @@ GameView::GameView():
colourBSlider->SetActionCallback(colC);
colourASlider = new ui::Slider(ui::Point(275, Size.Y-39), ui::Point(50, 14), 255);
colourASlider->SetActionCallback(colC);
+
+ class ElementSearchAction : public ui::ButtonAction
+ {
+ GameView * v;
+ public:
+ ElementSearchAction(GameView * _v) { v = _v; }
+ void ActionCallback(ui::Button * sender)
+ {
+ v->c->OpenElementSearch();
+ }
+ };
+ ui::Button * tempButton = new ui::Button(ui::Point(XRES+BARSIZE-16, YRES+MENUSIZE-32), ui::Point(15, 15), "");
+ tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2);
+ tempButton->SetActionCallback(new ElementSearchAction(this));
+ AddComponent(tempButton);
}
class GameView::MenuAction: public ui::ButtonAction
@@ -272,7 +287,7 @@ public:
void GameView::NotifyMenuListChanged(GameModel * sender)
{
- int currentY = YRES+MENUSIZE-16-(sender->GetMenuList().size()*16);
+ int currentY = YRES+MENUSIZE-48;//-(sender->GetMenuList().size()*16);
for(int i = 0; i < menuButtons.size(); i++)
{
RemoveComponent(menuButtons[i]);
@@ -286,15 +301,16 @@ void GameView::NotifyMenuListChanged(GameModel * sender)
}
toolButtons.clear();
vector<Menu*> menuList = sender->GetMenuList();
- for(int i = 0; i < menuList.size(); i++)
+ for(vector<Menu*>::reverse_iterator iter = menuList.rbegin(), end = menuList.rend(); iter != end; ++iter)
{
std::string tempString = "";
- tempString += menuList[i]->GetIcon();
+ Menu * item = *iter;
+ tempString += item->GetIcon();
ui::Button * tempButton = new ui::Button(ui::Point(XRES+BARSIZE-16, currentY), ui::Point(15, 15), tempString);
tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2);
tempButton->SetTogglable(true);
- tempButton->SetActionCallback(new MenuAction(this, menuList[i]));
- currentY+=16;
+ tempButton->SetActionCallback(new MenuAction(this, item));
+ currentY-=16;
AddComponent(tempButton);
menuButtons.push_back(tempButton);
}