29 lines
530 B
C++
29 lines
530 B
C++
#pragma once
|
|
|
|
#include "Widget.h"
|
|
#include <functional>
|
|
|
|
class Button : public Widget
|
|
{
|
|
private:
|
|
using clickFunc = std::function<void()>;
|
|
std::string mLabel;
|
|
clickFunc mClickFunc;
|
|
|
|
public:
|
|
Button();
|
|
|
|
static std::unique_ptr<Button> Create();
|
|
|
|
void SetLabel(const std::string& text);
|
|
|
|
void SetOnClickFunction(clickFunc func);
|
|
|
|
void OnPaintEvent(const PaintEvent* event) override;
|
|
|
|
protected:
|
|
|
|
void OnMyMouseEvent(const MouseEvent* event) override;
|
|
};
|
|
|
|
using ButtonUPtr = std::unique_ptr<Button>;
|