From 693879649420c0997bfb29bea7f5752f6d9ac526 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 17 Apr 2012 11:31:47 +0300 Subject: Move keyboard handling from guichan to own classes. --- src/gui/widgets/checkbox.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/gui/widgets/checkbox.cpp') diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 0689c5395..f599e7831 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -190,3 +190,15 @@ void CheckBox::mouseExited(gcn::MouseEvent& event A_UNUSED) { mHasMouse = false; } + +void CheckBox::keyPressed(gcn::KeyEvent& keyEvent) +{ + gcn::Key key = keyEvent.getKey(); + + if (key.getValue() == gcn::Key::ENTER || + key.getValue() == gcn::Key::SPACE) + { + toggleSelected(); + keyEvent.consume(); + } +} -- cgit v1.2.3-70-g09d2