summaryrefslogtreecommitdiff
path: root/src/gui/widgets/button.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-28 20:34:46 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-28 21:23:46 +0300
commitb985de6e83790bd02bd63e3ed47a3a79592b08da (patch)
treec7cd3e0c0f1b3a5791874c847624444ab2578651 /src/gui/widgets/button.h
parent0a58e4d746fe3845040cce79659072fd0a31e094 (diff)
downloadmanaverse-b985de6e83790bd02bd63e3ed47a3a79592b08da.tar.gz
manaverse-b985de6e83790bd02bd63e3ed47a3a79592b08da.tar.bz2
manaverse-b985de6e83790bd02bd63e3ed47a3a79592b08da.tar.xz
manaverse-b985de6e83790bd02bd63e3ed47a3a79592b08da.zip
Add image support for buttons.
Diffstat (limited to 'src/gui/widgets/button.h')
-rw-r--r--src/gui/widgets/button.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h
index 560e46377..6585d9850 100644
--- a/src/gui/widgets/button.h
+++ b/src/gui/widgets/button.h
@@ -28,8 +28,12 @@
#include <guichan/widgetlistener.hpp>
class GraphicsVertexes;
+class Image;
+class ImageSet;
class ImageRect;
+const std::string BUTTON_PLAY = "buttonplay.png";
+
/**
* Button widget. Same as the Guichan button but with custom look.
*
@@ -51,6 +55,23 @@ class Button : public gcn::Button, public gcn::WidgetListener
gcn::ActionListener *listener);
/**
+ * Constructor, sets the caption of the button to the given string and
+ * adds the given action listener.
+ */
+ Button(const std::string &caption, const std::string &imageName,
+ int imageWidth, int imageHeight,
+ const std::string &actionEventId,
+ gcn::ActionListener *listener);
+
+ /**
+ * Constructor, sets the caption of the button to the given string and
+ * adds the given action listener.
+ */
+ Button(const std::string &imageName, int imageWidth, int imageHeight,
+ const std::string &actionEventId,
+ gcn::ActionListener *listener);
+
+ /**
* Destructor.
*/
~Button();
@@ -86,6 +107,12 @@ class Button : public gcn::Button, public gcn::WidgetListener
void widgetMoved(const gcn::Event &event);
+ void loadImage(const std::string &imageName);
+
+ void adjustSize();
+
+ void setCaption(const std::string& caption);
+
private:
void init();
@@ -103,6 +130,10 @@ class Button : public gcn::Button, public gcn::WidgetListener
int mYOffset;
gcn::Color mEnabledColor;
gcn::Color mDisabledColor;
+ Image **mImages;
+ ImageSet *mImageSet;
+ int mImageWidth;
+ int mImageHeight;
};
#endif