diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-01 23:59:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-02 01:42:48 +0300 |
commit | 8aa68056aec80c775a3ddb152bea8a90a7097199 (patch) | |
tree | 2a131c77e27ea4d5a7a3e3d5102f0bbc12957569 /src/gui/windows/inventorywindow.cpp | |
parent | 96805601e06e6ed6f7b5aaffc3bbb22dd9e8d58a (diff) | |
download | plus-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/windows/inventorywindow.cpp')
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 28 |
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); |