vkdoom_m/include/zwidget/widgets/checkboxlabel/checkboxlabel.h
Rachael Alexanderson d9b2c00228 Squashed 'libraries/ZWidget/' content from commit 96501b6ef1
git-subtree-dir: libraries/ZWidget
git-subtree-split: 96501b6ef11e8737cd8ccb2451395115b810dfcc
2025-07-30 00:09:28 -04:00

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;
};