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:
|
2011-08-26 17:06:52 +02:00
|
|
|
virtual void setup();
|
2011-08-14 04:09:11 +02:00
|
|
|
virtual void render();
|
2011-04-09 21:07:35 +02:00
|
|
|
|
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:
|
2011-08-26 17:06:52 +02:00
|
|
|
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;
|
2011-08-26 17:06:52 +02:00
|
|
|
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
|