2023-12-26 23:44:40 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../../core/widget.h"
|
|
|
|
|
|
|
|
class CheckboxLabel : public Widget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CheckboxLabel(Widget* parent = nullptr);
|
|
|
|
|
|
|
|
void SetText(const std::string& value);
|
|
|
|
const std::string& GetText() const;
|
|
|
|
|
|
|
|
void SetChecked(bool value);
|
|
|
|
bool GetChecked() const;
|
2023-12-27 03:46:14 +00:00
|
|
|
void Toggle();
|
2023-12-26 23:44:40 +00:00
|
|
|
|
|
|
|
double GetPreferredHeight() const;
|
2024-01-04 18:25:25 +00:00
|
|
|
std::function<void(bool)> FuncChanged;
|
|
|
|
void SetRadioStyle(bool on) { radiostyle = on; }
|
2023-12-26 23:44:40 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void OnPaint(Canvas* canvas) override;
|
2023-12-27 03:46:14 +00:00
|
|
|
void OnMouseDown(const Point& pos, int key) override;
|
|
|
|
void OnMouseUp(const Point& pos, int key) override;
|
|
|
|
void OnMouseLeave() override;
|
|
|
|
void OnKeyUp(EInputKey key) override;
|
2023-12-26 23:44:40 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::string text;
|
|
|
|
bool checked = false;
|
2024-01-04 18:25:25 +00:00
|
|
|
bool radiostyle = false;
|
2023-12-27 03:46:14 +00:00
|
|
|
bool mouseDownActive = false;
|
2024-01-04 18:25:25 +00:00
|
|
|
|
2023-12-26 23:44:40 +00:00
|
|
|
};
|