tibia-client/src/framework/ui/uibutton.h

42 lines
846 B
C
Raw Normal View History

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
class UIButton;
typedef std::shared_ptr<UIButton> UIButtonPtr;
2011-04-08 07:10:00 +02:00
class UIButton : public UIElement
{
public:
enum ButtonState
{
2011-07-17 02:13:53 +02:00
ButtonUp = 0,
ButtonDown,
ButtonMouseOver
};
2011-04-11 22:06:03 +02:00
UIButton() :
UIElement(UI::Button),
m_state(ButtonUp) { }
2011-04-08 11:50:26 +02:00
static UIButtonPtr create() { return UIButtonPtr(new UIButton); }
2011-04-11 06:08:56 +02:00
void onInputEvent(const InputEvent& event);
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
ButtonState getState() { return m_state; }
2011-04-08 11:50:26 +02:00
virtual const char *getLuaTypeName() const { return "UIButton"; }
2011-04-22 00:44:30 +02:00
2011-04-08 11:50:26 +02:00
private:
std::string m_text;
ButtonState m_state;
2011-04-08 07:10:00 +02:00
};
#endif // UIBUTTON_H