SavvyUI C++ UI Library
Loading...
Searching...
No Matches
Radio.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4#include "Scrollbar.h"
5
7{
8public:
9 RadioItem(const wstring& actionName, const wstring& text)
10 {
11 _action = actionName;
12 _text = text;
13 }
14
15 wstring _action;
16 wstring _text;
18};
19
23class Radio : public Component, public ScrollbarListener
24{
25 Scrollbar _scrollBar;
26
27 vector<RadioItem> _items;
28 long _selectedIndex;
29
30 wstring _orientation;
31
32 long _maxVisibleItems;
33 __int64 _firstVisibleItem;
34 __int64 _lastVisibleItem;
35
36protected:
40 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
41
46
47public:
52
56 virtual ~Radio();
57
59
63 void clear();
64
70 void setOrientation(const wstring& orientation = L"VERT");
71
77 wstring getOrientation();
78
85 void addOption(const wstring& actionName, const wstring& text);
86
92 void setSelectedtem(const wstring& action);
93
99 wstring getSelectedtem();
100
101public: // Overridables
102
107
112
116 void onArrowUp(BOOL shiftPressed, BOOL ctrlPressed);
117
121 void onArrowDown(BOOL shiftPressed, BOOL ctrlPressed);
122
126 void onPageUp(BOOL shiftPressed, BOOL ctrlPressed);
127
131 void onPageDown(BOOL shiftPressed, BOOL ctrlPressed);
132
136 void onKeyHome(BOOL shiftPressed, BOOL ctrlPressed);
137
141 void onKeyEnd(BOOL shiftPressed, BOOL ctrlPressed);
142
146 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
147 void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
148 void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
149
155 BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta);
156
163
164public:
165
166 void scrollBarActivity(__int64 firstVisibleItem);
168};
HWND WinHandle
Definition Common.h:16
Definition Common.h:21
Component()
Constructs a new Component instance.
Definition Graphics.h:171
void onArrowUp(BOOL shiftPressed, BOOL ctrlPressed)
Handles Up arrow key press.
void onPageDown(BOOL shiftPressed, BOOL ctrlPressed)
Handles Page Down key press.
void onKeyEnd(BOOL shiftPressed, BOOL ctrlPressed)
Handles End key press.
void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse is moved within the component.
virtual ~Radio()
Destroys the Radio component.
void addOption(const wstring &actionName, const wstring &text)
Adds a radio option.
int getPreferredHeight()
Returns the preferred height of the component.
void onArrowDown(BOOL shiftPressed, BOOL ctrlPressed)
Handles Down arrow key press.
void setSelectedtem(const wstring &action)
Sets the selected radio option by its action name.
void clear()
Removes all radio options.
wstring getOrientation()
Gets the current orientation.
void setOrientation(const wstring &orientation=L"VERT")
Sets the orientation of the radio group.
void onPaint(Graphics *g)
Paints the control.
void onPageUp(BOOL shiftPressed, BOOL ctrlPressed)
Handles Page Up key press.
void onKeyHome(BOOL shiftPressed, BOOL ctrlPressed)
Handles Home key press.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Gets window creation options.
void scrollBarRepaint()
Radio()
Constructs a new Radio component.
wstring getSelectedtem()
Gets the action name of the currently selected option.
void scrollBarActivity(__int64 firstVisibleItem)
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Handles mouse press events.
void addSelectionChangedListener(SelectionChangeListener *l)
Adds a listener for selection change events.
BOOL onMouseWheel(WinHandle hWnd, int x, int y, int delta)
Handles mouse wheel scrolling.
void windowCreated()
Called when the window is created.
void onWindowResized()
Handles window resize event.
void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse button is released within the component.
Bounds _rect
Definition Radio.h:17
RadioItem(const wstring &actionName, const wstring &text)
Definition Radio.h:9
wstring _action
Definition Radio.h:15
wstring _text
Definition Radio.h:16
Definition Scrollbar.h:14
Definition Scrollbar.h:6
Definition EventListeners.h:31