SavvyUI C++ UI Library
Loading...
Searching...
No Matches
Switch.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4
8class Switch : public Component
9{
10 wstring _option1;
11 wstring _option2;
12 wstring _selectedOption;
13
14protected:
24 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
25
30
31public:
36
40 virtual ~Switch();
41
46
53 void setOptions(const wstring& option1, const wstring& option2);
54
60 void setSelectedtem(const wstring& selectedOption);
61
67 wstring getSelectedtem();
68
69public: // Overridables
70
76 void onPaint(Graphics *g);
77
82
93 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
94
101};
HWND WinHandle
Definition Common.h:16
Component()
Constructs a new Component instance.
Definition Graphics.h:161
Definition EventListeners.h:31
void onWindowResized()
Handler called when the window is resized.
Switch()
Constructs a new Switch component.
wstring getSelectedtem()
Gets the currently selected option.
virtual ~Switch()
Destructor for the Switch component.
void windowCreated()
Called when the window is created.
void setOptions(const wstring &option1, const wstring &option2)
Sets the two toggle options.
void onPaint(Graphics *g)
Paint handler for the switch control.
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Handler for mouse press events.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Gets options for creating the window.
int getPreferredHeight()
Returns the preferred height.
void setSelectedtem(const wstring &selectedOption)
Sets the currently selected option.
void addSelectionChangedListener(SelectionChangeListener *l)
Adds a listener to be notified when the selection changes.