]>
Commit | Line | Data |
---|---|---|
8cf73271 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: slider.h | |
3 | // Purpose: wxSlider class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_SLIDER_H_ | |
13 | #define _WX_SLIDER_H_ | |
14 | ||
8cf73271 SC |
15 | #include "wx/control.h" |
16 | #include "wx/slider.h" | |
17 | #include "wx/stattext.h" | |
18 | ||
53a2db12 | 19 | WXDLLIMPEXP_DATA_CORE(extern const char) wxSliderNameStr[]; |
8cf73271 SC |
20 | |
21 | // Slider | |
53a2db12 | 22 | class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase |
8cf73271 | 23 | { |
01526d4f | 24 | DECLARE_DYNAMIC_CLASS(wxSlider) |
8cf73271 SC |
25 | |
26 | public: | |
01526d4f WS |
27 | wxSlider(); |
28 | ||
29 | inline wxSlider(wxWindow *parent, wxWindowID id, | |
30 | int value, int minValue, int maxValue, | |
31 | const wxPoint& pos = wxDefaultPosition, | |
32 | const wxSize& size = wxDefaultSize, | |
33 | long style = wxSL_HORIZONTAL, | |
34 | const wxValidator& validator = wxDefaultValidator, | |
35 | const wxString& name = wxSliderNameStr) | |
36 | { | |
37 | Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); | |
38 | } | |
39 | ||
d3c7fc99 | 40 | virtual ~wxSlider(); |
01526d4f WS |
41 | |
42 | bool Create(wxWindow *parent, wxWindowID id, | |
43 | int value, int minValue, int maxValue, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | const wxSize& size = wxDefaultSize, | |
46 | long style = wxSL_HORIZONTAL, | |
47 | const wxValidator& validator = wxDefaultValidator, | |
48 | const wxString& name = wxSliderNameStr); | |
49 | ||
50 | virtual int GetValue() const ; | |
51 | virtual void SetValue(int); | |
52 | ||
53 | void SetRange(int minValue, int maxValue); | |
54 | ||
55 | inline int GetMin() const { return m_rangeMin; } | |
56 | inline int GetMax() const { return m_rangeMax; } | |
57 | ||
58 | void SetMin(int minValue) { SetRange(minValue, m_rangeMax); } | |
59 | void SetMax(int maxValue) { SetRange(m_rangeMin, maxValue); } | |
60 | ||
61 | // For trackbars only | |
62 | void SetTickFreq(int n, int pos); | |
63 | inline int GetTickFreq() const { return m_tickFreq; } | |
64 | void SetPageSize(int pageSize); | |
65 | int GetPageSize() const ; | |
66 | void ClearSel() ; | |
67 | void ClearTicks() ; | |
68 | void SetLineSize(int lineSize); | |
69 | int GetLineSize() const ; | |
70 | int GetSelEnd() const ; | |
71 | int GetSelStart() const ; | |
72 | void SetSelection(int minPos, int maxPos); | |
73 | void SetThumbLength(int len) ; | |
74 | int GetThumbLength() const ; | |
75 | void SetTick(int tickPos) ; | |
76 | ||
6f02a879 VZ |
77 | void Command(wxCommandEvent& event); |
78 | virtual wxInt32 MacControlHit(WXEVENTHANDLERREF handler, WXEVENTREF event); | |
79 | void MacHandleControlClick(WXWidget control, wxInt16 controlpart, bool mouseStillDown); | |
80 | ||
01526d4f WS |
81 | protected: |
82 | virtual wxSize DoGetBestSize() const; | |
83 | virtual void DoSetSize(int x, int y, int w, int h, int sizeFlags); | |
84 | virtual void DoMoveWindow(int x, int y, int w, int h); | |
85 | ||
b2e10dac PC |
86 | // set min/max size of the slider |
87 | virtual void DoSetSizeHints( int minW, int minH, | |
88 | int maxW, int maxH, | |
89 | int incW, int incH); | |
90 | ||
02812785 | 91 | // Common processing to invert slider values based on wxSL_INVERSE |
01526d4f | 92 | virtual int ValueInvertOrNot(int value) const; |
02812785 | 93 | |
01526d4f WS |
94 | wxStaticText* m_macMinimumStatic ; |
95 | wxStaticText* m_macMaximumStatic ; | |
96 | wxStaticText* m_macValueStatic ; | |
8cf73271 | 97 | |
01526d4f WS |
98 | int m_rangeMin; |
99 | int m_rangeMax; | |
100 | int m_pageSize; | |
101 | int m_lineSize; | |
102 | int m_tickFreq; | |
8cf73271 SC |
103 | private : |
104 | DECLARE_EVENT_TABLE() | |
105 | }; | |
106 | ||
107 | #endif | |
108 | // _WX_SLIDER_H_ |