summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-03-01 01:41:07 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-03-01 01:41:07 +0000
commitb047811ba2e0fd8ced277f9b3f7bc35d6c274e09 (patch)
tree53cb7399b3379a3e9f2f3b1c12d1e7f8a2c4967b
parent7c4f4f9bedf3f1cf0566f4cad2f4eedd59075a57 (diff)
downloadmana-b047811ba2e0fd8ced277f9b3f7bc35d6c274e09.tar.gz
mana-b047811ba2e0fd8ced277f9b3f7bc35d6c274e09.tar.bz2
mana-b047811ba2e0fd8ced277f9b3f7bc35d6c274e09.tar.xz
mana-b047811ba2e0fd8ced277f9b3f7bc35d6c274e09.zip
Replaced the basic guichan text field class with our derivate class.
-rw-r--r--ChangeLog5
-rw-r--r--src/gui/textdialog.cpp14
-rw-r--r--src/gui/textdialog.h14
3 files changed, 20 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f9f2733..3fec3f4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-01 Philipp Sehmisch <tmw@crushnet.org>
+
+ * src/gui/textdialog.cpp, src/gui/textdialog.h: Replaced the basic
+ guichan text field class with our derivate class.
+
2008-02-27 Philipp Sehmisch <tmw@crushnet.org>
* src/net/beinghandler.cpp, src/net/gamehandler/player.cpp,
diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp
index 202838f0..3986ed4e 100644
--- a/src/gui/textdialog.cpp
+++ b/src/gui/textdialog.cpp
@@ -31,20 +31,20 @@
TextDialog::TextDialog(const std::string &title, const std::string &msg,
Window *parent):
Window(title, true, parent),
- textField(new gcn::TextField(""))
+ textField(new TextField(""))
{
gcn::Label *textLabel = new gcn::Label(msg);
okButton = new Button("OK", "OK", this);
gcn::Button *cancelButton = new Button("Cancel", "CANCEL", this);
-
+
int w = textLabel->getWidth() + 20;
int inWidth = okButton->getWidth() + cancelButton->getWidth() + 5;
int h = textLabel->getHeight() + 25 + okButton->getHeight() + textField->getHeight();
-
+
if (w < inWidth + 10) {
w = inWidth + 10;
}
-
+
setContentSize(w, h);
textLabel->setPosition(10, 10);
textField->setWidth(85);
@@ -53,12 +53,12 @@ TextDialog::TextDialog(const std::string &title, const std::string &msg,
h - 5 - cancelButton->getHeight());
cancelButton->setPosition(okButton->getX() + okButton->getWidth() + 5,
h - 5 - cancelButton->getHeight());
-
+
add(textLabel);
add(textField);
add(okButton);
add(cancelButton);
-
+
if (getParent()) {
setLocationRelativeTo(getParent());
getParent()->moveToTop(this);
@@ -75,7 +75,7 @@ void TextDialog::action(const gcn::ActionEvent &event)
{
(*i)->action(event);
}
-
+
if(event.getId() == "CANCEL" || event.getId() == "OK")
{
scheduleDelete();
diff --git a/src/gui/textdialog.h b/src/gui/textdialog.h
index f8ec0172..e14ab26b 100644
--- a/src/gui/textdialog.h
+++ b/src/gui/textdialog.h
@@ -24,7 +24,9 @@
#ifndef _TMW_GUI_GUILD_DIALOG_H
#define _TMW_GUI_GUILD_DIALOG_H
-#include <guichan/actionlistener.hpp>
+#include <guichan/actionlistener.hpp>
+
+#include "textfield.h"
#include "window.h"
@@ -43,24 +45,24 @@ public:
*/
TextDialog(const std::string &title, const std::string &msg,
Window *parent = NULL);
-
+
/**
* Called when receiving actions from the widgets.
*/
void action(const gcn::ActionEvent &event);
-
+
/**
* Get the text in the textfield
*/
const std::string& getText() const;
-
+
/**
* Set the OK button action id
*/
void setOKButtonActionId(const std::string &name);
-
+
private:
- gcn::TextField *textField;
+ TextField *textField;
gcn::Button *okButton;
};