summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/container.cpp14
-rw-r--r--src/gui/widgets/container.h4
2 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp
index b788b0610..f6281d578 100644
--- a/src/gui/widgets/container.cpp
+++ b/src/gui/widgets/container.cpp
@@ -31,3 +31,17 @@ Container::~Container()
while (!mWidgets.empty())
delete mWidgets.front();
}
+
+bool Container::safeRemove(gcn::Widget* widget)
+{
+ WidgetListIterator iter;
+ for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
+ {
+ if (*iter == widget)
+ {
+ remove(widget);
+ return true;
+ }
+ }
+ return false;
+} \ No newline at end of file
diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h
index c2696a65f..5b7c281c9 100644
--- a/src/gui/widgets/container.h
+++ b/src/gui/widgets/container.h
@@ -22,6 +22,7 @@
#ifndef GUI_CONTAINER_H
#define GUI_CONTAINER_H
+#include <guichan/widget.hpp>
#include <guichan/widgets/container.hpp>
/**
@@ -37,7 +38,10 @@ class Container : public gcn::Container
{
public:
Container();
+
~Container();
+
+ bool safeRemove(gcn::Widget* widget);
};
#endif