diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-07-05 00:52:39 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-09-28 18:31:42 +0200 |
commit | 2e61e1f8c47173b7440565c09b23cadc902ad76d (patch) | |
tree | af58aed76701aaa8698f124a53af3c0b28b01f85 /src/gui/windowmenu.cpp | |
parent | b3858a91e0f6b2c4706ea7b4418a26d4ef14baa7 (diff) | |
download | mana-2e61e1f8c47173b7440565c09b23cadc902ad76d.tar.gz mana-2e61e1f8c47173b7440565c09b23cadc902ad76d.tar.bz2 mana-2e61e1f8c47173b7440565c09b23cadc902ad76d.tar.xz mana-2e61e1f8c47173b7440565c09b23cadc902ad76d.zip |
Changed the Social button to an image one.
I also made the client able to keep the old behaviour,
and i changed the button api to not require the icon frames size
as it could easily guess them.
Diffstat (limited to 'src/gui/windowmenu.cpp')
-rw-r--r-- | src/gui/windowmenu.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 7011c82a..5f7aefa7 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -61,7 +61,7 @@ WindowMenu::WindowMenu(): // if (specialsWindow->hasSpecials()) addButton(N_("Specials"), x, h); - addButton(N_("Social"), x, h); + addButton(N_("Social"), x, h, "button-icon-social.png"); addButton(N_("Shortcut"), x, h); addButton(N_("Setup"), x, h); @@ -156,12 +156,22 @@ void WindowMenu::valueChanged(const gcn::SelectionEvent &event) } } -void WindowMenu::addButton(const char* text, int &x, int &h) +void WindowMenu::addButton(const std::string& text, int &x, int &h, + const std::string& iconPath) { - Button *btn = new Button(gettext(text), text, this); - btn->setButtonPopupText(gettext(text)); + Button *btn = new Button("", text, this); + if (!iconPath.empty()) + { + btn->setButtonPopupText(gettext(text.c_str())); + btn->setButtonIcon(iconPath); + } + else + { + btn->setCaption(gettext(text.c_str())); + } + btn->setPosition(x, 0); add(btn); x += btn->getWidth() + 3; - h = btn->getHeight(); + h = std::max(h, btn->getHeight()); } |