summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/checkbox.cc10
-rw-r--r--plugingui/checkbox.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/plugingui/checkbox.cc b/plugingui/checkbox.cc
index 496de21..5888d3c 100644
--- a/plugingui/checkbox.cc
+++ b/plugingui/checkbox.cc
@@ -58,6 +58,16 @@ void GUI::CheckBox::registerClickHandler(void (*handler)(void *), void *ptr)
this->ptr = ptr;
}
+void GUI::CheckBox::keyEvent(KeyEvent *e)
+{
+ if(e->direction != -1) return;
+
+ if(e->keycode == GUI::KeyEvent::KEY_CHARACTER && e->text == " ") {
+ state = !state;
+ repaintEvent(NULL);
+ }
+}
+
void GUI::CheckBox::repaintEvent(GUI::RepaintEvent *e)
{
// printf("CheckBox::repaintEvent\n");
diff --git a/plugingui/checkbox.h b/plugingui/checkbox.h
index 1b8aa23..4b77964 100644
--- a/plugingui/checkbox.h
+++ b/plugingui/checkbox.h
@@ -49,6 +49,7 @@ public:
virtual void repaintEvent(RepaintEvent *e);
virtual void buttonEvent(ButtonEvent *e);
+ virtual void keyEvent(KeyEvent *e);
private:
bool state;