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

30 lines
747 B
C
Raw Normal View History

2011-04-08 07:10:00 +02:00
#ifndef UIBUTTON_H
#define UIBUTTON_H
2011-08-14 04:09:11 +02:00
#include "uiwidget.h"
2011-04-08 07:10:00 +02:00
2011-08-14 04:09:11 +02:00
class UIButton : public UIWidget
2011-04-08 07:10:00 +02:00
{
2011-08-14 04:09:11 +02:00
public:
virtual void setup();
2011-08-14 04:09:11 +02:00
virtual void render();
2011-08-14 04:09:11 +02:00
void setOnClick(const SimpleCallback& onClick) { m_onClick = onClick; }
2011-04-10 22:40:44 +02:00
void setText(const std::string& text) { m_text = text; }
2011-08-14 04:09:11 +02:00
SimpleCallback getOnClick() const { return m_onClick; }
2011-05-03 00:48:41 +02:00
std::string getText() const { return m_text; }
2011-04-10 22:40:44 +02:00
2011-08-14 04:09:11 +02:00
UIButtonPtr asUIButton() { return std::static_pointer_cast<UIButton>(shared_from_this()); }
2011-04-08 11:50:26 +02:00
2011-08-14 04:09:11 +02:00
protected:
virtual void onStyleApply(const OTMLNodePtr& styleNode);
virtual bool onMouseRelease(const Point& mousePos, MouseButton button);
2011-04-22 00:44:30 +02:00
2011-08-14 04:09:11 +02:00
SimpleCallback m_onClick;
Point m_textTranslate;
2011-08-14 04:09:11 +02:00
std::string m_text;
2011-04-08 07:10:00 +02:00
};
2011-08-14 04:09:11 +02:00
#endif