summaryrefslogtreecommitdiff
path: root/src/gui/button.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/button.cpp')
-rw-r--r--src/gui/button.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index 4e236c33..0379ebc0 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -60,11 +60,26 @@ static ButtonData const data[BUTTON_COUNT] = {
ImageRect Button::button[BUTTON_COUNT];
+Button::Button():
+ mIsLogged(false)
+{
+ init();
+}
+
Button::Button(const std::string& caption, const std::string &actionEventId,
gcn::ActionListener *listener):
gcn::Button(caption),
mIsLogged(false)
{
+ init();
+ setActionEventId(actionEventId);
+ if (listener) {
+ addActionListener(listener);
+ }
+}
+
+void Button::init()
+{
setBorderSize(0);
if (mInstances == 0)
@@ -91,12 +106,7 @@ Button::Button(const std::string& caption, const std::string &actionEventId,
btn[mode]->decRef();
}
}
-
mInstances++;
- setActionEventId(actionEventId);
- if (listener) {
- addActionListener(listener);
- }
}
Button::~Button()