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
6{
7public:
8 long _id;
9 wstring _text;
12};
13
14
22class CheckList : public Component
23{
27 vector<CheckListItem> _items;
28
32 wstring _selection;
33
37 wstring _displayText;
38
42 BOOL _isPopup;
43
44 long _maxVisibleRows;
45 __int64 _firstVisibleRow;
46 __int64 _lastVisibleRow;
47
48protected:
58 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
59
64
65public:
70
74 virtual ~CheckList();
75
81 void setAsPopup(BOOL isPopup);
82
86 BOOL isPopup();
87
93 void setOptions(const vector<KeyValue>& selections);
94 void getOptions(vector<KeyValue>& selections);
95
101 void setSelectedItems(const vector<KeyValue>& selections);
102
108 vector<KeyValue> getSelectedItems();
109
110public: // Overridables
111
112 void onPaint(Graphics* g) override;
113 void onWindowResized() override;
114
115 void onArrowUp(BOOL shiftPressed, BOOL ctrlPressed) override;
116 void onArrowDown(BOOL shiftPressed, BOOL ctrlPressed) override;
117 void onPageUp(BOOL shiftPressed, BOOL ctrlPressed) override;
118 void onPageDown(BOOL shiftPressed, BOOL ctrlPressed) override;
119 void onKeyHome(BOOL shiftPressed, BOOL ctrlPressed) override;
120 void onKeyEnd(BOOL shiftPressed, BOOL ctrlPressed) override;
121
122 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed) override;
123 BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta) override;
124
125 void onFocusGained() override;;
126 void onFocusLost() override;;
127
128 BOOL getScrollingInfo(__int64& scrollMin, __int64& scrollMax, __int64& pageSize) override;
129 void setScrollbarTopOffset(__int64 firstVisibleRow) override;
130
131public:
132
141 void onSelectionChanged(WinHandle hWndCB, int itemIndex, const wstring& itemText, BOOL itemChecked);
142
149};
HWND WinHandle
Definition Common.h:16
Definition Common.h:20
void onArrowUp(BOOL shiftPressed, BOOL ctrlPressed) override
BOOL getScrollingInfo(__int64 &scrollMin, __int64 &scrollMax, __int64 &pageSize) override
Provides scrolling information if supported.
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 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.
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
void setScrollbarTopOffset(__int64 firstVisibleRow) override
Sets the scrollbar's top offset.
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 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:6
Bounds _checkRect
Definition CheckList.h:11
wstring _text
Definition CheckList.h:9
BOOL _checked
Definition CheckList.h:10
long _id
Definition CheckList.h:8
Component()
Constructs a new Component instance.
Definition Graphics.h:161
Definition EventListeners.h:31