bac2a2edc5 Exclude SDL2 from Windows compilation. 5b859bfd84 WaylandDisplayBackend: If the clicked window has a locked mouse, hide the cursor afterwards ce76df6aa6 WaylandDisplayBackend: Add a TODO about XDG_Activation a0ba04275b WaylandDisplayWindow: Move XDG Activation Token outside activate() git-subtree-dir: libraries/ZWidget git-subtree-split: bac2a2edc52cf12d1223244251876e9c4533e614
34 lines
765 B
C++
34 lines
765 B
C++
|
|
#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;
|
|
void Toggle();
|
|
|
|
double GetPreferredHeight() const;
|
|
std::function<void(bool)> FuncChanged;
|
|
void SetRadioStyle(bool on) { radiostyle = on; }
|
|
|
|
protected:
|
|
void OnPaint(Canvas* canvas) override;
|
|
bool OnMouseDown(const Point& pos, InputKey key) override;
|
|
bool OnMouseUp(const Point& pos, InputKey key) override;
|
|
void OnMouseLeave() override;
|
|
void OnKeyUp(InputKey key) override;
|
|
|
|
private:
|
|
std::string text;
|
|
bool checked = false;
|
|
bool radiostyle = false;
|
|
bool mouseDownActive = false;
|
|
};
|