summaryrefslogtreecommitdiff
path: root/src/guichan/widgets/listbox.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/guichan/widgets/listbox.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/guichan/widgets/listbox.cpp')
-rw-r--r--src/guichan/widgets/listbox.cpp47
1 files changed, 1 insertions, 46 deletions
diff --git a/src/guichan/widgets/listbox.cpp b/src/guichan/widgets/listbox.cpp
index 5760025c2..3152890bc 100644
--- a/src/guichan/widgets/listbox.cpp
+++ b/src/guichan/widgets/listbox.cpp
@@ -189,53 +189,8 @@ namespace gcn
distributeValueChangedEvent();
}
- void ListBox::keyPressed(KeyEvent& keyEvent)
+ void ListBox::keyPressed(KeyEvent& keyEvent A_UNUSED)
{
- Key key = keyEvent.getKey();
-
- if (key.getValue() == Key::ENTER || key.getValue() == Key::SPACE)
- {
- distributeActionEvent();
- keyEvent.consume();
- }
- else if (key.getValue() == Key::UP)
- {
- setSelected(mSelected - 1);
-
- if (mSelected == -1)
- {
- if (mWrappingEnabled)
- setSelected(getListModel()->getNumberOfElements() - 1);
- else
- setSelected(0);
- }
-
- keyEvent.consume();
- }
- else if (key.getValue() == Key::DOWN)
- {
- if (mWrappingEnabled
- && getSelected() == getListModel()->getNumberOfElements() - 1)
- {
- setSelected(0);
- }
- else
- {
- setSelected(getSelected() + 1);
- }
-
- keyEvent.consume();
- }
- else if (key.getValue() == Key::HOME)
- {
- setSelected(0);
- keyEvent.consume();
- }
- else if (key.getValue() == Key::END)
- {
- setSelected(getListModel()->getNumberOfElements() - 1);
- keyEvent.consume();
- }
}
void ListBox::mousePressed(MouseEvent& mouseEvent)