]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: slider.h | |
3 | // Purpose: wxSlider class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_SLIDER_H_ | |
13 | #define _WX_SLIDER_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "slider.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/control.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr; | |
22 | ||
23 | // Slider | |
24 | class WXDLLEXPORT wxSlider: public wxControl | |
25 | { | |
26 | DECLARE_DYNAMIC_CLASS(wxSlider) | |
27 | ||
28 | public: | |
29 | wxSlider(); | |
30 | ||
31 | inline wxSlider(wxWindow *parent, wxWindowID id, | |
32 | int value, int minValue, int maxValue, | |
33 | const wxPoint& pos = wxDefaultPosition, | |
34 | const wxSize& size = wxDefaultSize, | |
35 | long style = wxSL_HORIZONTAL, | |
36 | const wxValidator& validator = wxDefaultValidator, | |
37 | const wxString& name = wxSliderNameStr) | |
38 | { | |
39 | Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); | |
40 | } | |
41 | ||
42 | ~wxSlider(); | |
43 | ||
44 | bool Create(wxWindow *parent, wxWindowID id, | |
45 | int value, int minValue, int maxValue, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = wxSL_HORIZONTAL, | |
49 | const wxValidator& validator = wxDefaultValidator, | |
50 | const wxString& name = wxSliderNameStr); | |
51 | ||
52 | virtual int GetValue() const ; | |
53 | virtual void SetValue(int); | |
54 | void GetSize(int *x, int *y) const ; | |
4fabb575 JS |
55 | wxSize GetSize() const { return wxWindow::GetSize(); } |
56 | ||
9b6dbb09 | 57 | void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
4fabb575 JS |
58 | void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) |
59 | { wxWindow::SetSize(rect, sizeFlags); } | |
60 | void SetSize(const wxSize& size) { wxWindow::SetSize(size); } | |
c330a2cf | 61 | virtual void SetSize(int width, int height) { SetSize(-1, -1, width, height, wxSIZE_USE_EXISTING); } |
9b6dbb09 JS |
62 | |
63 | void SetRange(int minValue, int maxValue); | |
64 | ||
65 | inline int GetMin() const { return m_rangeMin; } | |
66 | inline int GetMax() const { return m_rangeMax; } | |
67 | ||
68 | // For trackbars only | |
69 | void SetTickFreq(int n, int pos); | |
70 | inline int GetTickFreq() const { return m_tickFreq; } | |
71 | void SetPageSize(int pageSize); | |
72 | int GetPageSize() const ; | |
73 | void ClearSel() ; | |
74 | void ClearTicks() ; | |
75 | void SetLineSize(int lineSize); | |
76 | int GetLineSize() const ; | |
77 | int GetSelEnd() const ; | |
78 | int GetSelStart() const ; | |
79 | void SetSelection(int minPos, int maxPos); | |
80 | void SetThumbLength(int len) ; | |
81 | int GetThumbLength() const ; | |
82 | void SetTick(int tickPos) ; | |
83 | ||
84 | void Command(wxCommandEvent& event); | |
0d57be45 JS |
85 | |
86 | // Implementation | |
4b5f3fe6 | 87 | virtual void ChangeFont(bool keepOriginalSize = TRUE); |
0d57be45 JS |
88 | virtual void ChangeBackgroundColour(); |
89 | virtual void ChangeForegroundColour(); | |
90 | ||
9b6dbb09 JS |
91 | protected: |
92 | int m_rangeMin; | |
93 | int m_rangeMax; | |
94 | int m_pageSize; | |
95 | int m_lineSize; | |
96 | int m_tickFreq; | |
97 | DECLARE_EVENT_TABLE() | |
98 | }; | |
99 | ||
100 | #endif | |
101 | // _WX_SLIDER_H_ |