summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabstrip.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-01 23:59:31 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-02 01:42:48 +0300
commit8aa68056aec80c775a3ddb152bea8a90a7097199 (patch)
tree2a131c77e27ea4d5a7a3e3d5102f0bbc12957569 /src/gui/widgets/tabstrip.cpp
parent96805601e06e6ed6f7b5aaffc3bbb22dd9e8d58a (diff)
downloadplus-8aa68056aec80c775a3ddb152bea8a90a7097199.tar.gz
plus-8aa68056aec80c775a3ddb152bea8a90a7097199.tar.bz2
plus-8aa68056aec80c775a3ddb152bea8a90a7097199.tar.xz
plus-8aa68056aec80c775a3ddb152bea8a90a7097199.zip
Add actions for switch to next/prev tab in inventory.
Keys not assigned.
Diffstat (limited to 'src/gui/widgets/tabstrip.cpp')
-rw-r--r--src/gui/widgets/tabstrip.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp
index 7c6627fbf..644fa3d48 100644
--- a/src/gui/widgets/tabstrip.cpp
+++ b/src/gui/widgets/tabstrip.cpp
@@ -77,3 +77,41 @@ void TabStrip::action(const ActionEvent &event)
}
}
}
+
+void TabStrip::nextTab()
+{
+ FOR_EACH (WidgetListConstIterator, iter, mWidgets)
+ {
+ Button *button = static_cast<Button*>(*iter);
+ if (button->isPressed2())
+ {
+ button->setPressed(false);
+ ++iter;
+ if (iter == mWidgets.end())
+ iter = mWidgets.begin();
+ button = static_cast<Button*>(*iter);
+ action(ActionEvent(button, button->getActionEventId()));
+ return;
+ }
+ }
+}
+
+void TabStrip::prevTab()
+{
+ FOR_EACH (WidgetListConstIterator, iter, mWidgets)
+ {
+ Button *button = static_cast<Button*>(*iter);
+ if (button->isPressed2())
+ {
+ button->setPressed(false);
+ if (iter == mWidgets.begin())
+ iter = mWidgets.end();
+ if (iter == mWidgets.begin())
+ return;
+ --iter;
+ button = static_cast<Button*>(*iter);
+ action(ActionEvent(button, button->getActionEventId()));
+ return;
+ }
+ }
+}