diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-17 11:31:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-17 11:31:47 +0300 |
commit | 693879649420c0997bfb29bea7f5752f6d9ac526 (patch) | |
tree | 01d6c56532d561385edbfe2ad0235df6c5a58c5f /src/gui/widgets/tabbedarea.cpp | |
parent | 8df35828d69f3debd89557a74c26359a8b249f87 (diff) | |
download | manaplus-693879649420c0997bfb29bea7f5752f6d9ac526.tar.gz manaplus-693879649420c0997bfb29bea7f5752f6d9ac526.tar.bz2 manaplus-693879649420c0997bfb29bea7f5752f6d9ac526.tar.xz manaplus-693879649420c0997bfb29bea7f5752f6d9ac526.zip |
Move keyboard handling from guichan to own classes.
Diffstat (limited to 'src/gui/widgets/tabbedarea.cpp')
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index fc6526a13..bb8ea063b 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -477,6 +477,37 @@ void TabbedArea::removeAll() } } +void TabbedArea::keyPressed(gcn::KeyEvent& keyEvent) +{ + if (keyEvent.isConsumed() || !isFocused()) + return; + + if (keyEvent.getKey().getValue() == gcn::Key::LEFT) + { + int index = getSelectedTabIndex(); + index--; + + if (index < 0) + return; + else + setSelectedTab(mTabs[index].first); + + keyEvent.consume(); + } + else if (keyEvent.getKey().getValue() == gcn::Key::RIGHT) + { + int index = getSelectedTabIndex(); + index++; + + if (index >= static_cast<int>(mTabs.size())) + return; + else + setSelectedTab(mTabs[index].first); + + keyEvent.consume(); + } +} + /* void TabbedArea::moveLeft(gcn::Tab *tab) { |