]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: slider.h | |
3 | // Purpose: wxSlider class | |
409c9842 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
409c9842 | 6 | // Created: 10/15/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
409c9842 DW |
8 | // Copyright: (c) David Webster |
9 | // Licence: wxWindows licence | |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_SLIDER_H_ | |
13 | #define _WX_SLIDER_H_ | |
14 | ||
0e320a79 DW |
15 | #include "wx/control.h" |
16 | ||
17 | WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr; | |
18 | ||
19 | // Slider | |
20 | class WXDLLEXPORT wxSlider: public wxControl | |
21 | { | |
22 | DECLARE_DYNAMIC_CLASS(wxSlider) | |
23 | ||
24 | public: | |
25 | wxSlider(); | |
26 | ||
27 | inline wxSlider(wxWindow *parent, wxWindowID id, | |
28 | int value, int minValue, int maxValue, | |
29 | const wxPoint& pos = wxDefaultPosition, | |
30 | const wxSize& size = wxDefaultSize, | |
31 | long style = wxSL_HORIZONTAL, | |
57c4d796 DW |
32 | #if wxUSE_VALIDATORS |
33 | # if defined(__VISAGECPP__) | |
34 | const wxValidator* validator = wxDefaultValidator, | |
35 | # else | |
0e320a79 | 36 | const wxValidator& validator = wxDefaultValidator, |
57c4d796 DW |
37 | # endif |
38 | #endif | |
0e320a79 DW |
39 | const wxString& name = wxSliderNameStr) |
40 | { | |
41 | Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); | |
42 | } | |
43 | ||
44 | ~wxSlider(); | |
45 | ||
46 | bool Create(wxWindow *parent, wxWindowID id, | |
47 | int value, int minValue, int maxValue, | |
48 | const wxPoint& pos = wxDefaultPosition, | |
49 | const wxSize& size = wxDefaultSize, | |
50 | long style = wxSL_HORIZONTAL, | |
57c4d796 DW |
51 | #if wxUSE_VALIDATORS |
52 | # if defined(__VISAGECPP__) | |
53 | const wxValidator* validator = wxDefaultValidator, | |
54 | # else | |
0e320a79 | 55 | const wxValidator& validator = wxDefaultValidator, |
57c4d796 DW |
56 | # endif |
57 | #endif | |
0e320a79 DW |
58 | const wxString& name = wxSliderNameStr); |
59 | ||
60 | virtual int GetValue() const ; | |
61 | virtual void SetValue(int); | |
409c9842 | 62 | |
0e320a79 | 63 | void GetSize(int *x, int *y) const ; |
0e320a79 | 64 | void GetPosition(int *x, int *y) const ; |
409c9842 | 65 | |
0e320a79 DW |
66 | bool Show(bool show); |
67 | ||
68 | void SetRange(int minValue, int maxValue); | |
69 | ||
70 | inline int GetMin() const { return m_rangeMin; } | |
71 | inline int GetMax() const { return m_rangeMax; } | |
72 | ||
409c9842 DW |
73 | void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
74 | ||
75 | ||
76 | ||
0e320a79 DW |
77 | // For trackbars only |
78 | void SetTickFreq(int n, int pos); | |
79 | inline int GetTickFreq() const { return m_tickFreq; } | |
80 | void SetPageSize(int pageSize); | |
81 | int GetPageSize() const ; | |
82 | void ClearSel() ; | |
83 | void ClearTicks() ; | |
84 | void SetLineSize(int lineSize); | |
85 | int GetLineSize() const ; | |
86 | int GetSelEnd() const ; | |
87 | int GetSelStart() const ; | |
88 | void SetSelection(int minPos, int maxPos); | |
89 | void SetThumbLength(int len) ; | |
90 | int GetThumbLength() const ; | |
91 | void SetTick(int tickPos) ; | |
92 | ||
409c9842 DW |
93 | // IMPLEMENTATION |
94 | WXHWND GetStaticMin() const { return m_staticMin; } | |
95 | WXHWND GetStaticMax() const { return m_staticMax; } | |
96 | WXHWND GetEditValue() const { return m_staticValue; } | |
97 | virtual bool ContainsHWND(WXHWND hWnd) const; | |
98 | ||
0e320a79 | 99 | void Command(wxCommandEvent& event); |
409c9842 DW |
100 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
101 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
102 | virtual bool OS2OnScroll(int orientation, WXWORD wParam, | |
103 | WXWORD pos, WXHWND control); | |
104 | ||
0e320a79 | 105 | protected: |
409c9842 DW |
106 | WXHWND m_staticMin; |
107 | WXHWND m_staticMax; | |
108 | WXHWND m_staticValue; | |
0e320a79 DW |
109 | int m_rangeMin; |
110 | int m_rangeMax; | |
111 | int m_pageSize; | |
112 | int m_lineSize; | |
113 | int m_tickFreq; | |
409c9842 DW |
114 | |
115 | virtual void DoSetSize(int x, int y, | |
116 | int width, int height, | |
117 | int sizeFlags = wxSIZE_AUTO); | |
0e320a79 DW |
118 | }; |
119 | ||
120 | #endif | |
121 | // _WX_SLIDER_H_ |