SavvyUI C++ UI Library
Loading...
Searching...
No Matches
CheckList.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4#include "Scrollbar.h"
5
7{
8public:
9 long _id;
10 wstring _text;
13};
14
15
24{
25 Scrollbar _scrollBar;
26
30 vector<CheckListItem> _items;
31
35 wstring _selection;
36
40 wstring _displayText;
41
45 BOOL _isPopup;
46
47 long _maxVisibleRows;
48 __int64 _firstVisibleRow;
49 __int64 _lastVisibleRow;
50
51protected:
61 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
62
67
68public:
73
77 virtual ~CheckList();
78
84 void setAsPopup(BOOL isPopup);
85
89 BOOL isPopup();
90
96 void setOptions(const vector<KeyValue>& selections);
97 void getOptions(vector<KeyValue>& selections);
98
104 void setSelectedItems(const vector<KeyValue>& selections);
105
111 vector<KeyValue> getSelectedItems();
112
113public: // Overridables
114
115 void onPaint(Graphics* g) override;
116 void onWindowResized() override;
117
118 void onArrowUp(BOOL shiftPressed, BOOL ctrlPressed) override;
119 void onArrowDown(BOOL shiftPressed, BOOL ctrlPressed) override;
120 void onPageUp(BOOL shiftPressed, BOOL ctrlPressed) override;
121 void onPageDown(BOOL shiftPressed, BOOL ctrlPressed) override;
122 void onKeyHome(BOOL shiftPressed, BOOL ctrlPressed) override;
123 void onKeyEnd(BOOL shiftPressed, BOOL ctrlPressed) override;
124
125 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed) override;
126 void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
127 void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
128 BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta) override;
129
130 void onFocusGained() override;;
131 void onFocusLost() override;;
132
133public:
134
143 void onSelectionChanged(WinHandle hWndCB, int itemIndex, const wstring& itemText, BOOL itemChecked);
144
151
152public:
153
154 void scrollBarActivity(__int64 firstVisibleItem);
156};
HWND WinHandle
Definition Common.h:16
Definition Common.h:21
void onArrowUp(BOOL shiftPressed, BOOL ctrlPressed) override
CheckList()
Constructs a new CheckList instance.
BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta) override
Called when the mouse wheel is used over the component.
virtual ~CheckList()
Destroys the CheckList instance.
void onArrowDown(BOOL shiftPressed, BOOL ctrlPressed) override
void getOptions(vector< KeyValue > &selections)
void addSelectionChangedListener(SelectionChangeListener *l)
Adds a listener to be notified when item selection changes.
void onKeyHome(BOOL shiftPressed, BOOL ctrlPressed) override
void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse button is released within the component.
void scrollBarActivity(__int64 firstVisibleItem)
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 onPaint(Graphics *g) override
Called to paint the component's client area.
vector< KeyValue > getSelectedItems()
Returns the currently selected items in the checklist.
void onWindowResized() override
Called when the component's window is resized.
void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse is moved within the component.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Retrieves the options for creating the checklist window.
void onSelectionChanged(WinHandle hWndCB, int itemIndex, const wstring &itemText, BOOL itemChecked)
Notifies the checklist of a selection state change for an item.
void setAsPopup(BOOL isPopup)
Sets whether the checklist is used in a popup context.
void onFocusLost() override
Called when the component loses keyboard focus.
void onPageDown(BOOL shiftPressed, BOOL ctrlPressed) override
BOOL isPopup()
Return TRUE if this component is displayed as a popup (e.g. dropdown from CheckComboBox).
void onPageUp(BOOL shiftPressed, BOOL ctrlPressed) override
void onKeyEnd(BOOL shiftPressed, BOOL ctrlPressed) override
void setOptions(const vector< KeyValue > &selections)
Sets the available options to be shown in the checklist.
void scrollBarRepaint()
void setSelectedItems(const vector< KeyValue > &selections)
Sets which items are selected based on key-value input.
void windowCreated()
Called after the checklist window is created.
void onFocusGained() override
Called when the component gains keyboard focus.
Definition CheckList.h:7
Bounds _checkRect
Definition CheckList.h:12
wstring _text
Definition CheckList.h:10
BOOL _checked
Definition CheckList.h:11
long _id
Definition CheckList.h:9
Component()
Constructs a new Component instance.
Definition Graphics.h:171
Definition Scrollbar.h:14
Definition Scrollbar.h:6
Definition EventListeners.h:31