summaryrefslogtreecommitdiff
path: root/plugingui/checkbox.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-03-09 20:16:30 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-03-09 20:16:30 +0100
commita6ddfd13f78d8f1a319cc997c81db90bf4b7b8f2 (patch)
treeb8f335ef1bfbf6d39f25ecaa5d0ecab6cdf12023 /plugingui/checkbox.cc
parente964666a4d1c3217d1eae9e0099ec28391042622 (diff)
Make checkbox toggle on space-bar key press (release).
Diffstat (limited to 'plugingui/checkbox.cc')
-rw-r--r--plugingui/checkbox.cc10
1 files changed, 10 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");