SavvyUI C++ UI Library
Loading...
Searching...
No Matches
Slider.h
Go to the documentation of this file.
1#pragma once
2
3#include "Component.h"
4
5class Slider : public Component
6{
7 long _rangeMin;
8 long _rangeMax;
9 long _value;
10 BOOL _showTooltip;
11
12 double _tickValue;
13
14 Bounds _thumbRect;
15 BOOL _isDragging;
16
17protected:
18 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
19
21
22public:
24
25 virtual ~Slider();
26
28
29 void setRange(long rangeMin, long rangeMax);
30
31 void setValue(long value);
32 long getValue();
33
34 void showTooltip(BOOL bShow = TRUE);
35
36 void onPaint(Graphics* g);
37
39
40 void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed);
41 void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
42 void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed);
43 void onSelectionChanged(WinHandle hWndCB, int newValue, const wstring& itemText, BOOL itemChecked, const ProcParams& procParams);
44
46};
47
48/* WINDOWS NATIVE SLIDER
49#pragma once
50
51#include "Component.h"
52
53class Slider : public Component
54{
55 long _rangeMin;
56 long _rangeMax;
57 long _tickFrequency;
58 long _value;
59
60protected:
61
62 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
63
64 void windowCreated();
65
66public:
67
68 Slider();
69
70 virtual ~Slider();
71
72 int getPreferredHeight();
73
74 void setRange(long rangeMin, long rangeMax);
75
76 void setTickMarksFrequency(long frequency);
77
78 void setValue(long value);
79
80 long getValue();
81
82 void onSelectionChanged(WinHandle hWndCB, int newValue, const wstring& itemText, BOOL itemChecked, const ProcParams& procParams);
83
84 void addSelectionChangedListener(SelectionChangeListener* l);
85};
86*/
HWND WinHandle
Definition Common.h:16
Definition Common.h:20
Component()
Constructs a new Component instance.
Definition Graphics.h:161
Definition Component.h:9
Definition EventListeners.h:31
void showTooltip(BOOL bShow=TRUE)
void onMousePressed(WinHandle hWnd, int x, int y, int clickCount, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse is pressed within the component.
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Abstract method to get window creation options.
long getValue()
virtual ~Slider()
void addSelectionChangedListener(SelectionChangeListener *l)
void onWindowResized()
Called when the component's window is resized.
void onSelectionChanged(WinHandle hWndCB, int newValue, const wstring &itemText, BOOL itemChecked, const ProcParams &procParams)
Called when the selection changes.
void windowCreated()
Abstract method called after the window has been created.
void onPaint(Graphics *g)
Called to paint the component's client area.
int getPreferredHeight()
Returns the preferred height of the component.
void onMouseMoved(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse is moved within the component.
void setRange(long rangeMin, long rangeMax)
void onMouseReleased(WinHandle hWnd, int x, int y, BOOL shiftPressed, BOOL ctrlPressed)
Called when the mouse button is released within the component.
void setValue(long value)