summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-25 18:35:21 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-25 18:35:21 +0300
commit71f88c02f79a1164430eec1de3e15edec011a15e (patch)
tree6a0772ee943a41314b5abd92fed0ce269faced27 /src/gui
parent6c05739c62484dae8d5ed9fb0dfdb6590aacfe88 (diff)
downloadplus-71f88c02f79a1164430eec1de3e15edec011a15e.tar.gz
plus-71f88c02f79a1164430eec1de3e15edec011a15e.tar.bz2
plus-71f88c02f79a1164430eec1de3e15edec011a15e.tar.xz
plus-71f88c02f79a1164430eec1de3e15edec011a15e.zip
improve construcors in abstract classes.
Also add some missing final to classes.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/debugwindow.h9
-rw-r--r--src/gui/widgets/characterviewbase.h18
-rw-r--r--src/gui/widgets/layout.h32
-rw-r--r--src/gui/widgets/setupitem.h52
-rw-r--r--src/gui/widgets/setuptab.h4
-rw-r--r--src/gui/widgets/shortcutcontainer.h10
-rw-r--r--src/gui/widgets/tablemodel.h9
-rw-r--r--src/gui/widgets/widget2.h26
-rw-r--r--src/gui/widgets/widgetgroup.h8
9 files changed, 84 insertions, 84 deletions
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index 3a6fa7229..ef67df432 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -34,10 +34,6 @@ class DebugTab : public Container
friend class DebugWindow;
public:
- explicit DebugTab(const Widget2 *const widget) :
- Container(widget)
- { }
-
A_DELETE_COPY(DebugTab)
void logic() override = 0;
@@ -45,7 +41,10 @@ class DebugTab : public Container
void resize(const int x, const int y)
{ setDimension(gcn::Rectangle(0, 0, x, y)); }
- private:
+ protected:
+ explicit DebugTab(const Widget2 *const widget) :
+ Container(widget)
+ { }
};
class MapDebugTab final : public DebugTab
diff --git a/src/gui/widgets/characterviewbase.h b/src/gui/widgets/characterviewbase.h
index 2c90bb1e6..8ef949b7c 100644
--- a/src/gui/widgets/characterviewbase.h
+++ b/src/gui/widgets/characterviewbase.h
@@ -33,15 +33,6 @@ class CharacterViewBase : public Container,
public gcn::ActionListener
{
public:
- CharacterViewBase(CharSelectDialog *const widget, const int padding) :
- Container(widget),
- gcn::ActionListener(),
- mParent(widget),
- mPadding(padding),
- mSelected(0)
- {
- }
-
A_DELETE_COPY(CharacterViewBase)
virtual ~CharacterViewBase()
@@ -57,6 +48,15 @@ class CharacterViewBase : public Container,
}
protected:
+ CharacterViewBase(CharSelectDialog *const widget, const int padding) :
+ Container(widget),
+ gcn::ActionListener(),
+ mParent(widget),
+ mPadding(padding),
+ mSelected(0)
+ {
+ }
+
CharSelectDialog *mParent;
int mPadding;
int mSelected;
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index 33930c69e..8a33f03f6 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -173,22 +173,6 @@ class LayoutCell
FILL
};
- LayoutCell():
- mWidget(nullptr),
- mHPadding(0),
- mVPadding(0),
- mType(NONE)
- {
- mExtent[0] = 0;
- mExtent[1] = 0;
- mAlign[0] = 0;
- mAlign[1] = 0;
- mNbFill[0] = 0;
- mNbFill[1] = 0;
- mSize[0] = 0;
- mSize[1] = 0;
- }
-
virtual ~LayoutCell();
/**
@@ -286,6 +270,22 @@ class LayoutCell
};
private:
+ LayoutCell():
+ mWidget(nullptr),
+ mHPadding(0),
+ mVPadding(0),
+ mType(NONE)
+ {
+ mExtent[0] = 0;
+ mExtent[1] = 0;
+ mAlign[0] = 0;
+ mAlign[1] = 0;
+ mNbFill[0] = 0;
+ mNbFill[1] = 0;
+ mSize[0] = 0;
+ mSize[1] = 0;
+ }
+
// Copy not allowed, as the cell may own an array.
explicit LayoutCell(LayoutCell const &);
LayoutCell &operator=(LayoutCell const &);
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 476a31ae4..9c5cc11e3 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -57,15 +57,6 @@ class SetupItem : public gcn::ActionListener,
VNONE
};
- SetupItem(const std::string &text, const std::string &description,
- const std::string &keyName, SetupTabScroll *const parent,
- const std::string &eventName, const bool mainConfig);
-
- SetupItem(const std::string &text, const std::string &description,
- const std::string &keyName, SetupTabScroll *const parent,
- const std::string &eventName, const std::string &def,
- const bool mainConfig);
-
A_DELETE_COPY(SetupItem)
~SetupItem();
@@ -106,6 +97,15 @@ class SetupItem : public gcn::ActionListener,
void rereadValue();
protected:
+ SetupItem(const std::string &text, const std::string &description,
+ const std::string &keyName, SetupTabScroll *const parent,
+ const std::string &eventName, const bool mainConfig);
+
+ SetupItem(const std::string &text, const std::string &description,
+ const std::string &keyName, SetupTabScroll *const parent,
+ const std::string &eventName, const std::string &def,
+ const bool mainConfig);
+
std::string mText;
std::string mDescription;
@@ -427,6 +427,23 @@ class SetupItemSlider2 final : public SetupItem
class SetupItemSliderList : public SetupItem
{
public:
+ A_DELETE_COPY(SetupItemSliderList)
+
+ ~SetupItemSliderList();
+
+ void createControls();
+
+ void fromWidget() override;
+
+ void toWidget() override;
+
+ virtual void action(const gcn::ActionEvent &event) override;
+
+ void apply(const std::string &eventName) override;
+
+ virtual void addMoreControls() = 0;
+
+ protected:
SetupItemSliderList(const std::string &text,
const std::string &description,
const std::string &keyName,
@@ -446,23 +463,6 @@ class SetupItemSliderList : public SetupItem
const bool onTheFly = false,
const bool mainConfig = true);
- A_DELETE_COPY(SetupItemSliderList)
-
- ~SetupItemSliderList();
-
- void createControls();
-
- void fromWidget() override;
-
- void toWidget() override;
-
- virtual void action(const gcn::ActionEvent &event) override;
-
- void apply(const std::string &eventName) override;
-
- virtual void addMoreControls() = 0;
-
- protected:
HorizontContainer *mHorizont;
Label *mLabel;
SliderList *mSlider;
diff --git a/src/gui/widgets/setuptab.h b/src/gui/widgets/setuptab.h
index 8e656234f..ab866ba28 100644
--- a/src/gui/widgets/setuptab.h
+++ b/src/gui/widgets/setuptab.h
@@ -40,8 +40,6 @@ class SetupTab : public Container,
public gcn::WidgetListener
{
public:
- explicit SetupTab(const Widget2 *const widget);
-
A_DELETE_COPY(SetupTab)
const std::string &getName() const A_WARN_UNUSED
@@ -60,6 +58,8 @@ class SetupTab : public Container,
virtual void externalUpdated();
protected:
+ explicit SetupTab(const Widget2 *const widget);
+
/**
* Sets the name displayed on the tab. Should be set in the
* constructor of a subclass.
diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h
index 2f6a48bc4..60c1bb539 100644
--- a/src/gui/widgets/shortcutcontainer.h
+++ b/src/gui/widgets/shortcutcontainer.h
@@ -43,11 +43,6 @@ class ShortcutContainer : public gcn::Widget,
public gcn::MouseListener
{
public:
- /**
- * Constructor. Initializes the shortcut container.
- */
- ShortcutContainer();
-
A_DELETE_COPY(ShortcutContainer)
/**
@@ -99,6 +94,11 @@ class ShortcutContainer : public gcn::Widget,
protected:
/**
+ * Constructor. Initializes the shortcut container.
+ */
+ ShortcutContainer();
+
+ /**
* Gets the index from the grid provided the point is in an item box.
*
* @param pointX X coordinate of the point.
diff --git a/src/gui/widgets/tablemodel.h b/src/gui/widgets/tablemodel.h
index 427b8bf3a..7d7daacb9 100644
--- a/src/gui/widgets/tablemodel.h
+++ b/src/gui/widgets/tablemodel.h
@@ -57,10 +57,6 @@ public:
class TableModel
{
public:
- TableModel() :
- listeners()
- {
- }
virtual ~TableModel()
{ }
@@ -95,6 +91,11 @@ public:
virtual void removeListener(TableModelListener *const listener);
protected:
+ TableModel() :
+ listeners()
+ {
+ }
+
/**
* Tells all listeners that the table is about to see an update
*/
diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h
index 9e164046b..0ab171b3e 100644
--- a/src/gui/widgets/widget2.h
+++ b/src/gui/widgets/widget2.h
@@ -29,19 +29,6 @@
class Widget2
{
public:
- Widget2() :
- mPaletteOffset(0),
- mForegroundColor2()
- {
- }
-
- explicit Widget2(const Widget2 *const widget) :
- mPaletteOffset(widget ? widget->mPaletteOffset : 0),
- mForegroundColor2()
- {
- checkPalette();
- }
-
virtual ~Widget2()
{
}
@@ -91,6 +78,19 @@ class Widget2
}
protected:
+ Widget2() :
+ mPaletteOffset(0),
+ mForegroundColor2()
+ {
+ }
+
+ explicit Widget2(const Widget2 *const widget) :
+ mPaletteOffset(widget ? widget->mPaletteOffset : 0),
+ mForegroundColor2()
+ {
+ checkPalette();
+ }
+
int mPaletteOffset;
gcn::Color mForegroundColor2;
};
diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h
index 55507f316..308c8fb8a 100644
--- a/src/gui/widgets/widgetgroup.h
+++ b/src/gui/widgets/widgetgroup.h
@@ -33,10 +33,6 @@ class WidgetGroup : public Container,
public gcn::ActionListener
{
public:
- WidgetGroup(const Widget2 *const widget,
- const std::string &group, const int height,
- const int spacing);
-
A_DELETE_COPY(WidgetGroup)
virtual void addButton(const std::string &tag);
@@ -57,6 +53,10 @@ class WidgetGroup : public Container,
const A_WARN_UNUSED = 0;
protected:
+ WidgetGroup(const Widget2 *const widget,
+ const std::string &group, const int height,
+ const int spacing);
+
int mSpacing;
int mCount;
std::string mGroup;