]>
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 | ||
0e320a79 | 17 | // Slider |
210a651b | 18 | class WXDLLEXPORT wxSlider: public wxSliderBase |
0e320a79 | 19 | { |
0e320a79 DW |
20 | public: |
21 | wxSlider(); | |
3c299c3a DW |
22 | inline wxSlider( wxWindow* pParent |
23 | ,wxWindowID vId | |
24 | ,int nValue | |
25 | ,int nMinValue | |
26 | ,int nMaxValue | |
27 | ,const wxPoint& rPos = wxDefaultPosition | |
28 | ,const wxSize& rSize = wxDefaultSize | |
29 | ,long lStyle = wxSL_HORIZONTAL | |
57c4d796 | 30 | #if wxUSE_VALIDATORS |
3c299c3a | 31 | ,const wxValidator& rValidator = wxDefaultValidator |
57c4d796 | 32 | #endif |
3c299c3a DW |
33 | ,const wxString& rsName = wxSliderNameStr |
34 | ) | |
35 | { | |
36 | Create( pParent | |
37 | ,vId | |
38 | ,nValue | |
39 | ,nMinValue | |
40 | ,nMaxValue | |
41 | ,rPos | |
42 | ,rSize | |
43 | ,lStyle | |
57c4d796 | 44 | #if wxUSE_VALIDATORS |
3c299c3a | 45 | ,rValidator |
57c4d796 | 46 | #endif |
3c299c3a DW |
47 | ,rsName |
48 | ); | |
49 | } | |
50 | ~wxSlider(); | |
51 | ||
52 | bool Create( wxWindow* pParent | |
53 | ,wxWindowID vId | |
54 | ,int nValue | |
55 | ,int nMinValue | |
56 | ,int nMaxValue | |
57 | ,const wxPoint& rPos = wxDefaultPosition | |
58 | ,const wxSize& rSize = wxDefaultSize | |
59 | ,long lStyle = wxSL_HORIZONTAL | |
60 | #if wxUSE_VALIDATORS | |
61 | ,const wxValidator& rValidator = wxDefaultValidator | |
62 | #endif | |
63 | ,const wxString& rsName = wxSliderNameStr | |
64 | ); | |
65 | ||
66 | virtual int GetValue(void) const ; | |
67 | virtual void SetValue(int); | |
68 | ||
69 | void GetSize( int* pnX | |
70 | ,int* pnY | |
71 | ) const; | |
72 | void GetPosition( int* pnX | |
73 | ,int* pnY | |
74 | ) const ; | |
d697657f | 75 | bool Show(bool bShow = TRUE); |
3c299c3a DW |
76 | void SetRange( int nMinValue |
77 | ,int nMaxValue | |
78 | ); | |
79 | ||
80 | inline int GetMin(void) const { return m_nRangeMin; } | |
81 | inline int GetMax(void) const { return m_nRangeMax; } | |
82 | ||
83 | // | |
84 | // For trackbars only | |
85 | // | |
86 | void ClearSel(void); | |
87 | void ClearTicks(void); | |
88 | ||
89 | int GetLineSize(void) const; | |
90 | int GetPageSize(void) const ; | |
91 | int GetSelEnd(void) const; | |
92 | int GetSelStart(void) const; | |
93 | inline int GetTickFreq(void) const { return m_nTickFreq; } | |
94 | int GetThumbLength(void) const ; | |
95 | ||
96 | void SetLineSize(int nLineSize); | |
97 | void SetPageSize(int nPageSize); | |
98 | void SetSelection( int nMinPos | |
99 | ,int nMaxPos | |
100 | ); | |
101 | void SetThumbLength(int nLen) ; | |
102 | void SetTick(int ntickPos) ; | |
103 | void SetTickFreq( int n | |
104 | ,int nPos | |
105 | ); | |
106 | ||
107 | // | |
108 | // IMPLEMENTATION | |
109 | // | |
110 | inline WXHWND GetStaticMin(void) const { return m_hStaticMin; } | |
111 | inline WXHWND GetStaticMax(void) const { return m_hStaticMax; } | |
112 | inline WXHWND GetEditValue(void) const { return m_hStaticValue; } | |
113 | virtual bool ContainsHWND(WXHWND hWnd) const; | |
3a50d19c DW |
114 | void AdjustSubControls( int nX |
115 | ,int nY | |
116 | ,int nWidth | |
117 | ,int nHeight | |
118 | ,int nSizeFlags | |
119 | ); | |
120 | inline int GetSizeFlags(void) { return m_nSizeFlags; } | |
3c299c3a DW |
121 | void Command(wxCommandEvent& rEvent); |
122 | virtual WXHBRUSH OnCtlColor( WXHDC hDC | |
123 | ,WXHWND hWnd | |
124 | ,WXUINT uCtlColor | |
125 | ,WXUINT uMessage | |
126 | ,WXWPARAM wParam | |
127 | ,WXLPARAM lParam | |
128 | ); | |
129 | virtual bool OS2OnScroll( int nOrientation | |
130 | ,WXWORD wParam | |
131 | ,WXWORD wPos | |
132 | ,WXHWND hControl | |
133 | ); | |
134 | ||
135 | protected: | |
136 | WXHWND m_hStaticMin; | |
137 | WXHWND m_hStaticMax; | |
138 | WXHWND m_hStaticValue; | |
139 | int m_nRangeMin; | |
140 | int m_nRangeMax; | |
141 | int m_nPageSize; | |
142 | int m_nLineSize; | |
143 | int m_nTickFreq; | |
144 | double m_dPixelToRange; | |
145 | int m_nThumbLength; | |
3a50d19c | 146 | int m_nSizeFlags; |
3c299c3a | 147 | |
d697657f DW |
148 | virtual void DoGetSize( int* pnWidth |
149 | ,int* pnHeight | |
150 | ) const; | |
3c299c3a DW |
151 | virtual void DoSetSize( int nX |
152 | ,int nY | |
153 | ,int nWidth | |
154 | ,int nHeight | |
155 | ,int nSizeFlags = wxSIZE_AUTO | |
156 | ); | |
157 | private: | |
158 | DECLARE_DYNAMIC_CLASS(wxSlider) | |
159 | }; // end of CLASS wxSlider | |
0e320a79 DW |
160 | |
161 | #endif | |
162 | // _WX_SLIDER_H_ |