summaryrefslogtreecommitdiff
path: root/src/gui/char_select.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-09 02:02:57 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-09 02:02:57 +0000
commit81cf85e9ec1d37dc6e8dd9883f42bb50dace9135 (patch)
tree585415bbb85c48fc8fb83cd5f54e1cfe8e988ee7 /src/gui/char_select.cpp
parent78ab0ec914d3c5a97f162905afb3dede53f8b9ed (diff)
downloadmana-81cf85e9ec1d37dc6e8dd9883f42bb50dace9135.tar.gz
mana-81cf85e9ec1d37dc6e8dd9883f42bb50dace9135.tar.bz2
mana-81cf85e9ec1d37dc6e8dd9883f42bb50dace9135.tar.xz
mana-81cf85e9ec1d37dc6e8dd9883f42bb50dace9135.zip
Made the Button ctor accept eventId and action listener.
Diffstat (limited to 'src/gui/char_select.cpp')
-rw-r--r--src/gui/char_select.cpp52
1 files changed, 13 insertions, 39 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 7ce2a77d..72f0b554 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -71,25 +71,19 @@ void CharDeleteConfirm::action(const std::string &eventId)
CharSelectDialog::CharSelectDialog(Network *network, LockedArray<LocalPlayer*> *charInfo):
Window("Select Character"), mNetwork(network), mCharInfo(charInfo), mCharSelected(false)
{
- selectButton = new Button("Ok");
- cancelButton = new Button("Cancel");
- newCharButton = new Button("New");
- delCharButton = new Button("Delete");
- previousButton = new Button("Previous");
- nextButton = new Button("Next");
+ selectButton = new Button("Ok", "ok", this);
+ cancelButton = new Button("Cancel", "cancel", this);
+ newCharButton = new Button("New", "new", this);
+ delCharButton = new Button("Delete", "delete", this);
+ previousButton = new Button("Previous", "previous", this);
+ nextButton = new Button("Next", "next", this);
+
nameLabel = new gcn::Label("Name");
levelLabel = new gcn::Label("Level");
jobLevelLabel = new gcn::Label("Job Level");
moneyLabel = new gcn::Label("Money");
playerBox = new PlayerBox();
- selectButton->setEventId("ok");
- newCharButton->setEventId("new");
- cancelButton->setEventId("cancel");
- delCharButton->setEventId("delete");
- previousButton->setEventId("previous");
- nextButton->setEventId("next");
-
int w = 195;
int h = 220;
setContentSize(w, h);
@@ -123,14 +117,6 @@ CharSelectDialog::CharSelectDialog(Network *network, LockedArray<LocalPlayer*> *
add(jobLevelLabel);
add(moneyLabel);
- // Set up event listener
- selectButton->addActionListener(this);
- cancelButton->addActionListener(this);
- newCharButton->addActionListener(this);
- delCharButton->addActionListener(this);
- previousButton->addActionListener(this);
- nextButton->addActionListener(this);
-
selectButton->requestFocus();
setLocationRelativeTo(getParent());
updatePlayerInfo();
@@ -250,24 +236,18 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network):
{
nameField = new TextField("");
nameLabel = new gcn::Label("Name:");
- nextHairColorButton = new Button(">");
- prevHairColorButton = new Button("<");
+ nextHairColorButton = new Button(">", "nextcolor", this);
+ prevHairColorButton = new Button("<", "prevcolor", this);
hairColorLabel = new gcn::Label("Hair Color:");
- nextHairStyleButton = new Button(">");
- prevHairStyleButton = new Button("<");
+ nextHairStyleButton = new Button(">", "nextstyle", this);
+ prevHairStyleButton = new Button("<", "prevstyle", this);
hairStyleLabel = new gcn::Label("Hair Style:");
- createButton = new Button("Create");
- cancelButton = new Button("Cancel");
+ createButton = new Button("Create", "create", this);
+ cancelButton = new Button("Cancel", "cancel", this);
playerBox = new PlayerBox();
playerBox->showPlayer = true;
nameField->setEventId("create");
- nextHairColorButton->setEventId("nextcolor");
- prevHairColorButton->setEventId("prevcolor");
- nextHairStyleButton->setEventId("nextstyle");
- prevHairStyleButton->setEventId("prevstyle");
- createButton->setEventId("create");
- cancelButton->setEventId("cancel");
int w = 200;
int h = 150;
@@ -290,12 +270,6 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network):
h - 5 - cancelButton->getHeight());
nameField->addActionListener(this);
- nextHairColorButton->addActionListener(this);
- prevHairColorButton->addActionListener(this);
- nextHairStyleButton->addActionListener(this);
- prevHairStyleButton->addActionListener(this);
- createButton->addActionListener(this);
- cancelButton->addActionListener(this);
add(playerBox);
add(nameField);