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/widgets | |
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/widgets')
-rw-r--r-- | src/gui/widgets/button.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/button.h | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index b2fa9e89..6770c180 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -83,15 +83,14 @@ Button::Button(const std::string &caption, const std::string &actionEventId, adjustSize(); } -void Button::setButtonIcon(const std::string& iconFile, int frameHeight, - int frameWidth) +void Button::setButtonIcon(const std::string& iconFile) { // We clean up possible older references. if (mButtonIcon) removeButtonIcon(); // If nothing relevant was set, we can quit now. - if (iconFile.empty() || !frameWidth || !frameHeight) + if (iconFile.empty()) return; // Load the icon frames. @@ -99,6 +98,10 @@ void Button::setButtonIcon(const std::string& iconFile, int frameHeight, if (!btnIcons) return; + // Compute the sub images size. + int frameWidth = btnIcons->getWidth() / 4; + int frameHeight = btnIcons->getHeight(); + if (btnIcons->getWidth() > 0 && btnIcons->getHeight() > 0) { mButtonIcon = new Image*[BUTTON_COUNT]; diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index cfc5043e..39b3eb75 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -72,15 +72,14 @@ class Button : public gcn::Button * Standard, Highlighted, Pressed, and Disabled. * If the image is too short, the missing states won't be loaded. */ - void setButtonIcon(const std::string& iconFile = std::string(), - int frameHeight = 0, int frameWidth = 0); + void setButtonIcon(const std::string& iconFile = std::string()); /** * Set the button popup text when hovering it for a few seconds. * * @note: An empty text will disable the popup. */ - void setButtonPopupText(const std::string& text = ""); + void setButtonPopupText(const std::string& text = std::string()); void logic(); void mouseMoved(gcn::MouseEvent &event); |