summaryrefslogtreecommitdiff
path: root/src/gui/setup.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-19 11:52:27 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-19 11:52:27 +0000
commit19d5cc3a6bbbd911361b7e8b956840d0189d4c2b (patch)
tree5eb8b94f7832bdbb6d21c7ded6e6da6b5f8f3464 /src/gui/setup.cpp
parent59399a274c694e9dc467149828b57f47794eeaeb (diff)
downloadmana-client-19d5cc3a6bbbd911361b7e8b956840d0189d4c2b.tar.gz
mana-client-19d5cc3a6bbbd911361b7e8b956840d0189d4c2b.tar.bz2
mana-client-19d5cc3a6bbbd911361b7e8b956840d0189d4c2b.tar.xz
mana-client-19d5cc3a6bbbd911361b7e8b956840d0189d4c2b.zip
Removed some duplicate initializations.
Diffstat (limited to 'src/gui/setup.cpp')
-rw-r--r--src/gui/setup.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 82b77284..91bd5ce7 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -42,24 +42,20 @@ extern Window *skillDialog;
Setup::Setup():
Window("Setup")
{
- Button *applyButton = new Button("Apply", "apply", this);
- Button *cancelButton = new Button("Cancel", "cancel", this);
- Button *resetWinsToDefault = new Button("Reset Windows", "winsToDefault", this);
-
- // Set dimensions/positions
int width = 230;
int height = 185;
setContentSize(width, height);
- cancelButton->setPosition(
- width - cancelButton->getWidth() - 5,
- height - cancelButton->getHeight() - 5);
- applyButton->setPosition(
- cancelButton->getX() - applyButton->getWidth() - 5,
- cancelButton->getY());
- resetWinsToDefault->setPosition(
- applyButton->getX() - resetWinsToDefault->getWidth() - 5,
- applyButton->getY());
+ const char *buttonNames[] = {
+ "Apply", "Cancel", "Reset Windows", 0
+ };
+ int x = width;
+ for (const char **curBtn = buttonNames; *curBtn; ++curBtn) {
+ Button *btn = new Button(*curBtn, *curBtn, this);
+ x -= btn->getWidth() + 5;
+ btn->setPosition(x, height - btn->getHeight() - 5);
+ add(btn);
+ }
TabbedContainer *panel = new TabbedContainer();
panel->setDimension(gcn::Rectangle(5, 5, 220, 130));
@@ -80,9 +76,6 @@ Setup::Setup():
mTabs.push_back(tab);
add(panel);
- add(resetWinsToDefault);
- add(applyButton);
- add(cancelButton);
setLocationRelativeTo(getParent());
}
@@ -94,17 +87,17 @@ Setup::~Setup()
void Setup::action(const std::string &event)
{
- if (event == "apply")
+ if (event == "Apply")
{
setVisible(false);
for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::apply));
}
- else if (event == "cancel")
+ else if (event == "Cancel")
{
setVisible(false);
for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::cancel));
}
- else if (event == "winsToDefault")
+ else if (event == "Reset Windows")
{
statusWindow->resetToDefaultSize();
minimap->resetToDefaultSize();