cecd34301d Delay load DPI-related functions bfc172f702 Added exception to some unimplemented functions 7c8d469bcb Added item modifications functions 847d0e6d9e Improved keyboard navigation 8c4270e0f8 Dropdown can now be closed by re-selecting it 91402c31ec Fix dropdown positioning in x11 and win32 git-subtree-dir: libraries/ZWidget git-subtree-split: cecd34301d369400227eb0f27bad2ab41ad756d2
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;
|
|
};
|