summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-17 21:33:53 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-19 15:12:17 +0300
commit71d7483a1d35a7068c456dfe6d3c0e54f1ae71a3 (patch)
tree50ade3b1480b5ea9f45106ce37e218b8700a30e5
parent03aa86f565161e731342aa02348dd56d6c5591b0 (diff)
downloadmanaverse-71d7483a1d35a7068c456dfe6d3c0e54f1ae71a3.tar.gz
manaverse-71d7483a1d35a7068c456dfe6d3c0e54f1ae71a3.tar.bz2
manaverse-71d7483a1d35a7068c456dfe6d3c0e54f1ae71a3.tar.xz
manaverse-71d7483a1d35a7068c456dfe6d3c0e54f1ae71a3.zip
add postinit function into window.
use postinit for call virtual functions in charselectdialog.
-rw-r--r--src/client.cpp1
-rw-r--r--src/gui/widgets/window.h4
-rw-r--r--src/gui/windows/charselectdialog.cpp8
-rw-r--r--src/gui/windows/charselectdialog.h2
4 files changed, 13 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 290299f58..824d07e5a 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1450,6 +1450,7 @@ int Client::gameExec()
Theme::instance()->setMinimumOpacity(0.8F);
mCurrentDialog = new CharSelectDialog(&loginData);
+ mCurrentDialog->postInit();
if (!(static_cast<CharSelectDialog*>(mCurrentDialog))
->selectByName(mOptions.character,
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 79d7053b0..ebc44e584 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -236,6 +236,10 @@ class Window : public gcn::Window,
void setSaveVisible(const bool save)
{ mSaveVisible = save; }
+ virtual void postInit()
+ {
+ }
+
/**
* Returns the parent window.
*
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 1c960b11c..d99b973b3 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -188,8 +188,6 @@ CharSelectDialog::CharSelectDialog(LoginData *const data):
}
addKeyListener(this);
center();
- setVisible(true);
- requestFocus();
Net::getCharServerHandler()->setCharSelectDialog(this);
mCharacterView->show(0);
@@ -201,6 +199,12 @@ CharSelectDialog::~CharSelectDialog()
Net::getCharServerHandler()->clear();
}
+void CharSelectDialog::postInit()
+{
+ setVisible(true);
+ requestFocus();
+}
+
void CharSelectDialog::action(const gcn::ActionEvent &event)
{
// Check if a button of a character was pressed
diff --git a/src/gui/windows/charselectdialog.h b/src/gui/windows/charselectdialog.h
index 705cb831c..1a4eeb4ac 100644
--- a/src/gui/windows/charselectdialog.h
+++ b/src/gui/windows/charselectdialog.h
@@ -90,6 +90,8 @@ class CharSelectDialog final : public Window,
void updateState();
+ void postInit();
+
private:
void attemptCharacterDelete(const int index);