summaryrefslogtreecommitdiff
path: root/src/gui/windows
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/windows
parent96805601e06e6ed6f7b5aaffc3bbb22dd9e8d58a (diff)
downloadmv-8aa68056aec80c775a3ddb152bea8a90a7097199.tar.gz
mv-8aa68056aec80c775a3ddb152bea8a90a7097199.tar.bz2
mv-8aa68056aec80c775a3ddb152bea8a90a7097199.tar.xz
mv-8aa68056aec80c775a3ddb152bea8a90a7097199.zip
Add actions for switch to next/prev tab in inventory.
Keys not assigned.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/inventorywindow.cpp28
-rw-r--r--src/gui/windows/inventorywindow.h6
2 files changed, 34 insertions, 0 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index c1fea4158..ea3cc5ad3 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -54,6 +54,7 @@
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/tabstrip.h"
#include "gui/widgets/textfield.h"
+#include "gui/widgets/windowcontainer.h"
#include "net/inventoryhandler.h"
@@ -746,6 +747,33 @@ bool InventoryWindow::isAnyInputFocused()
return false;
}
+InventoryWindow *InventoryWindow::getFirstVisible()
+{
+ std::set<Widget*> list;
+ FOR_EACH (WindowList::const_iterator, it, invInstances)
+ {
+ if ((*it) && (*it)->isWindowVisible())
+ list.insert(*it);
+ }
+ InventoryWindow *const window = dynamic_cast<InventoryWindow*>(
+ windowContainer->findFirstWidget(list));
+ return window;
+}
+
+void InventoryWindow::nextTab()
+{
+ InventoryWindow *const window = getFirstVisible();
+ if (window)
+ window->mFilter->nextTab();
+}
+
+void InventoryWindow::prevTab()
+{
+ InventoryWindow *const window = getFirstVisible();
+ if (window)
+ window->mFilter->prevTab();
+}
+
void InventoryWindow::widgetResized(const Event &event)
{
Window::widgetResized(event);
diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h
index 98cac78a6..f2952c2f5 100644
--- a/src/gui/windows/inventorywindow.h
+++ b/src/gui/windows/inventorywindow.h
@@ -156,6 +156,12 @@ class InventoryWindow final : public Window,
static bool isAnyInputFocused();
+ static InventoryWindow *getFirstVisible();
+
+ static void nextTab();
+
+ static void prevTab();
+
private:
/**
* Updates the weight bar.