Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/targeticonbutton.cc9
-rw-r--r--src/client/targeticonbutton.h12
2 files changed, 13 insertions, 8 deletions
diff --git a/src/client/targeticonbutton.cc b/src/client/targeticonbutton.cc
index afc3838..ebd5ec3 100644
--- a/src/client/targeticonbutton.cc
+++ b/src/client/targeticonbutton.cc
@@ -18,10 +18,12 @@ TargetIconButton::TargetIconButton(Widget *parent, const char *icon, const char
entity_flags = flags;
}
-bool TargetIconButton::on_keypress(const int key, const unsigned int modifier)
+bool TargetIconButton::on_mousepress(const unsigned int button)
{
- if (key == 512 + SDL_BUTTON_LEFT) {
- if (enabled() && command().size() && targets::current()) {
+ if (button == SDL_BUTTON_LEFT)
+ {
+ if (enabled() && command().size() && targets::current())
+ {
core::cmd() << "@" << command() << " " << targets::current_id() << std::endl;
audio::play("ui/clicked");
}
@@ -34,7 +36,6 @@ bool TargetIconButton::on_keypress(const int key, const unsigned int modifier)
void TargetIconButton::draw()
{
set_enabled(targets::current() && ((targets::current()->flags() & entity_flags) == entity_flags));
-
ui::IconButton::draw();
}
diff --git a/src/client/targeticonbutton.h b/src/client/targeticonbutton.h
index 9907f95..cb6a147 100644
--- a/src/client/targeticonbutton.h
+++ b/src/client/targeticonbutton.h
@@ -19,12 +19,16 @@ public:
/// special icon button that sends target '@' commands.
TargetIconButton(Widget *parent, const char *icon, const char *command, unsigned int flags = 0);
- /// called when the widget receives a key press
- virtual bool on_keypress(const int key, const unsigned int modifier);
-
protected:
- /// update enabled/disabled state and draw the IconButton
+ /**
+ * @brief draw event handler
+ * */
virtual void draw();
+
+ /**
+ * @brief mouse button press event handler
+ * */
+ virtual bool on_mousepress(const unsigned int button);
private:
unsigned int entity_flags;