summaryrefslogtreecommitdiff
path: root/src/game/PropertyTool.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-09-26 01:17:49 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-09-26 15:46:29 (GMT)
commit6ec915df8093804d4c48fed93f3495adb0183ccd (patch)
tree9a1a225c207713820de8a4e68a77fc905064c0be /src/game/PropertyTool.cpp
parent2f26fac9d04720346d262031d3ed1051ae5b237d (diff)
downloadpowder-6ec915df8093804d4c48fed93f3495adb0183ccd.zip
powder-6ec915df8093804d4c48fed93f3495adb0183ccd.tar.gz
make PROP interface a little easier to use (first part of tpt issue 78)
Diffstat (limited to 'src/game/PropertyTool.cpp')
-rw-r--r--src/game/PropertyTool.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/game/PropertyTool.cpp b/src/game/PropertyTool.cpp
index 811d10e..589740c 100644
--- a/src/game/PropertyTool.cpp
+++ b/src/game/PropertyTool.cpp
@@ -8,6 +8,7 @@
#include "interface/Label.h"
#include "interface/Textbox.h"
#include "interface/DropDown.h"
+#include "interface/Keys.h"
#include "dialogues/ErrorMessage.h"
class PropertyWindow: public ui::Window
@@ -23,6 +24,7 @@ public:
PropertyWindow(PropertyTool * tool_, Simulation * sim_, ui::Point position_);
void SetProperty();
virtual void OnDraw();
+ virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
virtual void OnTryExit(ExitMethod method);
virtual ~PropertyWindow() {}
class OkayAction: public ui::ButtonAction
@@ -74,6 +76,7 @@ position(position_)
textField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
textField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
AddComponent(textField);
+ FocusComponent(textField);
ui::Engine::Ref().ShowWindow(this);
}
@@ -207,6 +210,14 @@ void PropertyWindow::OnDraw()
g->drawrect(Position.X, Position.Y, Size.X, Size.Y, 200, 200, 200, 255);
}
+void PropertyWindow::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
+{
+ if (key == KEY_UP)
+ property->SetOption(property->GetOption().second-1);
+ else if (key == KEY_DOWN)
+ property->SetOption(property->GetOption().second+1);
+}
+
void PropertyTool::Click(Simulation * sim, Brush * brush, ui::Point position)
{
new PropertyWindow(this, sim, position);