summaryrefslogtreecommitdiff
path: root/src/gui/widgets/button.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-07-05 00:52:39 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-11 02:39:48 +0200
commit2de4411e9b2b81986f4b9e7c645894e59842590e (patch)
tree6b67b700991efa739abea72a08c813770405e0e2 /src/gui/widgets/button.cpp
parent7115ac62eb2069d378d67758a3cd221e6620975d (diff)
downloadmana-2de4411e9b2b81986f4b9e7c645894e59842590e.tar.gz
mana-2de4411e9b2b81986f4b9e7c645894e59842590e.tar.bz2
mana-2de4411e9b2b81986f4b9e7c645894e59842590e.tar.xz
mana-2de4411e9b2b81986f4b9e7c645894e59842590e.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/button.cpp')
-rw-r--r--src/gui/widgets/button.cpp9
1 files changed, 6 insertions, 3 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];