From 8aa68056aec80c775a3ddb152bea8a90a7097199 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 1 Dec 2014 23:59:31 +0300 Subject: Add actions for switch to next/prev tab in inventory. Keys not assigned. --- src/gui/widgets/tabstrip.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/gui/widgets/tabstrip.cpp') 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(*iter); + if (button->isPressed2()) + { + button->setPressed(false); + ++iter; + if (iter == mWidgets.end()) + iter = mWidgets.begin(); + button = static_cast(*iter); + action(ActionEvent(button, button->getActionEventId())); + return; + } + } +} + +void TabStrip::prevTab() +{ + FOR_EACH (WidgetListConstIterator, iter, mWidgets) + { + Button *button = static_cast(*iter); + if (button->isPressed2()) + { + button->setPressed(false); + if (iter == mWidgets.begin()) + iter = mWidgets.end(); + if (iter == mWidgets.begin()) + return; + --iter; + button = static_cast(*iter); + action(ActionEvent(button, button->getActionEventId())); + return; + } + } +} -- cgit v1.2.3-60-g2f50