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

36 lines
755 B
C
Raw Normal View History

2023-12-26 23:44:40 +00:00
#pragma once
#include "../../core/widget.h"
#include <functional>
2023-12-26 23:44:40 +00:00
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;
2023-12-26 23:44:40 +00:00
protected:
void OnPaintFrame(Canvas* canvas) override;
void OnPaint(Canvas* canvas) override;
void OnMouseMove(const Point& pos) override;
void OnMouseDown(const Point& pos, int key) override;
void OnMouseUp(const Point& pos, int key) override;
void OnMouseLeave() override;
void OnKeyDown(EInputKey key) override;
void OnKeyUp(EInputKey key) override;
2023-12-26 23:44:40 +00:00
private:
std::string text;
bool buttonDown = false;
bool hot = false;
2023-12-26 23:44:40 +00:00
};