raze/libraries/ZWidget/include/zwidget/widgets/pushbutton/pushbutton.h

36 lines
755 B
C
Raw Normal View History

2024-01-04 19:37:57 +00:00
#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 OnPaintFrame(Canvas* canvas) override;
void OnPaint(Canvas* canvas) override;
2024-01-11 23:22:08 +00:00
bool OnMouseDown(const Point& pos, int key) override;
bool OnMouseUp(const Point& pos, int key) override;
2024-01-04 19:37:57 +00:00
void OnMouseMove(const Point& pos) override;
void OnMouseLeave() override;
void OnKeyDown(EInputKey key) override;
void OnKeyUp(EInputKey key) override;
private:
std::string text;
bool buttonDown = false;
bool hot = false;
};