]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: slider.h | |
3 | // Purpose: wxSlider class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/15/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) David Webster | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_SLIDER_H_ | |
13 | #define _WX_SLIDER_H_ | |
14 | ||
15 | #include "wx/control.h" | |
16 | ||
17 | // Slider | |
18 | class WXDLLEXPORT wxSlider: public wxSliderBase | |
19 | { | |
20 | public: | |
21 | wxSlider(); | |
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 | |
30 | #if wxUSE_VALIDATORS | |
31 | ,const wxValidator& rValidator = wxDefaultValidator | |
32 | #endif | |
33 | ,const wxString& rsName = wxSliderNameStr | |
34 | ) | |
35 | { | |
36 | Create( pParent | |
37 | ,vId | |
38 | ,nValue | |
39 | ,nMinValue | |
40 | ,nMaxValue | |
41 | ,rPos | |
42 | ,rSize | |
43 | ,lStyle | |
44 | #if wxUSE_VALIDATORS | |
45 | ,rValidator | |
46 | #endif | |
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 ; | |
75 | bool Show(bool bShow); | |
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; | |
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; } | |
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; | |
146 | int m_nSizeFlags; | |
147 | ||
148 | virtual void DoSetSize( int nX | |
149 | ,int nY | |
150 | ,int nWidth | |
151 | ,int nHeight | |
152 | ,int nSizeFlags = wxSIZE_AUTO | |
153 | ); | |
154 | private: | |
155 | DECLARE_DYNAMIC_CLASS(wxSlider) | |
156 | }; // end of CLASS wxSlider | |
157 | ||
158 | #endif | |
159 | // _WX_SLIDER_H_ |