summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/Makefile.am4
-rw-r--r--src/client.cpp2
-rw-r--r--src/game.cpp2
-rw-r--r--src/gui/widgets/basiccontainer2.cpp (renamed from src/gui/base/widgets/container.cpp)97
-rw-r--r--src/gui/widgets/basiccontainer2.h (renamed from src/gui/base/widgets/container.hpp)147
-rw-r--r--src/gui/widgets/container.cpp2
-rw-r--r--src/gui/widgets/container.h4
-rw-r--r--src/gui/widgets/layout.cpp2
-rw-r--r--src/gui/widgets/layout.h11
-rw-r--r--src/gui/widgets/layouthelper.cpp4
-rw-r--r--src/gui/widgets/layouthelper.h4
-rw-r--r--src/gui/widgets/tabbedarea.cpp6
-rw-r--r--src/gui/widgets/tabbedarea.h6
-rw-r--r--src/gui/widgets/window.cpp6
-rw-r--r--src/gui/widgets/window.h4
16 files changed, 146 insertions, 159 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d5d13c613..effb17201 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -810,14 +810,14 @@ SET(SRCS
utils/sdlpixel.h
gui/widgets/widget.h
listeners/widgetlistener.h
- gui/base/widgets/container.hpp
+ gui/widgets/basiccontainer2.h
gui/widgets/basiccontainer.cpp
gui/cliprect.cpp
gui/color.cpp
input/key.cpp
gui/rect.cpp
gui/widgets/widget.cpp
- gui/base/widgets/container.cpp
+ gui/widgets/basiccontainer2.cpp
)
SET(SRCS_EVOL
diff --git a/src/Makefile.am b/src/Makefile.am
index 1d5eb4f3c..5bbea38d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -173,14 +173,14 @@ manaplus_SOURCES += events/actionevent.h \
utils/sdlpixel.h \
gui/widgets/widget.h \
listeners/widgetlistener.h \
- gui/base/widgets/container.hpp \
+ gui/widgets/basiccontainer2.h \
gui/widgets/basiccontainer.cpp \
gui/cliprect.cpp \
gui/color.cpp \
input/key.cpp \
gui/rect.cpp \
gui/widgets/widget.cpp \
- gui/base/widgets/container.cpp
+ gui/widgets/basiccontainer2.cpp
manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
gui/widgets/avatarlistbox.h \
diff --git a/src/client.cpp b/src/client.cpp
index cdee0b049..a462f8603 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1123,7 +1123,7 @@ int Client::gameExec()
if (!gui)
break;
- gcn::Container *const top = static_cast<gcn::Container*>(
+ BasicContainer2 *const top = static_cast<BasicContainer2*>(
gui->getTop());
if (!top)
diff --git a/src/game.cpp b/src/game.cpp
index df165d3d8..3eaddedfc 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -413,7 +413,7 @@ Game::Game():
viewport->setSize(mainGraphics->mWidth, mainGraphics->mHeight);
PlayerInfo::clear();
- gcn::Container *const top = static_cast<gcn::Container*>(gui->getTop());
+ BasicContainer2 *const top = static_cast<BasicContainer2*>(gui->getTop());
if (top)
top->add(viewport);
viewport->requestMoveToBottom();
diff --git a/src/gui/base/widgets/container.cpp b/src/gui/widgets/basiccontainer2.cpp
index 53a900ec4..5a34ee0dc 100644
--- a/src/gui/base/widgets/container.cpp
+++ b/src/gui/widgets/basiccontainer2.cpp
@@ -65,72 +65,67 @@
* For comments regarding functions please see the header file.
*/
-#include "gui/base/widgets/container.hpp"
-
+#include "gui/widgets/basiccontainer2.h"
#include "render/graphics.h"
#include "debug.h"
-namespace gcn
+BasicContainer2::BasicContainer2(const Widget2 *const widget) :
+ BasicContainer(widget),
+ mOpaque(true)
{
+}
- Container::Container(const Widget2 *const widget) :
- BasicContainer(widget),
- mOpaque(true)
- {
- }
+BasicContainer2::~BasicContainer2()
+{
+}
- Container::~Container()
+void BasicContainer2::draw(Graphics* graphics)
+{
+ BLOCK_START("BasicContainer2::draw")
+ if (isOpaque())
{
+ graphics->setColor(getBaseColor());
+ graphics->fillRectangle(Rect(0, 0, getWidth(), getHeight()));
}
- void Container::draw(Graphics* graphics)
- {
- BLOCK_START("Container::draw")
- if (isOpaque())
- {
- graphics->setColor(getBaseColor());
- graphics->fillRectangle(Rect(0, 0, getWidth(), getHeight()));
- }
-
- drawChildren(graphics);
- BLOCK_END("Container::draw")
- }
+ drawChildren(graphics);
+ BLOCK_END("BasicContainer2::draw")
+}
- void Container::setOpaque(bool opaque)
- {
- mOpaque = opaque;
- }
+void BasicContainer2::setOpaque(bool opaque)
+{
+ mOpaque = opaque;
+}
- bool Container::isOpaque() const
- {
- return mOpaque;
- }
+bool BasicContainer2::isOpaque() const
+{
+ return mOpaque;
+}
- void Container::add(Widget* widget)
- {
- BasicContainer::add(widget);
- }
+void BasicContainer2::add(Widget* widget)
+{
+ BasicContainer::add(widget);
+}
- void Container::add(Widget* widget, int x, int y)
- {
- widget->setPosition(x, y);
- BasicContainer::add(widget);
- }
+void BasicContainer2::add(Widget* widget, int x, int y)
+{
+ widget->setPosition(x, y);
+ BasicContainer::add(widget);
+}
- void Container::remove(Widget* widget)
- {
- BasicContainer::remove(widget);
- }
+void BasicContainer2::remove(Widget* widget)
+{
+ BasicContainer::remove(widget);
+}
- void Container::clear()
- {
- BasicContainer::clear();
- }
+void BasicContainer2::clear()
+{
+ BasicContainer::clear();
+}
- Widget* Container::findWidgetById(const std::string &id)
- {
- return BasicContainer::findWidgetById(id);
- }
-} // namespace gcn
+Widget* BasicContainer2::findWidgetById(const std::string &id)
+{
+ return BasicContainer::findWidgetById(id);
+}
diff --git a/src/gui/base/widgets/container.hpp b/src/gui/widgets/basiccontainer2.h
index 37984bbc9..16078016f 100644
--- a/src/gui/base/widgets/container.hpp
+++ b/src/gui/widgets/basiccontainer2.h
@@ -61,104 +61,102 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GCN_CONTAINER_HPP
-#define GCN_CONTAINER_HPP
+#ifndef GUI_WIDGETS_BASICCONTAINER2_HPP
+#define GUI_WIDGETS_BASICCONTAINER2_HPP
#include "gui/widgets/basiccontainer.h"
-namespace gcn
+/**
+ * An implementation of a container able to contain other widgets. A widget's
+ * position in the container is relative to the container itself and not the screen.
+ * A container is the most common widget to use as the Gui's top widget as makes the Gui
+ * able to contain more than one widget.
+ *
+ * @see Gui::setTop
+ */
+class BasicContainer2: public BasicContainer
{
- /**
- * An implementation of a container able to contain other widgets. A widget's
- * position in the container is relative to the container itself and not the screen.
- * A container is the most common widget to use as the Gui's top widget as makes the Gui
- * able to contain more than one widget.
- *
- * @see Gui::setTop
- */
- class Container: public BasicContainer
- {
public:
/**
- * Constructor. A container is opauqe as default, if you want a
- * none opaque container call setQpaque(false).
- *
- * @see setOpaque, isOpaque
- */
- explicit Container(const Widget2 *const widget);
+ * Constructor. A container is opauqe as default, if you want a
+ * none opaque container call setQpaque(false).
+ *
+ * @see setOpaque, isOpaque
+ */
+ explicit BasicContainer2(const Widget2 *const widget);
/**
- * Destructor.
- */
- virtual ~Container();
+ * Destructor.
+ */
+ virtual ~BasicContainer2();
/**
- * Sets the container to be opaque or not. If the container
- * is opaque its background will be drawn, if it's not opaque
- * its background will not be drawn, and thus making the container
- * completely transparent.
- *
- * NOTE: This is not the same as to set visibility. A non visible
- * container will not itself nor will it draw its content.
- *
- * @param opaque True if the container should be opaque, false otherwise.
- * @see isOpaque
- */
+ * Sets the container to be opaque or not. If the container
+ * is opaque its background will be drawn, if it's not opaque
+ * its background will not be drawn, and thus making the container
+ * completely transparent.
+ *
+ * NOTE: This is not the same as to set visibility. A non visible
+ * container will not itself nor will it draw its content.
+ *
+ * @param opaque True if the container should be opaque, false otherwise.
+ * @see isOpaque
+ */
void setOpaque(bool opaque);
/**
- * Checks if the container is opaque or not.
- *
- * @return True if the container is opaque, false otherwise.
- * @see setOpaque
- */
+ * Checks if the container is opaque or not.
+ *
+ * @return True if the container is opaque, false otherwise.
+ * @see setOpaque
+ */
bool isOpaque() const;
/**
- * Adds a widget to the container.
- *
- * @param widget The widget to add.
- * @see remove, clear
- */
+ * Adds a widget to the container.
+ *
+ * @param widget The widget to add.
+ * @see remove, clear
+ */
virtual void add(Widget* widget);
/**
- * Adds a widget to the container and also specifies the widget's
- * position in the container. The position is relative to the container
- * and not relative to the screen.
- *
- * @param widget The widget to add.
- * @param x The x coordinate for the widget.
- * @param y The y coordinate for the widget.
- * @see remove, clear
- */
+ * Adds a widget to the container and also specifies the widget's
+ * position in the container. The position is relative to the container
+ * and not relative to the screen.
+ *
+ * @param widget The widget to add.
+ * @param x The x coordinate for the widget.
+ * @param y The y coordinate for the widget.
+ * @see remove, clear
+ */
virtual void add(Widget* widget, int x, int y);
/**
- * Removes a widget from the Container.
- *
- * @param widget The widget to remove.
- * @throws Exception when the widget has not been added to the
- * container.
- * @see add, clear
- */
+ * Removes a widget from the Container.
+ *
+ * @param widget The widget to remove.
+ * @throws Exception when the widget has not been added to the
+ * container.
+ * @see add, clear
+ */
virtual void remove(Widget* widget);
/**
- * Clears the container of all widgets.
- *
- * @see add, remove
- */
+ * Clears the container of all widgets.
+ *
+ * @see add, remove
+ */
virtual void clear();
/**
- * Finds a widget given an id.
- *
- * @param id The id to find a widget by.
- * @return A widget with a corrosponding id, NULL if no widget
- * is found.
- * @see Widget::setId
- */
+ * Finds a widget given an id.
+ *
+ * @param id The id to find a widget by.
+ * @return A widget with a corrosponding id, NULL if no widget
+ * is found.
+ * @see Widget::setId
+ */
virtual Widget* findWidgetById(const std::string &id);
@@ -168,10 +166,9 @@ namespace gcn
protected:
/**
- * True if the container is opaque, false otherwise.
- */
+ * True if the container is opaque, false otherwise.
+ */
bool mOpaque;
- };
-} // namespace gcn
+};
-#endif // end GCN_CONTAINER_HPP
+#endif // GUI_WIDGETS_BASICCONTAINER2_HPP
diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp
index 93d74dc8d..52d11c4e8 100644
--- a/src/gui/widgets/container.cpp
+++ b/src/gui/widgets/container.cpp
@@ -27,7 +27,7 @@
#include "debug.h"
Container::Container(const Widget2 *const widget) :
- gcn::Container(widget)
+ BasicContainer2(widget)
{
setOpaque(false);
}
diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h
index 17d6b2af4..262d7327a 100644
--- a/src/gui/widgets/container.h
+++ b/src/gui/widgets/container.h
@@ -23,7 +23,7 @@
#ifndef GUI_WIDGETS_CONTAINER_H
#define GUI_WIDGETS_CONTAINER_H
-#include "gui/base/widgets/container.hpp"
+#include "gui/widgets/basiccontainer2.h"
/**
* A widget container.
@@ -34,7 +34,7 @@
*
* This container is also non-opaque by default.
*/
-class Container : public gcn::Container
+class Container : public BasicContainer2
{
public:
explicit Container(const Widget2 *const widget);
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 24722510b..668334fd5 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -24,7 +24,7 @@
#include "logger.h"
-#include "gui/base/widgets/container.hpp"
+#include "gui/widgets/basiccontainer2.h"
#include <cassert>
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index 288c282a0..27af0840d 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -27,13 +27,8 @@
#include <vector>
+class BasicContainer2;
class LayoutCell;
-
-namespace gcn
-{
- class Container;
-}
-
class Widget;
/**
@@ -42,7 +37,7 @@ class Widget;
class ContainerPlacer final
{
public:
- explicit ContainerPlacer(gcn::Container *c = nullptr,
+ explicit ContainerPlacer(BasicContainer2 *c = nullptr,
LayoutCell *lc = nullptr) :
mContainer(c), mCell(lc)
{}
@@ -66,7 +61,7 @@ class ContainerPlacer final
const int w = 1, const int h = 1);
private:
- gcn::Container *mContainer;
+ BasicContainer2 *mContainer;
LayoutCell *mCell;
};
diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp
index c225c7543..a8cf28bea 100644
--- a/src/gui/widgets/layouthelper.cpp
+++ b/src/gui/widgets/layouthelper.cpp
@@ -22,11 +22,11 @@
#include "gui/widgets/layouthelper.h"
-#include "gui/base/widgets/container.hpp"
+#include "gui/widgets/basiccontainer2.h"
#include "debug.h"
-LayoutHelper::LayoutHelper(gcn::Container *const container) :
+LayoutHelper::LayoutHelper(BasicContainer2 *const container) :
WidgetListener(),
mLayout(),
mContainer(container)
diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h
index 32e3d9e34..78e34f419 100644
--- a/src/gui/widgets/layouthelper.h
+++ b/src/gui/widgets/layouthelper.h
@@ -38,7 +38,7 @@ class LayoutHelper final : public WidgetListener
/**
* Constructor.
*/
- explicit LayoutHelper(gcn::Container *const container);
+ explicit LayoutHelper(BasicContainer2 *const container);
A_DELETE_COPY(LayoutHelper)
@@ -82,7 +82,7 @@ class LayoutHelper final : public WidgetListener
private:
Layout mLayout; /**< Layout handler */
- gcn::Container *mContainer; /**< Managed container */
+ BasicContainer2 *mContainer; /**< Managed container */
};
#endif // GUI_WIDGETS_LAYOUTHELPER_H
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 5d125cadd..c075cbc62 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -75,7 +75,7 @@
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/tabs/tab.h"
-#include "gui/base/widgets/container.hpp"
+#include "gui/widgets/basiccontainer2.h"
#include "debug.h"
@@ -86,8 +86,8 @@ TabbedArea::TabbedArea(const Widget2 *const widget) :
MouseListener(),
WidgetListener(),
mSelectedTab(nullptr),
- mTabContainer(new gcn::Container(widget)),
- mWidgetContainer(new gcn::Container(widget)),
+ mTabContainer(new BasicContainer2(widget)),
+ mWidgetContainer(new BasicContainer2(widget)),
mTabsToDelete(),
mTabs(),
mTabsWidth(0),
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index 11f3a46d3..0e7a032f0 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -70,7 +70,7 @@
#include "listeners/mouselistener.h"
#include "listeners/widgetlistener.h"
-#include "gui/base/widgets/container.hpp"
+#include "gui/widgets/basiccontainer2.h"
#include "listeners/actionlistener.h"
@@ -251,8 +251,8 @@ class TabbedArea final : public ActionListener,
void updateTabsWidth();
Tab* mSelectedTab;
- gcn::Container* mTabContainer;
- gcn::Container* mWidgetContainer;
+ BasicContainer2* mTabContainer;
+ BasicContainer2* mWidgetContainer;
std::vector<Tab*> mTabsToDelete;
TabContainer mTabs;
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index ec83af9a8..5a636013b 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -91,7 +91,7 @@ int Window::mouseResize = 0;
Window::Window(const std::string &caption, const bool modal,
Window *const parent, std::string skin) :
- gcn::Container(nullptr),
+ BasicContainer2(nullptr),
MouseListener(),
WidgetListener(),
mCaption(caption),
@@ -668,9 +668,9 @@ void Window::setVisible(const bool visible, const bool forceSticky)
mResizeHandles = 0;
if (mStickyButtonLock)
- gcn::Container::setVisible(visible);
+ BasicContainer2::setVisible(visible);
else
- gcn::Container::setVisible((!forceSticky && mSticky) || visible);
+ BasicContainer2::setVisible((!forceSticky && mSticky) || visible);
if (visible)
{
if (mPlayVisibleSound)
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 6369990bb..3a9bf2157 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -71,7 +71,7 @@
#include "listeners/mouselistener.h"
#include "listeners/widgetlistener.h"
-#include "gui/base/widgets/container.hpp"
+#include "gui/widgets/basiccontainer2.h"
#include "localconsts.h"
@@ -88,7 +88,7 @@ class WindowContainer;
*
* \ingroup GUI
*/
-class Window : public gcn::Container,
+class Window : public BasicContainer2,
public MouseListener,
private WidgetListener
{