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