summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/skilldialog.h2
-rw-r--r--src/gui/specialswindow.h2
-rw-r--r--src/gui/windowmenu.cpp49
-rw-r--r--src/gui/windowmenu.h2
4 files changed, 31 insertions, 24 deletions
diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h
index 6423d56b..95f8ef25 100644
--- a/src/gui/skilldialog.h
+++ b/src/gui/skilldialog.h
@@ -69,6 +69,8 @@ class SkillDialog : public Window, public gcn::ActionListener
void setModifiable(int id, bool modifiable);
+ bool hasSkills() { return !mSkills.empty(); }
+
private:
typedef std::map<int, SkillInfo*> SkillMap;
SkillMap mSkills;
diff --git a/src/gui/specialswindow.h b/src/gui/specialswindow.h
index 86d89462..81384856 100644
--- a/src/gui/specialswindow.h
+++ b/src/gui/specialswindow.h
@@ -56,6 +56,8 @@ class SpecialsWindow : public Window, public gcn::ActionListener {
void loadSpecials(const std::string &file);
+ bool hasSpecials() { return !mSpecials.empty(); }
+
private:
std::vector<gcn::Button *> mSpellButtons;
typedef std::map<int, SpecialInfo*> SpecialMap;
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 81e96fb2..5af5a202 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -24,6 +24,8 @@
#include "graphics.h"
#include "gui/emotepopup.h"
+#include "gui/skilldialog.h"
+#include "gui/specialswindow.h"
#include "gui/widgets/button.h"
#include "gui/widgets/window.h"
@@ -40,38 +42,28 @@ extern Window *equipmentWindow;
extern Window *inventoryWindow;
extern Window *itemShortcutWindow;
extern Window *setupWindow;
-extern Window *skillDialog;
-extern Window *specialsWindow;
extern Window *statusWindow;
extern Window *socialWindow;
WindowMenu::WindowMenu():
mEmotePopup(0)
{
- // Buttons
- static const char *buttonNames[] =
- {
- ":-)",
- N_("Status"),
- N_("Equipment"),
- N_("Inventory"),
- N_("Skills"),
- N_("Specials"),
- N_("Social"),
- N_("Shortcut"),
- N_("Setup"),
- 0
- };
int x = 0, h = 0;
- for (const char **curBtn = buttonNames; *curBtn; curBtn++)
- {
- gcn::Button *btn = new Button(gettext(*curBtn), *curBtn, this);
- btn->setPosition(x, 0);
- add(btn);
- x += btn->getWidth() + 3;
- h = btn->getHeight();
- }
+ addButton(":-)", x, h);
+ addButton(N_("Status"), x, h);
+ addButton(N_("Equipment"), x, h);
+ addButton(N_("Inventory"), x, h);
+
+ if (skillDialog->hasSkills())
+ addButton(N_("Skills"), x, h);
+
+ if (specialsWindow->hasSpecials())
+ addButton(N_("Specials"), x, h);
+
+ addButton(N_("Social"), x, h);
+ addButton(N_("Shortcut"), x, h);
+ addButton(N_("Setup"), x, h);
setDimension(gcn::Rectangle(graphics->getWidth() - x - 3, 3,
x - 3, h));
@@ -162,3 +154,12 @@ void WindowMenu::valueChanged(const gcn::SelectionEvent &event)
mEmotePopup = 0;
}
}
+
+void WindowMenu::addButton(const char* text, int &x, int &h)
+{
+ gcn::Button *btn = new Button(gettext(text), text, this);
+ btn->setPosition(x, 0);
+ add(btn);
+ x += btn->getWidth() + 3;
+ h = btn->getHeight();
+}
diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h
index d20d1f8d..2bb3e764 100644
--- a/src/gui/windowmenu.h
+++ b/src/gui/windowmenu.h
@@ -48,6 +48,8 @@ class WindowMenu : public Container,
void valueChanged(const gcn::SelectionEvent &event);
private:
+ inline void addButton(const char* text, int &x, int &h);
+
EmotePopup *mEmotePopup;
};