summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-02 20:06:58 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-02 20:06:58 +0300
commit45a9bbd34cda3c784b935860a4cc616a0314a57c (patch)
treee4cee8daa007c727e3ce4511e24aebbbcc6bc9d8 /src
parent506bf9c3bd1ddeb70529876148140c6f7c91acf2 (diff)
downloadmv-45a9bbd34cda3c784b935860a4cc616a0314a57c.tar.gz
mv-45a9bbd34cda3c784b935860a4cc616a0314a57c.tar.bz2
mv-45a9bbd34cda3c784b935860a4cc616a0314a57c.tar.xz
mv-45a9bbd34cda3c784b935860a4cc616a0314a57c.zip
Replace guichan iterators to const_iterator if need.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/container.cpp2
-rw-r--r--src/gui/widgets/container.h4
-rw-r--r--src/gui/widgets/window.cpp2
-rw-r--r--src/guichan/basiccontainer.cpp22
-rw-r--r--src/guichan/include/guichan/basiccontainer.hpp10
-rw-r--r--src/guichan/widgets/window.cpp2
6 files changed, 28 insertions, 14 deletions
diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp
index 96cea7119..558257507 100644
--- a/src/gui/widgets/container.cpp
+++ b/src/gui/widgets/container.cpp
@@ -37,7 +37,7 @@ Container::~Container()
bool Container::safeRemove(gcn::Widget* widget)
{
- WidgetListIterator iter;
+ WidgetListConstIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
{
if (*iter == widget)
diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h
index 1d8872477..c011b8925 100644
--- a/src/gui/widgets/container.h
+++ b/src/gui/widgets/container.h
@@ -26,6 +26,10 @@
#include <guichan/widget.hpp>
#include <guichan/widgets/container.hpp>
+#if !defined USE_INTERNALGUICHAN
+typedef std::list<gcn::Widget *>::const_iterator WidgetListConstIterator;
+#endif
+
/**
* A widget container.
*
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 0a3779307..4435496a7 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -368,7 +368,7 @@ void Window::widgetHidden(const gcn::Event &event A_UNUSED)
if (gui)
gui->setCursorType(Gui::CURSOR_POINTER);
- WidgetListIterator it;
+ WidgetListConstIterator it;
if (!mFocusHandler)
return;
diff --git a/src/guichan/basiccontainer.cpp b/src/guichan/basiccontainer.cpp
index d51968eb6..439535c9a 100644
--- a/src/guichan/basiccontainer.cpp
+++ b/src/guichan/basiccontainer.cpp
@@ -110,7 +110,7 @@ namespace gcn
void BasicContainer::focusNext()
{
- WidgetListIterator it;
+ WidgetListConstIterator it;
for (it = mWidgets.begin(); it != mWidgets.end(); ++ it)
{
@@ -118,7 +118,7 @@ namespace gcn
break;
}
- WidgetListIterator end = it;
+ WidgetListConstIterator end = it;
if (it == mWidgets.end())
it = mWidgets.begin();
@@ -140,7 +140,7 @@ namespace gcn
void BasicContainer::focusPrevious()
{
- WidgetListReverseIterator it;
+ WidgetListCReverseIterator it;
for (it = mWidgets.rbegin(); it != mWidgets.rend(); ++ it)
{
@@ -148,7 +148,7 @@ namespace gcn
break;
}
- WidgetListReverseIterator end = it;
+ WidgetListCReverseIterator end = it;
++ it;
@@ -178,7 +178,7 @@ namespace gcn
x -= r.x;
y -= r.y;
- WidgetListReverseIterator it;
+ WidgetListCReverseIterator it;
for (it = mWidgets.rbegin(); it != mWidgets.rend(); ++ it)
{
if ((*it)->isVisible() && (*it)->getDimension()
@@ -203,7 +203,7 @@ namespace gcn
if (mInternalFocusHandler != NULL)
return;
- WidgetListIterator iter;
+ WidgetListConstIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
{
(*iter)->_setFocusHandler(focusHandler);
@@ -243,7 +243,7 @@ namespace gcn
void BasicContainer::clear()
{
- WidgetListIterator iter;
+ WidgetListConstIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
{
@@ -259,7 +259,7 @@ namespace gcn
{
graphics->pushClipArea(getChildrenArea());
- WidgetListIterator iter;
+ WidgetListConstIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
{
if ((*iter)->isVisible())
@@ -289,7 +289,7 @@ namespace gcn
void BasicContainer::logicChildren()
{
- WidgetListIterator iter;
+ WidgetListConstIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
(*iter)->logic();
}
@@ -324,7 +324,7 @@ namespace gcn
{
Widget::setInternalFocusHandler(focusHandler);
- WidgetListIterator iter;
+ WidgetListConstIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
{
if (mInternalFocusHandler == NULL)
@@ -336,7 +336,7 @@ namespace gcn
Widget* BasicContainer::findWidgetById(const std::string& id)
{
- WidgetListIterator iter;
+ WidgetListConstIterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
{
if ((*iter)->getId() == id)
diff --git a/src/guichan/include/guichan/basiccontainer.hpp b/src/guichan/include/guichan/basiccontainer.hpp
index 998e1f601..6163b6535 100644
--- a/src/guichan/include/guichan/basiccontainer.hpp
+++ b/src/guichan/include/guichan/basiccontainer.hpp
@@ -167,12 +167,22 @@ namespace gcn
*/
typedef WidgetList::iterator WidgetListIterator;
+ /**
+ * Typedef.
+ */
+ typedef WidgetList::const_iterator WidgetListConstIterator;
+
/**
* Typedef.
*/
typedef WidgetList::reverse_iterator WidgetListReverseIterator;
/**
+ * Typedef.
+ */
+ typedef WidgetList::const_reverse_iterator WidgetListCReverseIterator;
+
+ /**
* Holds all widgets of the basic container.
*/
WidgetList mWidgets;
diff --git a/src/guichan/widgets/window.cpp b/src/guichan/widgets/window.cpp
index 4779fb0ce..7b04981c2 100644
--- a/src/guichan/widgets/window.cpp
+++ b/src/guichan/widgets/window.cpp
@@ -279,7 +279,7 @@ namespace gcn
void Window::resizeToContent()
{
- WidgetListIterator it;
+ WidgetListConstIterator it;
int w = 0, h = 0;
for (it = mWidgets.begin(); it != mWidgets.end(); it++)