SavvyUI C++ UI Library
Loading...
Searching...
No Matches
CheckBox.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4
12class CheckBox : public Component
13{
14 Bounds _checkBoxRect, _textRect;
15
19 BOOL _checked;
20
24 wstring _text;
25
26protected:
36 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
37
42
43public:
48
52 virtual ~CheckBox();
53
58
64 void setText(const wstring& text);
65
71 void setChecked(BOOL checked);
72
78 BOOL isChecked();
79
86
87public: // Overridables
88
89 void onPaint(Graphics *g) override;
90 void onWindowResized() override;
91
92 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed) override;
93};
HWND WinHandle
Definition Common.h:16
Definition Common.h:20
void onPaint(Graphics *g) override
Called to paint the component's client area.
BOOL isChecked()
Returns whether the checkbox is currently checked.
CheckBox()
Constructs a new CheckBox component.
void addSelectionChangedListener(SelectionChangeListener *l)
Adds a listener that is notified when the selection state changes.
void windowCreated()
Called after the checkbox window has been successfully created.
int getPreferredHeight()
Returns the preferred height.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Retrieves options for creating the checkbox window.
virtual ~CheckBox()
Destroys the CheckBox component.
void onWindowResized() override
Called when the component's window is resized.
void setChecked(BOOL checked)
Sets the checked state of the checkbox.
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed) override
Called when the mouse is pressed within the component.
void setText(const wstring &text)
Sets the label text displayed next to the checkbox.
Component()
Constructs a new Component instance.
Definition Graphics.h:161
Definition EventListeners.h:31