summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/setupitem.cpp4
-rw-r--r--src/gui/widgets/setupitem.h2
-rw-r--r--src/gui/widgets/tabs/setup_mods.cpp6
-rw-r--r--src/gui/widgets/tabs/setup_mods.h2
-rw-r--r--src/gui/widgets/tabs/setuptab.cpp4
-rw-r--r--src/gui/widgets/tabs/setuptab.h2
-rw-r--r--src/gui/widgets/tabs/setuptabscroll.cpp12
-rw-r--r--src/gui/widgets/tabs/setuptabscroll.h2
8 files changed, 33 insertions, 1 deletions
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 2cf35c144..e8bec1db6 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -184,6 +184,10 @@ void SetupItem::externalUpdated(const std::string &eventName A_UNUSED)
toWidget();
}
+void SetupItem::externalUnloaded(const std::string &eventName A_UNUSED)
+{
+}
+
void SetupItem::fixFirstItemSize(gcn::Widget *const widget)
{
const int maxSize = mParent->getPreferredFirstItemSize();
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index d56efca8e..40a20a985 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -89,6 +89,8 @@ class SetupItem : public gcn::ActionListener,
virtual void externalUpdated(const std::string &eventName);
+ virtual void externalUnloaded(const std::string &eventName);
+
bool isMainConfig() const A_WARN_UNUSED
{ return mMainConfig; }
diff --git a/src/gui/widgets/tabs/setup_mods.cpp b/src/gui/widgets/tabs/setup_mods.cpp
index 6857b6700..646bfdb7e 100644
--- a/src/gui/widgets/tabs/setup_mods.cpp
+++ b/src/gui/widgets/tabs/setup_mods.cpp
@@ -45,7 +45,6 @@ Setup_Mods::Setup_Mods(const Widget2 *const widget) :
ContainerPlacer place = h.getPlacer(0, 0);
place(0, 0, mScroll, 10, 10);
-
setDimension(gcn::Rectangle(0, 0, 550, 350));
}
@@ -114,3 +113,8 @@ void Setup_Mods::saveMods()
}
serverConfig.setValue("mods", modsString);
}
+
+void Setup_Mods::externalUnloaded()
+{
+ clear();
+}
diff --git a/src/gui/widgets/tabs/setup_mods.h b/src/gui/widgets/tabs/setup_mods.h
index 5c837811a..6c5c519fd 100644
--- a/src/gui/widgets/tabs/setup_mods.h
+++ b/src/gui/widgets/tabs/setup_mods.h
@@ -38,6 +38,8 @@ class Setup_Mods final : public SetupTabScroll
void externalUpdated() override final;
+ void externalUnloaded() override final;
+
void loadMods();
void saveMods();
diff --git a/src/gui/widgets/tabs/setuptab.cpp b/src/gui/widgets/tabs/setuptab.cpp
index ab015f9a2..c445e2ad7 100644
--- a/src/gui/widgets/tabs/setuptab.cpp
+++ b/src/gui/widgets/tabs/setuptab.cpp
@@ -37,3 +37,7 @@ SetupTab::SetupTab(const Widget2 *const widget) :
void SetupTab::externalUpdated()
{
}
+
+void SetupTab::externalUnloaded()
+{
+}
diff --git a/src/gui/widgets/tabs/setuptab.h b/src/gui/widgets/tabs/setuptab.h
index 9d1362faf..388b0a988 100644
--- a/src/gui/widgets/tabs/setuptab.h
+++ b/src/gui/widgets/tabs/setuptab.h
@@ -57,6 +57,8 @@ class SetupTab : public Container,
virtual void externalUpdated();
+ virtual void externalUnloaded();
+
protected:
explicit SetupTab(const Widget2 *const widget);
diff --git a/src/gui/widgets/tabs/setuptabscroll.cpp b/src/gui/widgets/tabs/setuptabscroll.cpp
index 81c191dd6..659ef5824 100644
--- a/src/gui/widgets/tabs/setuptabscroll.cpp
+++ b/src/gui/widgets/tabs/setuptabscroll.cpp
@@ -134,6 +134,18 @@ void SetupTabScroll::externalUpdated()
}
}
+void SetupTabScroll::externalUnloaded()
+{
+ for (std::map<std::string, SetupItem*>::const_iterator
+ iter = mItems.begin(), iter_end = mItems.end();
+ iter != iter_end; ++ iter)
+ {
+ SetupItem *const widget = (*iter).second;
+ if (widget && !widget->isMainConfig())
+ widget->externalUnloaded((*iter).first);
+ }
+}
+
void SetupTabScroll::widgetResized(const gcn::Event &event A_UNUSED)
{
mScroll->setWidth(getWidth() - 12);
diff --git a/src/gui/widgets/tabs/setuptabscroll.h b/src/gui/widgets/tabs/setuptabscroll.h
index 15b493d88..e3d495690 100644
--- a/src/gui/widgets/tabs/setuptabscroll.h
+++ b/src/gui/widgets/tabs/setuptabscroll.h
@@ -54,6 +54,8 @@ class SetupTabScroll : public SetupTab
virtual void externalUpdated() override;
+ virtual void externalUnloaded() override;
+
virtual void action(const gcn::ActionEvent &event A_UNUSED)
override final
{ }