SavvyUI C++ UI Library
Loading...
Searching...
No Matches
ToggleButton.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4
10class ToggleButton : public Component
11{
12 vector<Bounds> _optionsRect;
13 vector<wstring> _options;
14 wstring _selectedButtonText;
15
16protected:
26 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
27
32
33public:
38
42 virtual ~ToggleButton();
43
48
54 void setOptions(const vector<wstring>& options);
55
61 void setSelectedItem(const wstring& optionText);
62
68 void onPaint(Graphics *g);
69
80 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
81
88};
HWND WinHandle
Definition Common.h:16
Component()
Constructs a new Component instance.
Definition Graphics.h:161
Definition EventListeners.h:31
void setOptions(const vector< wstring > &options)
Sets the toggle options.
void onPaint(Graphics *g)
Paints the toggle button and its options.
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Handles mouse press events.
void windowCreated()
Called when the window has been created.
void addSelectionChangedListener(SelectionChangeListener *l)
Adds a listener to be notified when the selection changes.
virtual ~ToggleButton()
Destructor.
void setSelectedItem(const wstring &optionText)
Sets the currently selected option by its text.
int getPreferredHeight()
Returns the preferred height.
ToggleButton()
Constructs a new ToggleButton object.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Prepares window creation options.