summaryrefslogtreecommitdiff
path: root/src/gui/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/base')
-rw-r--r--src/gui/base/basiccontainer.hpp4
-rw-r--r--src/gui/base/widget.cpp3
-rw-r--r--src/gui/base/widget.hpp6
-rw-r--r--src/gui/base/widgets/button.cpp9
-rw-r--r--src/gui/base/widgets/button.hpp5
-rw-r--r--src/gui/base/widgets/checkbox.cpp10
-rw-r--r--src/gui/base/widgets/checkbox.hpp6
-rw-r--r--src/gui/base/widgets/container.cpp4
-rw-r--r--src/gui/base/widgets/container.hpp2
-rw-r--r--src/gui/base/widgets/label.cpp9
-rw-r--r--src/gui/base/widgets/label.hpp5
-rw-r--r--src/gui/base/widgets/listbox.cpp9
-rw-r--r--src/gui/base/widgets/listbox.hpp5
-rw-r--r--src/gui/base/widgets/radiobutton.cpp9
-rw-r--r--src/gui/base/widgets/radiobutton.hpp5
-rw-r--r--src/gui/base/widgets/scrollarea.cpp14
-rw-r--r--src/gui/base/widgets/scrollarea.hpp8
-rw-r--r--src/gui/base/widgets/slider.cpp11
-rw-r--r--src/gui/base/widgets/slider.hpp7
-rw-r--r--src/gui/base/widgets/textbox.cpp9
-rw-r--r--src/gui/base/widgets/textbox.hpp5
-rw-r--r--src/gui/base/widgets/textfield.cpp9
-rw-r--r--src/gui/base/widgets/textfield.hpp5
-rw-r--r--src/gui/base/widgets/window.cpp9
-rw-r--r--src/gui/base/widgets/window.hpp5
25 files changed, 103 insertions, 70 deletions
diff --git a/src/gui/base/basiccontainer.hpp b/src/gui/base/basiccontainer.hpp
index 0fec2c0e7..cc3aee808 100644
--- a/src/gui/base/basiccontainer.hpp
+++ b/src/gui/base/basiccontainer.hpp
@@ -85,7 +85,9 @@ namespace gcn
public DeathListener
{
public:
- BasicContainer() :
+ BasicContainer(const Widget2 *const widget) :
+ Widget(widget),
+ DeathListener(),
mWidgets()
{ }
diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp
index 9e2912d39..f5994d1af 100644
--- a/src/gui/base/widget.cpp
+++ b/src/gui/base/widget.cpp
@@ -94,7 +94,8 @@ namespace gcn
std::list<Widget*> Widget::mWidgets;
std::set<Widget*> Widget::mWidgetsSet;
- Widget::Widget() :
+ Widget::Widget(const Widget2 *const widget) :
+ Widget2(widget),
mMouseListeners(),
mKeyListeners(),
mActionListeners(),
diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp
index 1c1c0ae14..013ead3b8 100644
--- a/src/gui/base/widget.hpp
+++ b/src/gui/base/widget.hpp
@@ -71,6 +71,8 @@
#include "gui/base/color.hpp"
#include "gui/base/rectangle.hpp"
+#include "gui/widgets/widget2.h"
+
#include "localconsts.h"
class ActionListener;
@@ -100,7 +102,7 @@ namespace gcn
* @author Per Larsson.
* @since 0.1.0
*/
- class Widget
+ class Widget : public Widget2
{
public:
/**
@@ -108,7 +110,7 @@ namespace gcn
* focusable as default, therefore, widgets that are supposed to be
* focusable should overide this default in their own constructor.
*/
- Widget();
+ Widget(const Widget2 *const widget);
A_DELETE_COPY(Widget)
diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp
index 5867b9dc8..e4285cffd 100644
--- a/src/gui/base/widgets/button.cpp
+++ b/src/gui/base/widgets/button.cpp
@@ -80,8 +80,8 @@
namespace gcn
{
- Button::Button() :
- gcn::Widget(),
+ Button::Button(const Widget2 *const widget) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
FocusListener(),
@@ -101,8 +101,9 @@ namespace gcn
addFocusListener(this);
}
- Button::Button(const std::string& caption) :
- gcn::Widget(),
+ Button::Button(const Widget2 *const widget,
+ const std::string& caption) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
FocusListener(),
diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp
index 6fee7f3b3..7fd5613bd 100644
--- a/src/gui/base/widgets/button.hpp
+++ b/src/gui/base/widgets/button.hpp
@@ -96,7 +96,7 @@ namespace gcn
/**
* Constructor.
*/
- Button();
+ explicit Button(const Widget2 *const widget);
/**
* Constructor. The button will be automatically resized
@@ -104,7 +104,8 @@ namespace gcn
*
* @param caption The caption of the button.
*/
- explicit Button(const std::string& caption);
+ Button(const Widget2 *const widget,
+ const std::string& caption);
A_DELETE_COPY(Button)
diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp
index 7cba5ac47..d75fb5cb0 100644
--- a/src/gui/base/widgets/checkbox.cpp
+++ b/src/gui/base/widgets/checkbox.cpp
@@ -79,8 +79,8 @@
namespace gcn
{
- CheckBox::CheckBox() :
- gcn::Widget(),
+ CheckBox::CheckBox(const Widget2 *const widget) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mSelected(false),
@@ -91,8 +91,10 @@ namespace gcn
addKeyListener(this);
}
- CheckBox::CheckBox(const std::string &caption, bool selected) :
- gcn::Widget(),
+ CheckBox::CheckBox(const Widget2 *const widget,
+ const std::string &caption,
+ bool selected) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mSelected(selected),
diff --git a/src/gui/base/widgets/checkbox.hpp b/src/gui/base/widgets/checkbox.hpp
index c03187bba..d87a6b206 100644
--- a/src/gui/base/widgets/checkbox.hpp
+++ b/src/gui/base/widgets/checkbox.hpp
@@ -90,7 +90,7 @@ namespace gcn
/**
* Contructor.
*/
- CheckBox();
+ CheckBox(const Widget2 *const widget);
/**
* Constructor. The check box will be automatically resized
@@ -99,7 +99,9 @@ namespace gcn
* @param caption The caption of the check box.
* @param marked True if the check box is selected, false otherwise.
*/
- CheckBox(const std::string &caption, bool selected = false);
+ CheckBox(const Widget2 *const widget,
+ const std::string &caption,
+ bool selected = false);
A_DELETE_COPY(CheckBox)
diff --git a/src/gui/base/widgets/container.cpp b/src/gui/base/widgets/container.cpp
index 6026b920d..c79f8fcbc 100644
--- a/src/gui/base/widgets/container.cpp
+++ b/src/gui/base/widgets/container.cpp
@@ -75,8 +75,8 @@
namespace gcn
{
- Container::Container() :
- BasicContainer(),
+ Container::Container(const Widget2 *const widget) :
+ BasicContainer(widget),
mOpaque(true)
{
}
diff --git a/src/gui/base/widgets/container.hpp b/src/gui/base/widgets/container.hpp
index bffe6e884..ba3cff153 100644
--- a/src/gui/base/widgets/container.hpp
+++ b/src/gui/base/widgets/container.hpp
@@ -89,7 +89,7 @@ namespace gcn
*
* @see setOpaque, isOpaque
*/
- Container();
+ Container(const Widget2 *const widget);
/**
* Destructor.
diff --git a/src/gui/base/widgets/label.cpp b/src/gui/base/widgets/label.cpp
index cbee2ac4c..84ba87d84 100644
--- a/src/gui/base/widgets/label.cpp
+++ b/src/gui/base/widgets/label.cpp
@@ -75,15 +75,16 @@
namespace gcn
{
- Label::Label() :
- gcn::Widget(),
+ Label::Label(const Widget2 *const widget) :
+ gcn::Widget(widget),
mCaption(),
mAlignment(Graphics::LEFT)
{
}
- Label::Label(const std::string& caption) :
- gcn::Widget(),
+ Label::Label(const Widget2 *const widget,
+ const std::string& caption) :
+ gcn::Widget(widget),
mCaption(caption),
mAlignment(Graphics::LEFT)
{
diff --git a/src/gui/base/widgets/label.hpp b/src/gui/base/widgets/label.hpp
index 90a395f7b..399e4202a 100644
--- a/src/gui/base/widgets/label.hpp
+++ b/src/gui/base/widgets/label.hpp
@@ -81,7 +81,7 @@ namespace gcn
/**
* Constructor.
*/
- Label();
+ explicit Label(const Widget2 *const widget);
/**
* Constructor. The label will be automatically resized
@@ -89,7 +89,8 @@ namespace gcn
*
* @param caption The caption of the label.
*/
- explicit Label(const std::string& caption);
+ Label(const Widget2 *const widget,
+ const std::string& caption);
A_DELETE_COPY(Label)
diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp
index ad1bf2535..0dd5c88f7 100644
--- a/src/gui/base/widgets/listbox.cpp
+++ b/src/gui/base/widgets/listbox.cpp
@@ -83,8 +83,8 @@
namespace gcn
{
- ListBox::ListBox() :
- gcn::Widget(),
+ ListBox::ListBox(const Widget2 *const widget) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mSelected(-1),
@@ -99,8 +99,9 @@ namespace gcn
addKeyListener(this);
}
- ListBox::ListBox(ListModel *listModel) :
- gcn::Widget(),
+ ListBox::ListBox(const Widget2 *const widget,
+ ListModel *listModel) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mSelected(-1),
diff --git a/src/gui/base/widgets/listbox.hpp b/src/gui/base/widgets/listbox.hpp
index 61c8486bb..ff2df395c 100644
--- a/src/gui/base/widgets/listbox.hpp
+++ b/src/gui/base/widgets/listbox.hpp
@@ -96,14 +96,15 @@ namespace gcn
/**
* Constructor.
*/
- ListBox();
+ explicit ListBox(const Widget2 *const widget);
/**
* Constructor.
*
* @param listModel the list model to use.
*/
- explicit ListBox(ListModel *listModel);
+ ListBox(const Widget2 *const widget,
+ ListModel *listModel);
A_DELETE_COPY(ListBox)
diff --git a/src/gui/base/widgets/radiobutton.cpp b/src/gui/base/widgets/radiobutton.cpp
index 4cd515bba..832c00bbe 100644
--- a/src/gui/base/widgets/radiobutton.cpp
+++ b/src/gui/base/widgets/radiobutton.cpp
@@ -80,8 +80,8 @@ namespace gcn
{
RadioButton::GroupMap RadioButton::mGroupMap;
- RadioButton::RadioButton() :
- gcn::Widget(),
+ RadioButton::RadioButton(const Widget2 *const widget) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mSelected(false),
@@ -95,10 +95,11 @@ namespace gcn
addKeyListener(this);
}
- RadioButton::RadioButton(const std::string &caption,
+ RadioButton::RadioButton(const Widget2 *const widget,
+ const std::string &caption,
const std::string &group,
bool selected) :
- gcn::Widget(),
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mSelected(false),
diff --git a/src/gui/base/widgets/radiobutton.hpp b/src/gui/base/widgets/radiobutton.hpp
index 8a9a8b585..4d4403fac 100644
--- a/src/gui/base/widgets/radiobutton.hpp
+++ b/src/gui/base/widgets/radiobutton.hpp
@@ -93,7 +93,7 @@ namespace gcn
/**
* Constructor.
*/
- RadioButton();
+ RadioButton(const Widget2 *const widget);
/**
* Constructor. The radio button will be automatically resized
@@ -103,7 +103,8 @@ namespace gcn
* @param group The group the radio button should belong to.
* @param selected True if the radio button should be selected.
*/
- RadioButton(const std::string &caption,
+ RadioButton(const Widget2 *const widget,
+ const std::string &caption,
const std::string &group,
bool selected = false);
diff --git a/src/gui/base/widgets/scrollarea.cpp b/src/gui/base/widgets/scrollarea.cpp
index f76226bc5..68e1b72d3 100644
--- a/src/gui/base/widgets/scrollarea.cpp
+++ b/src/gui/base/widgets/scrollarea.cpp
@@ -74,8 +74,8 @@
namespace gcn
{
- ScrollArea::ScrollArea() :
- gcn::BasicContainer(),
+ ScrollArea::ScrollArea(const Widget2 *const widget) :
+ gcn::BasicContainer(widget),
MouseListener(),
mVScroll(0),
mHScroll(0),
@@ -101,8 +101,9 @@ namespace gcn
addMouseListener(this);
}
- ScrollArea::ScrollArea(Widget *const content) :
- gcn::BasicContainer(),
+ ScrollArea::ScrollArea(const Widget2 *const widget,
+ Widget *const content) :
+ gcn::BasicContainer(widget),
MouseListener(),
mVScroll(0),
mHScroll(0),
@@ -129,10 +130,11 @@ namespace gcn
addMouseListener(this);
}
- ScrollArea::ScrollArea(Widget *content,
+ ScrollArea::ScrollArea(const Widget2 *const widget,
+ Widget *content,
ScrollPolicy hPolicy,
ScrollPolicy vPolicy) :
- gcn::BasicContainer(),
+ gcn::BasicContainer(widget),
MouseListener(),
mVScroll(0),
mHScroll(0),
diff --git a/src/gui/base/widgets/scrollarea.hpp b/src/gui/base/widgets/scrollarea.hpp
index 1d4c0dd54..e2d8aada5 100644
--- a/src/gui/base/widgets/scrollarea.hpp
+++ b/src/gui/base/widgets/scrollarea.hpp
@@ -100,14 +100,15 @@ namespace gcn
/**
* Constructor.
*/
- ScrollArea();
+ explicit ScrollArea(const Widget2 *const widget);
/**
* Constructor.
*
* @param content The content of the scroll area.
*/
- explicit ScrollArea(Widget *const content);
+ ScrollArea(const Widget2 *const widget,
+ Widget *const content);
/**
* Constructor.
@@ -118,7 +119,8 @@ namespace gcn
* @param vPolicy The policy for the vertical scrollbar. See enum with
* policies.
*/
- ScrollArea(Widget *content,
+ ScrollArea(const Widget2 *const widget,
+ Widget *content,
ScrollPolicy hPolicy,
ScrollPolicy vPolicy);
diff --git a/src/gui/base/widgets/slider.cpp b/src/gui/base/widgets/slider.cpp
index 1245b6590..e995ff55a 100644
--- a/src/gui/base/widgets/slider.cpp
+++ b/src/gui/base/widgets/slider.cpp
@@ -76,8 +76,9 @@
namespace gcn
{
- Slider::Slider(const double scaleEnd) :
- gcn::Widget(),
+ Slider::Slider(const Widget2 *const widget,
+ const double scaleEnd) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mDragged(false),
@@ -95,8 +96,10 @@ namespace gcn
addKeyListener(this);
}
- Slider::Slider(const double scaleStart, const double scaleEnd) :
- gcn::Widget(),
+ Slider::Slider(const Widget2 *const widget,
+ const double scaleStart,
+ const double scaleEnd) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mDragged(false),
diff --git a/src/gui/base/widgets/slider.hpp b/src/gui/base/widgets/slider.hpp
index f77d3f5dd..f29ad5950 100644
--- a/src/gui/base/widgets/slider.hpp
+++ b/src/gui/base/widgets/slider.hpp
@@ -99,7 +99,8 @@ namespace gcn
*
* @param scaleEnd The end value of the slider scale.
*/
- explicit Slider(const double scaleEnd = 1.0);
+ explicit Slider(const Widget2 *const widget,
+ const double scaleEnd = 1.0);
/**
* Constructor.
@@ -107,7 +108,9 @@ namespace gcn
* @param scaleStart The start value of the slider scale.
* @param scaleEnd The end value of the slider scale.
*/
- Slider(const double scaleStart, const double scaleEnd);
+ Slider(const Widget2 *const widget,
+ const double scaleStart,
+ const double scaleEnd);
A_DELETE_COPY(Slider)
diff --git a/src/gui/base/widgets/textbox.cpp b/src/gui/base/widgets/textbox.cpp
index 292e35850..7a5b63a50 100644
--- a/src/gui/base/widgets/textbox.cpp
+++ b/src/gui/base/widgets/textbox.cpp
@@ -80,8 +80,8 @@
namespace gcn
{
- TextBox::TextBox() :
- gcn::Widget(),
+ TextBox::TextBox(const Widget2 *const widget) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mTextRows(),
@@ -98,8 +98,9 @@ namespace gcn
adjustSize();
}
- TextBox::TextBox(const std::string& text) :
- gcn::Widget(),
+ TextBox::TextBox(const Widget2 *const widget,
+ const std::string& text) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mTextRows(),
diff --git a/src/gui/base/widgets/textbox.hpp b/src/gui/base/widgets/textbox.hpp
index 8fc788816..0c96096ec 100644
--- a/src/gui/base/widgets/textbox.hpp
+++ b/src/gui/base/widgets/textbox.hpp
@@ -87,14 +87,15 @@ namespace gcn
/**
* Constructor.
*/
- TextBox();
+ explicit TextBox(const Widget2 *const widget);
/**
* Constructor.
*
* @param text The default text of the text box.
*/
- explicit TextBox(const std::string& text);
+ TextBox(const Widget2 *const widget,
+ const std::string& text);
A_DELETE_COPY(TextBox)
diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp
index f149e8667..6ca37c4af 100644
--- a/src/gui/base/widgets/textfield.cpp
+++ b/src/gui/base/widgets/textfield.cpp
@@ -78,8 +78,8 @@
namespace gcn
{
- TextField::TextField() :
- gcn::Widget(),
+ TextField::TextField(const Widget2 *const widget) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mText(),
@@ -92,8 +92,9 @@ namespace gcn
addKeyListener(this);
}
- TextField::TextField(const std::string& text) :
- gcn::Widget(),
+ TextField::TextField(const Widget2 *const widget,
+ const std::string& text) :
+ gcn::Widget(widget),
MouseListener(),
KeyListener(),
mText(text),
diff --git a/src/gui/base/widgets/textfield.hpp b/src/gui/base/widgets/textfield.hpp
index 099ed1356..aa5f210c5 100644
--- a/src/gui/base/widgets/textfield.hpp
+++ b/src/gui/base/widgets/textfield.hpp
@@ -85,7 +85,7 @@ namespace gcn
/**
* Constructor.
*/
- TextField();
+ explicit TextField(const Widget2 *const widget);
/**
* Constructor. The text field will be automatically resized
@@ -93,7 +93,8 @@ namespace gcn
*
* @param text The default text of the text field.
*/
- explicit TextField(const std::string& text);
+ TextField(const Widget2 *const widget,
+ const std::string& text);
A_DELETE_COPY(TextField)
diff --git a/src/gui/base/widgets/window.cpp b/src/gui/base/widgets/window.cpp
index 8d33c1dd5..0ead95bc1 100644
--- a/src/gui/base/widgets/window.cpp
+++ b/src/gui/base/widgets/window.cpp
@@ -77,8 +77,8 @@
namespace gcn
{
- Window::Window() :
- Container(),
+ Window::Window(const Widget2 *const widget) :
+ Container(widget),
MouseListener(),
mCaption(),
mAlignment(Graphics::CENTER),
@@ -94,8 +94,9 @@ namespace gcn
addMouseListener(this);
}
- Window::Window(const std::string& caption) :
- Container(),
+ Window::Window(const Widget2 *const widget,
+ const std::string& caption) :
+ Container(widget),
MouseListener(),
mCaption(caption),
mAlignment(Graphics::CENTER),
diff --git a/src/gui/base/widgets/window.hpp b/src/gui/base/widgets/window.hpp
index 030d57edc..e2772d850 100644
--- a/src/gui/base/widgets/window.hpp
+++ b/src/gui/base/widgets/window.hpp
@@ -82,7 +82,7 @@ namespace gcn
/**
* Constructor.
*/
- Window();
+ explicit Window(const Widget2 *const widget);
/**
* Constructor. The window will be automatically resized in height
@@ -90,7 +90,8 @@ namespace gcn
*
* @param caption the caption of the window.
*/
- explicit Window(const std::string& caption);
+ Window(const Widget2 *const widget,
+ const std::string& caption);
A_DELETE_COPY(Window)