summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/tabbedarea.cpp10
-rw-r--r--src/gui/widgets/tabbedarea.h4
-rw-r--r--src/gui/windows/chatwindow.cpp5
-rw-r--r--src/gui/windows/chatwindow.h2
4 files changed, 20 insertions, 1 deletions
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 70e098cd3..da6c89d1a 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -236,6 +236,16 @@ bool TabbedArea::isTabSelected(const unsigned int index) const
return mSelectedTab == mTabs[index].first;
}
+bool TabbedArea::isTabPresent(const Tab *const tab) const
+{
+ FOR_EACH (TabContainer::const_iterator, it, mTabs)
+ {
+ if ((*it).first == tab || (*it).second == tab)
+ return true;
+ }
+ return false;
+}
+
bool TabbedArea::isTabSelected(const Tab *const tab) const
{
return mSelectedTab == tab;
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index 37950e204..eaac7a6d5 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -104,6 +104,8 @@ class TabbedArea final : public Widget2,
bool isTabSelected(const Tab *const tab) const A_WARN_UNUSED;
+ bool isTabPresent(const Tab *const tab) const A_WARN_UNUSED;
+
/**
* Overload the remove tab function as it's broken in guichan 0.8.
*/
@@ -206,7 +208,7 @@ class TabbedArea final : public Widget2,
gcn::Container* mTabContainer;
gcn::Container* mWidgetContainer;
std::vector<Tab*> mTabsToDelete;
- std::vector<std::pair<Tab*, gcn::Widget*> > mTabs;
+ TabContainer mTabs;
/**
* The overall width of all tab.
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index b9a2592fa..62a032341 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1949,3 +1949,8 @@ void ChatWindow::addGlobalMessage(const std::string &line)
else
localChatTab->chatLog(line, BY_GM);
}
+
+bool ChatWindow::isTabPresent(const ChatTab *const tab) const
+{
+ return mChatTabs->isTabPresent(tab);
+}
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 014eceb5a..c000215f1 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -292,6 +292,8 @@ class ChatWindow final : public Window,
void postInit() override final;
+ bool isTabPresent(const ChatTab *const tab) const A_WARN_UNUSED;
+
static void localPetSay(const std::string &nick,
const std::string &text);