summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-05 21:48:30 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-05 21:48:30 +0300
commit6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed (patch)
tree79a54d4c838c85df29b1b95702b71a95c43ceb5a
parentd1bb1b375d657f0821ccfebf18fa1c3873314690 (diff)
downloadmanaverse-6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed.tar.gz
manaverse-6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed.tar.bz2
manaverse-6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed.tar.xz
manaverse-6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed.zip
Improve constructors in some classes.
-rw-r--r--src/actorsprite.cpp4
-rw-r--r--src/client.cpp3
-rw-r--r--src/configuration.cpp1
-rw-r--r--src/graphics.cpp1
-rw-r--r--src/gui/buydialog.cpp8
-rw-r--r--src/gui/buyselldialog.cpp6
-rw-r--r--src/gui/changepassworddialog.cpp13
-rw-r--r--src/gui/charcreatedialog.cpp55
-rw-r--r--src/gui/charcreatedialog.h3
-rw-r--r--src/gui/charselectdialog.cpp15
-rw-r--r--src/gui/charselectdialog.h4
-rw-r--r--src/guichan/cliprectangle.cpp2
-rw-r--r--src/guichan/include/guichan/widgets/dropdown.hpp28
-rw-r--r--src/guichan/sdl/sdlgraphics.cpp1
-rw-r--r--src/guichan/sdl/sdlimage.cpp1
-rw-r--r--src/guichan/widgets/button.cpp34
-rw-r--r--src/guichan/widgets/checkbox.cpp15
-rw-r--r--src/guichan/widgets/container.cpp1
-rw-r--r--src/guichan/widgets/dropdown.cpp33
-rw-r--r--src/guichan/widgets/icon.cpp3
-rw-r--r--src/guichan/widgets/label.cpp5
-rw-r--r--src/guichan/widgets/listbox.cpp10
-rw-r--r--src/guichan/widgets/radiobutton.cpp6
-rw-r--r--src/guichan/widgets/scrollarea.cpp6
-rw-r--r--src/guichan/widgets/slider.cpp6
-rw-r--r--src/guichan/widgets/tab.cpp2
-rw-r--r--src/guichan/widgets/tabbedarea.cpp8
-rw-r--r--src/guichan/widgets/textbox.cpp6
-rw-r--r--src/guichan/widgets/textfield.cpp6
-rw-r--r--src/guichan/widgets/window.cpp30
30 files changed, 200 insertions, 116 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 93bb21b85..94c4ef966 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -48,7 +48,9 @@ ImageSet *ActorSprite::targetCursorImages[2][NUM_TC];
SimpleAnimation *ActorSprite::targetCursor[2][NUM_TC];
bool ActorSprite::loaded = false;
-ActorSprite::ActorSprite(const int id):
+ActorSprite::ActorSprite(const int id) :
+ Actor(),
+ CompoundSprite(),
mId(id),
mStunMode(0),
mStatusParticleEffects(&mStunParticleEffects, false),
diff --git a/src/client.cpp b/src/client.cpp
index 7afe24cb2..5ef48b5d4 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -250,7 +250,8 @@ class LoginListener : public gcn::ActionListener
Client *Client::mInstance = nullptr;
-Client::Client(const Options &options):
+Client::Client(const Options &options) :
+ ActionListener(),
mOptions(options),
mServerConfigDir(""),
mUsersDir(""),
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 208437b57..9055642a3 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -316,6 +316,7 @@ ConfigurationObject::~ConfigurationObject()
}
Configuration::Configuration() :
+ ConfigurationObject(),
mConfigPath(""),
mDefaultsData(nullptr),
mDirectory("")
diff --git a/src/graphics.cpp b/src/graphics.cpp
index dc1cc2b15..384bc2341 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -59,6 +59,7 @@ static unsigned int *cG = nullptr;
static unsigned int *cB = nullptr;
Graphics::Graphics() :
+ SDLGraphics(),
mWidth(0),
mHeight(0),
mBpp(0),
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index ffbe042e5..9eba7796b 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -50,15 +50,19 @@
BuyDialog::DialogList BuyDialog::instances;
-BuyDialog::BuyDialog(const int npcId):
+BuyDialog::BuyDialog(const int npcId) :
Window(_("Buy"), false, nullptr, "buy.xml"),
+ ActionListener(),
+ SelectionListener(),
mNpcId(npcId), mMoney(0), mAmountItems(0), mMaxItems(0), mNick("")
{
init();
}
-BuyDialog::BuyDialog(std::string nick):
+BuyDialog::BuyDialog(std::string nick) :
Window(_("Buy"), false, nullptr, "buy.xml"),
+ ActionListener(),
+ SelectionListener(),
mNpcId(-1), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(nick)
{
init();
diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp
index 7fff70fc0..31a1aa315 100644
--- a/src/gui/buyselldialog.cpp
+++ b/src/gui/buyselldialog.cpp
@@ -34,8 +34,9 @@
BuySellDialog::DialogList BuySellDialog::instances;
-BuySellDialog::BuySellDialog(const int npcId):
+BuySellDialog::BuySellDialog(const int npcId) :
Window(_("Shop"), false, nullptr, "buysell.xml"),
+ ActionListener(),
mNpcId(npcId),
mNick(""),
mBuyButton(nullptr)
@@ -43,8 +44,9 @@ BuySellDialog::BuySellDialog(const int npcId):
init();
}
-BuySellDialog::BuySellDialog(std::string nick):
+BuySellDialog::BuySellDialog(std::string nick) :
Window(_("Shop"), false, nullptr, "buysell.xml"),
+ ActionListener(),
mNpcId(-1),
mNick(nick),
mBuyButton(nullptr)
diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp
index 0d38bab4e..be5bdb7c4 100644
--- a/src/gui/changepassworddialog.cpp
+++ b/src/gui/changepassworddialog.cpp
@@ -46,17 +46,18 @@
ChangePasswordDialog::ChangePasswordDialog(LoginData *const data):
Window(_("Change Password"), true, nullptr, "changepassword.xml"),
+ ActionListener(),
+ mOldPassField(new PasswordField),
+ mFirstPassField(new PasswordField),
+ mSecondPassField(new PasswordField),
+ mChangePassButton(new Button(_("Change Password"),
+ "change_password", this)),
+ mCancelButton(new Button(_("Cancel"), "cancel", this)),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(data)
{
gcn::Label *const accountLabel = new Label(
strprintf(_("Account: %s"), mLoginData->username.c_str()));
- mOldPassField = new PasswordField;
- mFirstPassField = new PasswordField;
- mSecondPassField = new PasswordField;
- mChangePassButton = new Button(_("Change Password"), "change_password",
- this);
- mCancelButton = new Button(_("Cancel"), "cancel", this);
place(0, 0, accountLabel, 3);
place(0, 1, new Label(_("Password:")), 3);
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index 4c553f5e1..37839c7ee 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -67,8 +67,37 @@ static const uint8_t directions[] =
CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
const int slot) :
Window(_("New Character"), true, parent, "charcreate.xml"),
+ ActionListener(),
+ KeyListener(),
mCharSelectDialog(parent),
+ mNameField(new TextField("")),
+ mNameLabel(new Label(_("Name:"))),
+ // TRANSLATORS: This is a narrow symbol used to denote 'next'.
+ // You may change this symbol if your language uses another.
+ mNextHairColorButton(new Button(_(">"), "nextcolor", this)),
+ // TRANSLATORS: This is a narrow symbol used to denote 'previous'.
+ // You may change this symbol if your language uses another.
+ mPrevHairColorButton(new Button(_("<"), "prevcolor", this)),
+ mHairColorLabel(new Label(_("Hair color:"))),
+ mHairColorNameLabel(new Label("")),
+ mNextHairStyleButton(new Button(_(">"), "nextstyle", this)),
+ mPrevHairStyleButton(new Button(_("<"), "prevstyle", this)),
+ mHairStyleLabel(new Label(_("Hair style:"))),
+ mHairStyleNameLabel(new Label("")),
+ mActionButton(new Button(_("^"), "action", this)),
+ mRotateButton(new Button(_(">"), "rotate", this)),
+ mMale(new RadioButton(_("Male"), "gender")),
+ mFemale(new RadioButton(_("Female"), "gender")),
+ mOther(new RadioButton(_("Other"), "gender")),
+ mAttributesLeft(new Label(
+ strprintf(_("Please distribute %d points"), 99))),
+ mMaxPoints(0),
+ mUsedPoints(0),
+ mCreateButton(new Button(_("Create"), "create", this)),
+ mCancelButton(new Button(_("Cancel"), "cancel", this)),
mRace(0),
+ mPlayer(new Being(0, ActorSprite::PLAYER, mRace, nullptr)),
+ mPlayerBox(new PlayerBox(mPlayer, "charcreate_playerbox.xml")),
mSlot(slot),
mAction(0),
mDirection(0)
@@ -77,7 +106,6 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
setSticky(true);
setWindowName("NewCharacter");
- mPlayer = new Being(0, ActorSprite::PLAYER, mRace, nullptr);
mPlayer->setGender(GENDER_MALE);
const std::vector<int> &items = CharDB::getDefaultItems();
int i = 1;
@@ -101,23 +129,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mHairStyle = (rand() % maxHairStyle) + minHairStyle;
mHairColor = (rand() % maxHairColor) + minHairColor;
- mNameField = new TextField("");
mNameField->setMaximum(24);
- mNameLabel = new Label(_("Name:"));
- // TRANSLATORS: This is a narrow symbol used to denote 'next'.
- // You may change this symbol if your language uses another.
- mNextHairColorButton = new Button(_(">"), "nextcolor", this);
- // TRANSLATORS: This is a narrow symbol used to denote 'previous'.
- // You may change this symbol if your language uses another.
- mPrevHairColorButton = new Button(_("<"), "prevcolor", this);
- mHairColorLabel = new Label(_("Hair color:"));
- mHairColorNameLabel = new Label("");
- mNextHairStyleButton = new Button(_(">"), "nextstyle", this);
- mPrevHairStyleButton = new Button(_("<"), "prevstyle", this);
- mHairStyleLabel = new Label(_("Hair style:"));
- mHairStyleNameLabel = new Label("");
- mActionButton = new Button(_("^"), "action", this);
- mRotateButton = new Button(_(">"), "rotate", this);
if (serverVersion >= 2)
{
@@ -127,12 +139,6 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mRaceNameLabel = new Label("");
}
- mCreateButton = new Button(_("Create"), "create", this);
- mCancelButton = new Button(_("Cancel"), "cancel", this);
- mMale = new RadioButton(_("Male"), "gender");
- mFemale = new RadioButton(_("Female"), "gender");
- mOther = new RadioButton(_("Other"), "gender");
-
// Default to a Male character
mMale->setSelected(true);
@@ -144,14 +150,11 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mFemale->addActionListener(this);
mOther->addActionListener(this);
- mPlayerBox = new PlayerBox(mPlayer, "charcreate_playerbox.xml");
mPlayerBox->setWidth(74);
mNameField->setActionEventId("create");
mNameField->addActionListener(this);
- mAttributesLeft = new Label(
- strprintf(_("Please distribute %d points"), 99));
const int w = 480;
const int h = 350;
diff --git a/src/gui/charcreatedialog.h b/src/gui/charcreatedialog.h
index 048363452..83521e301 100644
--- a/src/gui/charcreatedialog.h
+++ b/src/gui/charcreatedialog.h
@@ -135,12 +135,13 @@ class CharCreateDialog : public Window,
gcn::Button *mCreateButton;
gcn::Button *mCancelButton;
+ int mRace;
+
Being *mPlayer;
PlayerBox *mPlayerBox;
int mHairStyle;
int mHairColor;
- int mRace;
int mSlot;
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 829d45d14..6a4de9432 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -132,23 +132,24 @@ class CharacterDisplay : public Container
CharSelectDialog::CharSelectDialog(LoginData *const data):
Window(_("Account and Character Management"), false, nullptr, "char.xml"),
+ ActionListener(),
+ KeyListener(),
mLocked(false),
+ mLoginData(data),
+ mAccountNameLabel(new Label(mLoginData->username)),
+ mLastLoginLabel(new Label(mLoginData->lastLogin)),
+ mSwitchLoginButton(new Button(_("Switch Login"), "switch", this)),
+ mChangePasswordButton(new Button(_("Change Password"),
+ "change_password", this)),
mUnregisterButton(nullptr),
mChangeEmailButton(nullptr),
mCharacterEntries(0),
- mLoginData(data),
mCharHandler(Net::getCharHandler()),
mDeleteDialog(nullptr),
mDeleteIndex(-1)
{
setCloseButton(false);
- mAccountNameLabel = new Label(mLoginData->username);
- mLastLoginLabel = new Label(mLoginData->lastLogin);
- mSwitchLoginButton = new Button(_("Switch Login"), "switch", this);
- mChangePasswordButton = new Button(_("Change Password"), "change_password",
- this);
-
const int optionalActions = Net::getLoginHandler()
->supportedOptionalActions();
diff --git a/src/gui/charselectdialog.h b/src/gui/charselectdialog.h
index 0522566f1..398909f8a 100644
--- a/src/gui/charselectdialog.h
+++ b/src/gui/charselectdialog.h
@@ -110,6 +110,8 @@ class CharSelectDialog : public Window,
bool mLocked;
+ LoginData *mLoginData;
+
gcn::Label *mAccountNameLabel;
gcn::Label *mLastLoginLabel;
@@ -121,8 +123,6 @@ class CharSelectDialog : public Window,
/** The player boxes */
std::vector<CharacterDisplay*> mCharacterEntries;
- LoginData *mLoginData;
-
Net::CharHandler *mCharHandler;
TextDialog *mDeleteDialog;
int mDeleteIndex;
diff --git a/src/guichan/cliprectangle.cpp b/src/guichan/cliprectangle.cpp
index 285cbbe81..6e25b668b 100644
--- a/src/guichan/cliprectangle.cpp
+++ b/src/guichan/cliprectangle.cpp
@@ -53,6 +53,7 @@
namespace gcn
{
ClipRectangle::ClipRectangle() :
+ Rectangle(),
xOffset(0),
yOffset(0)
{
@@ -65,6 +66,7 @@ namespace gcn
ClipRectangle::ClipRectangle(const int x0, const int y0,
const int width0, const int height0,
const int xOffset0, const int yOffset0) :
+ Rectangle(),
xOffset(xOffset0),
yOffset(yOffset0)
{
diff --git a/src/guichan/include/guichan/widgets/dropdown.hpp b/src/guichan/include/guichan/widgets/dropdown.hpp
index 6c6ffb4c5..62a129082 100644
--- a/src/guichan/include/guichan/widgets/dropdown.hpp
+++ b/src/guichan/include/guichan/widgets/dropdown.hpp
@@ -266,11 +266,25 @@ namespace gcn
int mFoldedUpHeight;
/**
+ * True if an internal scroll area is used, false if a scroll area
+ * has been passed to the drop down which the drop down should not
+ * deleted in it's destructor.
+ */
+ bool mInternalScrollArea;
+
+ /**
* The scroll area used.
*/
ScrollArea* mScrollArea;
/**
+ * True if an internal list box is used, false if a list box
+ * has been passed to the drop down which the drop down should not
+ * deleted in it's destructor.
+ */
+ bool mInternalListBox;
+
+ /**
* The list box used.
*/
ListBox* mListBox;
@@ -282,20 +296,6 @@ namespace gcn
FocusHandler mInternalFocusHandler;
/**
- * True if an internal scroll area is used, false if a scroll area
- * has been passed to the drop down which the drop down should not
- * deleted in it's destructor.
- */
- bool mInternalScrollArea;
-
- /**
- * True if an internal list box is used, false if a list box
- * has been passed to the drop down which the drop down should not
- * deleted in it's destructor.
- */
- bool mInternalListBox;
-
- /**
* True if the drop down is dragged.
*/
bool mIsDragged;
diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp
index e6da83535..2e188991b 100644
--- a/src/guichan/sdl/sdlgraphics.cpp
+++ b/src/guichan/sdl/sdlgraphics.cpp
@@ -66,6 +66,7 @@ namespace gcn
{
SDLGraphics::SDLGraphics() :
+ Graphics(),
mTarget(nullptr),
mAlpha(false)
{
diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp
index 3c0325280..30d8f744d 100644
--- a/src/guichan/sdl/sdlimage.cpp
+++ b/src/guichan/sdl/sdlimage.cpp
@@ -56,6 +56,7 @@
namespace gcn
{
SDLImage::SDLImage(SDL_Surface *const surface, const bool autoFree) :
+ Image(),
mSurface(surface),
mAutoFree(autoFree)
{
diff --git a/src/guichan/widgets/button.cpp b/src/guichan/widgets/button.cpp
index f30c890b4..69affd4b7 100644
--- a/src/guichan/widgets/button.cpp
+++ b/src/guichan/widgets/button.cpp
@@ -59,12 +59,16 @@
namespace gcn
{
- Button::Button()
- : mHasMouse(false),
- mKeyPressed(false),
- mMousePressed(false),
- mAlignment(Graphics::CENTER),
- mSpacing(4)
+ Button::Button() :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
+ FocusListener(),
+ mHasMouse(false),
+ mKeyPressed(false),
+ mMousePressed(false),
+ mAlignment(Graphics::CENTER),
+ mSpacing(4)
{
setFocusable(true);
adjustSize();
@@ -75,13 +79,17 @@ namespace gcn
addFocusListener(this);
}
- Button::Button(const std::string& caption)
- : mCaption(caption),
- mHasMouse(false),
- mKeyPressed(false),
- mMousePressed(false),
- mAlignment(Graphics::CENTER),
- mSpacing(4)
+ Button::Button(const std::string& caption) :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
+ FocusListener(),
+ mCaption(caption),
+ mHasMouse(false),
+ mKeyPressed(false),
+ mMousePressed(false),
+ mAlignment(Graphics::CENTER),
+ mSpacing(4)
{
setFocusable(true);
adjustSize();
diff --git a/src/guichan/widgets/checkbox.cpp b/src/guichan/widgets/checkbox.cpp
index fe0bfbee4..58710409b 100644
--- a/src/guichan/widgets/checkbox.cpp
+++ b/src/guichan/widgets/checkbox.cpp
@@ -58,19 +58,24 @@
namespace gcn
{
- CheckBox::CheckBox()
+ CheckBox::CheckBox() :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
+ mSelected(false)
{
- setSelected(false);
-
setFocusable(true);
addMouseListener(this);
addKeyListener(this);
}
- CheckBox::CheckBox(const std::string &caption, bool selected)
+ CheckBox::CheckBox(const std::string &caption, bool selected) :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
+ mSelected(selected)
{
setCaption(caption);
- setSelected(selected);
setFocusable(true);
addMouseListener(this);
diff --git a/src/guichan/widgets/container.cpp b/src/guichan/widgets/container.cpp
index d6951f06a..ec61338c8 100644
--- a/src/guichan/widgets/container.cpp
+++ b/src/guichan/widgets/container.cpp
@@ -57,6 +57,7 @@ namespace gcn
{
Container::Container() :
+ BasicContainer(),
mOpaque(true)
{
}
diff --git a/src/guichan/widgets/dropdown.cpp b/src/guichan/widgets/dropdown.cpp
index c446b869d..39248ab73 100644
--- a/src/guichan/widgets/dropdown.cpp
+++ b/src/guichan/widgets/dropdown.cpp
@@ -59,29 +59,26 @@ namespace gcn
{
DropDown::DropDown(ListModel *const listModel,
ScrollArea *const scrollArea,
- ListBox *const listBox)
+ ListBox *const listBox) :
+ ActionListener(),
+ BasicContainer(),
+ KeyListener(),
+ MouseListener(),
+ FocusListener(),
+ SelectionListener(),
+ mDroppedDown(false),
+ mPushed(false),
+ mFoldedUpHeight(0),
+ mInternalScrollArea(!scrollArea),
+ mScrollArea(mInternalScrollArea ? new ScrollArea : scrollArea),
+ mInternalListBox(!listBox),
+ mListBox(mInternalListBox ? new ListBox() : listBox),
+ mIsDragged(false)
{
setWidth(100);
setFocusable(true);
- mDroppedDown = false;
- mPushed = false;
- mIsDragged = false;
setInternalFocusHandler(&mInternalFocusHandler);
-
- mInternalScrollArea = (!scrollArea);
- mInternalListBox = (!listBox);
-
- if (mInternalScrollArea)
- mScrollArea = new ScrollArea();
- else
- mScrollArea = scrollArea;
-
- if (mInternalListBox)
- mListBox = new ListBox();
- else
- mListBox = listBox;
-
mScrollArea->setContent(mListBox);
add(mScrollArea);
diff --git a/src/guichan/widgets/icon.cpp b/src/guichan/widgets/icon.cpp
index b0d277fbd..a030e2413 100644
--- a/src/guichan/widgets/icon.cpp
+++ b/src/guichan/widgets/icon.cpp
@@ -57,6 +57,7 @@
namespace gcn
{
Icon::Icon() :
+ Widget(),
mImage(nullptr),
mInternalImage(false)
{
@@ -64,6 +65,7 @@ namespace gcn
}
Icon::Icon(const std::string& filename) :
+ Widget(),
mImage(Image::load(filename)),
mInternalImage(true)
{
@@ -72,6 +74,7 @@ namespace gcn
}
Icon::Icon(const Image *const image) :
+ Widget(),
mImage(image),
mInternalImage(false)
{
diff --git a/src/guichan/widgets/label.cpp b/src/guichan/widgets/label.cpp
index 815bba741..aebbd0472 100644
--- a/src/guichan/widgets/label.cpp
+++ b/src/guichan/widgets/label.cpp
@@ -56,11 +56,14 @@
namespace gcn
{
- Label::Label() : mAlignment(Graphics::LEFT)
+ Label::Label() :
+ Widget(),
+ mAlignment(Graphics::LEFT)
{
}
Label::Label(const std::string& caption) :
+ Widget(),
mCaption(caption),
mAlignment(Graphics::LEFT)
{
diff --git a/src/guichan/widgets/listbox.cpp b/src/guichan/widgets/listbox.cpp
index 3f6565785..66ddf8315 100644
--- a/src/guichan/widgets/listbox.cpp
+++ b/src/guichan/widgets/listbox.cpp
@@ -61,6 +61,9 @@
namespace gcn
{
ListBox::ListBox() :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mSelected(-1),
mListModel(nullptr),
mWrappingEnabled(false)
@@ -73,13 +76,16 @@ namespace gcn
}
ListBox::ListBox(ListModel *listModel) :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mSelected(-1),
+ mListModel(listModel),
mWrappingEnabled(false)
{
setWidth(100);
- setListModel(listModel);
+ adjustSize();
setFocusable(true);
-
addMouseListener(this);
addKeyListener(this);
}
diff --git a/src/guichan/widgets/radiobutton.cpp b/src/guichan/widgets/radiobutton.cpp
index 7f8d846d9..9f19b00a7 100644
--- a/src/guichan/widgets/radiobutton.cpp
+++ b/src/guichan/widgets/radiobutton.cpp
@@ -60,6 +60,9 @@ namespace gcn
RadioButton::GroupMap RadioButton::mGroupMap;
RadioButton::RadioButton() :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mSelected(false),
mCaption(""),
mGroup("")
@@ -74,6 +77,9 @@ namespace gcn
RadioButton::RadioButton(const std::string &caption,
const std::string &group,
bool selected) :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mSelected(false),
mGroup("")
{
diff --git a/src/guichan/widgets/scrollarea.cpp b/src/guichan/widgets/scrollarea.cpp
index f8bd11334..6fa2db863 100644
--- a/src/guichan/widgets/scrollarea.cpp
+++ b/src/guichan/widgets/scrollarea.cpp
@@ -56,6 +56,8 @@
namespace gcn
{
ScrollArea::ScrollArea() :
+ BasicContainer(),
+ MouseListener(),
mVScroll(0),
mHScroll(0),
mScrollbarWidth(12),
@@ -81,6 +83,8 @@ namespace gcn
}
ScrollArea::ScrollArea(Widget *const content) :
+ BasicContainer(),
+ MouseListener(),
mVScroll(0),
mHScroll(0),
mScrollbarWidth(12),
@@ -109,6 +113,8 @@ namespace gcn
ScrollArea::ScrollArea(Widget *content,
ScrollPolicy hPolicy,
ScrollPolicy vPolicy) :
+ BasicContainer(),
+ MouseListener(),
mVScroll(0),
mHScroll(0),
mScrollbarWidth(12),
diff --git a/src/guichan/widgets/slider.cpp b/src/guichan/widgets/slider.cpp
index a9e9bed31..790560c7c 100644
--- a/src/guichan/widgets/slider.cpp
+++ b/src/guichan/widgets/slider.cpp
@@ -57,6 +57,9 @@
namespace gcn
{
Slider::Slider(const double scaleEnd) :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mDragged(false),
mScaleStart(0),
mScaleEnd(scaleEnd)
@@ -73,6 +76,9 @@ namespace gcn
}
Slider::Slider(const double scaleStart, const double scaleEnd) :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mDragged(false),
mScaleStart(scaleStart),
mScaleEnd(scaleEnd)
diff --git a/src/guichan/widgets/tab.cpp b/src/guichan/widgets/tab.cpp
index fa70f1e08..04d3dbb83 100644
--- a/src/guichan/widgets/tab.cpp
+++ b/src/guichan/widgets/tab.cpp
@@ -59,6 +59,8 @@
namespace gcn
{
Tab::Tab() :
+ BasicContainer(),
+ MouseListener(),
mLabel(new Label()),
mHasMouse(false),
mTabbedArea(nullptr)
diff --git a/src/guichan/widgets/tabbedarea.cpp b/src/guichan/widgets/tabbedarea.cpp
index 7bd77e7cd..35d401426 100644
--- a/src/guichan/widgets/tabbedarea.cpp
+++ b/src/guichan/widgets/tabbedarea.cpp
@@ -63,16 +63,20 @@
namespace gcn
{
TabbedArea::TabbedArea() :
+ ActionListener(),
+ BasicContainer(),
+ KeyListener(),
+ MouseListener(),
mSelectedTab(nullptr),
+ mTabContainer(new Container()),
+ mWidgetContainer(new Container()),
mOpaque(false)
{
setFocusable(true);
addKeyListener(this);
addMouseListener(this);
- mTabContainer = new Container();
mTabContainer->setOpaque(false);
- mWidgetContainer = new Container();
add(mTabContainer);
add(mWidgetContainer);
diff --git a/src/guichan/widgets/textbox.cpp b/src/guichan/widgets/textbox.cpp
index 0640b6a2c..ad5338069 100644
--- a/src/guichan/widgets/textbox.cpp
+++ b/src/guichan/widgets/textbox.cpp
@@ -59,6 +59,9 @@
namespace gcn
{
TextBox::TextBox() :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mCaretColumn(0),
mCaretRow(0),
mEditable(true),
@@ -73,6 +76,9 @@ namespace gcn
}
TextBox::TextBox(const std::string& text) :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mCaretColumn(0),
mCaretRow(0),
mEditable(true),
diff --git a/src/guichan/widgets/textfield.cpp b/src/guichan/widgets/textfield.cpp
index 2fffdc5f5..5434d341c 100644
--- a/src/guichan/widgets/textfield.cpp
+++ b/src/guichan/widgets/textfield.cpp
@@ -58,6 +58,9 @@
namespace gcn
{
TextField::TextField() :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mCaretPosition(0),
mXScroll(0)
{
@@ -68,6 +71,9 @@ namespace gcn
}
TextField::TextField(const std::string& text) :
+ Widget(),
+ MouseListener(),
+ KeyListener(),
mText(text),
mCaretPosition(0),
mXScroll(0)
diff --git a/src/guichan/widgets/window.cpp b/src/guichan/widgets/window.cpp
index 1a2279811..e82758e5f 100644
--- a/src/guichan/widgets/window.cpp
+++ b/src/guichan/widgets/window.cpp
@@ -58,28 +58,32 @@
namespace gcn
{
Window::Window() :
+ Container(),
+ MouseListener(),
+ mAlignment(Graphics::CENTER),
+ mPadding(2),
+ mTitleBarHeight(16),
+ mMovable(true),
+ mOpaque(true),
mMoved(false)
{
- setFrameSize(1);
- setPadding(2);
- setTitleBarHeight(16);
- setAlignment(Graphics::CENTER);
+ mFrameSize = 1;
addMouseListener(this);
- setMovable(true);
- setOpaque(true);
}
Window::Window(const std::string& caption) :
+ Container(),
+ MouseListener(),
+ mCaption(caption),
+ mAlignment(Graphics::CENTER),
+ mPadding(2),
+ mTitleBarHeight(16),
+ mMovable(true),
+ mOpaque(true),
mMoved(false)
{
- setCaption(caption);
- setFrameSize(1);
- setPadding(2);
- setTitleBarHeight(16);
- setAlignment(Graphics::CENTER);
+ mFrameSize = 1;
addMouseListener(this);
- setMovable(true);
- setOpaque(true);
}
Window::~Window()