You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
747 B
30 lines
747 B
#ifndef UIBUTTON_H
|
|
#define UIBUTTON_H
|
|
|
|
#include "uiwidget.h"
|
|
|
|
class UIButton : public UIWidget
|
|
{
|
|
public:
|
|
virtual void setup();
|
|
virtual void render();
|
|
|
|
void setOnClick(const SimpleCallback& onClick) { m_onClick = onClick; }
|
|
void setText(const std::string& text) { m_text = text; }
|
|
|
|
SimpleCallback getOnClick() const { return m_onClick; }
|
|
std::string getText() const { return m_text; }
|
|
|
|
UIButtonPtr asUIButton() { return std::static_pointer_cast<UIButton>(shared_from_this()); }
|
|
|
|
protected:
|
|
virtual void onStyleApply(const OTMLNodePtr& styleNode);
|
|
virtual bool onMouseRelease(const Point& mousePos, MouseButton button);
|
|
|
|
SimpleCallback m_onClick;
|
|
Point m_textTranslate;
|
|
std::string m_text;
|
|
};
|
|
|
|
#endif
|