summaryrefslogtreecommitdiff
path: root/src/gui/windowmenu.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-08 18:47:17 -0700
committerJared Adams <jaxad0127@gmail.com>2010-03-08 19:13:31 -0700
commitd92524b7c8548bb6e2970a757e440ecf197c2b6d (patch)
treea0c6ee668729953f3243f43ad00026cb4f6b3092 /src/gui/windowmenu.cpp
parent30668a131bb2c93127385fbbbba34d47f7bf80e3 (diff)
downloadmana-client-d92524b7c8548bb6e2970a757e440ecf197c2b6d.tar.gz
mana-client-d92524b7c8548bb6e2970a757e440ecf197c2b6d.tar.bz2
mana-client-d92524b7c8548bb6e2970a757e440ecf197c2b6d.tar.xz
mana-client-d92524b7c8548bb6e2970a757e440ecf197c2b6d.zip
Only show skill and special buttons in WindowMenu when needed
Reviewed-by: Chuck Miller
Diffstat (limited to 'src/gui/windowmenu.cpp')
-rw-r--r--src/gui/windowmenu.cpp49
1 files changed, 25 insertions, 24 deletions
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();
+}