summaryrefslogtreecommitdiff
path: root/src/gui/widgets/radiobutton.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-17 11:31:47 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-17 11:31:47 +0300
commit693879649420c0997bfb29bea7f5752f6d9ac526 (patch)
tree01d6c56532d561385edbfe2ad0235df6c5a58c5f /src/gui/widgets/radiobutton.cpp
parent8df35828d69f3debd89557a74c26359a8b249f87 (diff)
downloadmv-693879649420c0997bfb29bea7f5752f6d9ac526.tar.gz
mv-693879649420c0997bfb29bea7f5752f6d9ac526.tar.bz2
mv-693879649420c0997bfb29bea7f5752f6d9ac526.tar.xz
mv-693879649420c0997bfb29bea7f5752f6d9ac526.zip
Move keyboard handling from guichan to own classes.
Diffstat (limited to 'src/gui/widgets/radiobutton.cpp')
-rw-r--r--src/gui/widgets/radiobutton.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 94152a716..4a9a912b1 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -158,3 +158,16 @@ void RadioButton::mouseExited(gcn::MouseEvent& event A_UNUSED)
{
mHasMouse = false;
}
+
+void RadioButton::keyPressed(gcn::KeyEvent& keyEvent)
+{
+ gcn::Key key = keyEvent.getKey();
+
+ if (key.getValue() == gcn::Key::ENTER ||
+ key.getValue() == gcn::Key::SPACE)
+ {
+ setSelected(true);
+ distributeActionEvent();
+ keyEvent.consume();
+ }
+}