diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-16 18:07:46 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-16 19:13:27 +0200 |
commit | c8fb331e7506e4b2616f8bb30809adeb9f348615 (patch) | |
tree | 9e66a473316bf56554a6216f8fcd68a4b662937b /src/gui/widgets/button.h | |
parent | be64806b1f8f3da2459771e268fd839ee04aa7ba (diff) | |
download | mana-c8fb331e7506e4b2616f8bb30809adeb9f348615.tar.gz mana-c8fb331e7506e4b2616f8bb30809adeb9f348615.tar.bz2 mana-c8fb331e7506e4b2616f8bb30809adeb9f348615.tar.xz mana-c8fb331e7506e4b2616f8bb30809adeb9f348615.zip |
Added image support to the button widgets.
Resolves: Mana-mantis #96.
Reviewed-by: Crush.
Note that the option to set the image position
next to the text is still needed
and will be handled in another issue.
Diffstat (limited to 'src/gui/widgets/button.h')
-rw-r--r-- | src/gui/widgets/button.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index b750d9bb..6d8f773c 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -25,6 +25,7 @@ #include <guichan/widgets/button.hpp> class ImageRect; +class Image; /** * Button widget. Same as the Guichan button but with custom look. @@ -58,12 +59,31 @@ class Button : public gcn::Button */ void updateAlpha(); + void adjustSize(); + + void setCaption(const std::string& caption); + + /** + * Set the icons available next to the text + * + * @note: The image given must be formatted to give horizontally + * frames of the given width and height for the following states: + * 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); + private: void init(); - static ImageRect button[4]; /**< Button state graphics */ - static int mInstances; /**< Number of button instances */ + void removeButtonIcon(); + + static ImageRect* mButton; /**< Button state graphics */ + static int mInstances; /**< Number of button instances */ static float mAlpha; + + Image** mButtonIcon; /**< Button Icons graphics */ }; #endif |