2011-04-08 07:10:00 +02:00
|
|
|
#ifndef UIBUTTON_H
|
|
|
|
#define UIBUTTON_H
|
|
|
|
|
2011-07-13 23:12:36 +02:00
|
|
|
#include <global.h>
|
2011-04-17 21:14:24 +02:00
|
|
|
#include <ui/uielement.h>
|
|
|
|
#include <graphics/borderedimage.h>
|
2011-04-08 07:10:00 +02:00
|
|
|
|
2011-04-22 15:49:46 +02:00
|
|
|
class UIButton;
|
|
|
|
typedef boost::shared_ptr<UIButton> UIButtonPtr;
|
|
|
|
|
2011-04-08 07:10:00 +02:00
|
|
|
class UIButton : public UIElement
|
|
|
|
{
|
|
|
|
public:
|
2011-05-09 22:38:01 +02:00
|
|
|
enum ButtonState
|
|
|
|
{
|
2011-07-17 02:13:53 +02:00
|
|
|
ButtonUp = 0,
|
2011-05-09 22:38:01 +02:00
|
|
|
ButtonDown,
|
|
|
|
ButtonMouseOver
|
|
|
|
};
|
|
|
|
|
2011-04-11 22:06:03 +02:00
|
|
|
UIButton() :
|
|
|
|
UIElement(UI::Button),
|
2011-05-09 22:38:01 +02:00
|
|
|
m_state(ButtonUp) { }
|
2011-04-08 11:50:26 +02:00
|
|
|
|
2011-04-11 06:08:56 +02:00
|
|
|
void onInputEvent(const InputEvent& event);
|
2011-04-09 21:07:35 +02:00
|
|
|
|
2011-04-10 22:40:44 +02:00
|
|
|
void setText(const std::string& text) { m_text = text; }
|
2011-05-03 00:48:41 +02:00
|
|
|
std::string getText() const { return m_text; }
|
2011-04-10 22:40:44 +02:00
|
|
|
|
2011-05-09 22:38:01 +02:00
|
|
|
ButtonState getState() { return m_state; }
|
2011-04-08 11:50:26 +02:00
|
|
|
|
2011-07-17 02:13:53 +02:00
|
|
|
virtual const char *getScriptObjectType() const { return "UIButton"; }
|
2011-04-22 00:44:30 +02:00
|
|
|
|
2011-04-08 11:50:26 +02:00
|
|
|
private:
|
|
|
|
std::string m_text;
|
2011-05-09 22:38:01 +02:00
|
|
|
ButtonState m_state;
|
2011-04-08 07:10:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // UIBUTTON_H
|