git-subtree-dir: libraries/ZWidget git-subtree-split: 96501b6ef11e8737cd8ccb2451395115b810dfcc
32 lines
673 B
C++
32 lines
673 B
C++
|
|
#pragma once
|
|
|
|
#include "../../core/widget.h"
|
|
#include <functional>
|
|
|
|
class PushButton : public Widget
|
|
{
|
|
public:
|
|
PushButton(Widget* parent = nullptr);
|
|
|
|
void SetText(const std::string& value);
|
|
const std::string& GetText() const;
|
|
|
|
double GetPreferredHeight() const;
|
|
|
|
void Click();
|
|
|
|
std::function<void()> OnClick;
|
|
|
|
protected:
|
|
void OnPaint(Canvas* canvas) override;
|
|
bool OnMouseDown(const Point& pos, InputKey key) override;
|
|
bool OnMouseUp(const Point& pos, InputKey key) override;
|
|
void OnMouseMove(const Point& pos) override;
|
|
void OnMouseLeave() override;
|
|
void OnKeyDown(InputKey key) override;
|
|
void OnKeyUp(InputKey key) override;
|
|
|
|
private:
|
|
std::string text;
|
|
};
|