summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-23 22:11:54 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-23 23:22:45 +0300
commit89694323abffb1c73c85d49460991b3e6f20f098 (patch)
treee4c11c4236bec6db774dd56925335a1535568ef8 /src/gui
parent0c3a1befd07924ce17ce2051eb45e60776480830 (diff)
downloadplus-89694323abffb1c73c85d49460991b3e6f20f098.tar.gz
plus-89694323abffb1c73c85d49460991b3e6f20f098.tar.bz2
plus-89694323abffb1c73c85d49460991b3e6f20f098.tar.xz
plus-89694323abffb1c73c85d49460991b3e6f20f098.zip
Move window variable from widget class to widget2 class.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/basiccontainer.cpp1
-rw-r--r--src/gui/widgets/popup.cpp2
-rw-r--r--src/gui/widgets/popup.h2
-rw-r--r--src/gui/widgets/widget.cpp1
-rw-r--r--src/gui/widgets/widget.h8
-rw-r--r--src/gui/widgets/widget2.h14
-rw-r--r--src/gui/widgets/window.cpp2
-rw-r--r--src/gui/widgets/window.h2
8 files changed, 20 insertions, 12 deletions
diff --git a/src/gui/widgets/basiccontainer.cpp b/src/gui/widgets/basiccontainer.cpp
index 271d11925..2ab185a61 100644
--- a/src/gui/widgets/basiccontainer.cpp
+++ b/src/gui/widgets/basiccontainer.cpp
@@ -250,7 +250,6 @@ void BasicContainer::add(Widget *const widget)
widget->setFocusHandler(mInternalFocusHandler);
widget->setParent(this);
- widget->setWindow(getWindow());
widget->addDeathListener(this);
}
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index a69c7a654..7383ac94b 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -53,6 +53,8 @@ Popup::Popup(const std::string &name,
{
logger->log("Popup::Popup(\"%s\")", name.c_str());
+ mWindow = this;
+
addWidgetListener(this);
if (skin == "")
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index 1d5bf0492..f39a92ec0 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -172,7 +172,7 @@ class Popup notfinal : public Container,
{ return mVisible; }
virtual void postInit()
- { mInit = true; mWindow = this; }
+ { mInit = true; }
protected:
int mPadding; /**< Holds the padding of the popup. */
diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp
index cbf301b27..f6f3854f4 100644
--- a/src/gui/widgets/widget.cpp
+++ b/src/gui/widgets/widget.cpp
@@ -96,7 +96,6 @@ Widget::Widget(const Widget2 *const widget) :
mFocusHandler(nullptr),
mInternalFocusHandler(nullptr),
mParent(nullptr),
- mWindow(nullptr),
mCurrentFont(nullptr),
mFrameSize(0),
mFocusable(false),
diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h
index f1db2b481..8191754e5 100644
--- a/src/gui/widgets/widget.h
+++ b/src/gui/widgets/widget.h
@@ -199,9 +199,6 @@ class Widget notfinal : public Widget2
Widget* getParent() const A_WARN_UNUSED
{ return mParent; }
- Widget* getWindow() const A_WARN_UNUSED
- { return mWindow; }
-
/**
* Sets the width of the widget.
*
@@ -669,9 +666,6 @@ class Widget notfinal : public Widget2
virtual void setParent(Widget* parent)
{ mParent = parent; }
- virtual void setWindow(Widget* window)
- { mWindow = window; }
-
/**
* Gets the font set for the widget. If no font has been set,
* the global font will be returned. If no global font has been set,
@@ -1199,8 +1193,6 @@ class Widget notfinal : public Widget2
*/
Widget* mParent;
- Widget* mWindow;
-
/**
* Holds the font used by the widget.
*/
diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h
index c8ee90406..2fdb8b12b 100644
--- a/src/gui/widgets/widget2.h
+++ b/src/gui/widgets/widget2.h
@@ -23,6 +23,8 @@
#include "gui/theme.h"
+class Widget;
+
class Widget2 notfinal
{
public:
@@ -76,15 +78,27 @@ class Widget2 notfinal
mForegroundColor2 = color;
}
+ Widget* getWindow() const A_WARN_UNUSED
+ {
+ return mWindow;
+ }
+
+ virtual void setWindow(Widget *const window)
+ {
+ mWindow = window;
+ }
+
protected:
explicit Widget2(const Widget2 *const widget) :
mPaletteOffset(widget ? widget->mPaletteOffset : 0),
+ mWindow(widget ? widget->getWindow() : nullptr),
mForegroundColor2()
{
checkPalette();
}
int mPaletteOffset;
+ Widget *mWindow;
Color mForegroundColor2;
};
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 53bf92cc0..657fbcd88 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -155,6 +155,8 @@ Window::Window(const std::string &caption,
{
logger->log("Window::Window(\"%s\")", caption.c_str());
+ mWindow = this;
+
windowInstances++;
// mFrameSize = 1;
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 90d0ade38..83f88f726 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -286,7 +286,7 @@ class Window notfinal : public BasicContainer2,
{ mSaveVisible = save; }
virtual void postInit()
- { mInit = true; mWindow = this; }
+ { mInit = true; }
/**
* Returns the parent window.