summaryrefslogtreecommitdiff
path: root/src/gui/windows/inventorywindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/inventorywindow.cpp')
-rw-r--r--src/gui/windows/inventorywindow.cpp28
1 files changed, 28 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);