]>
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, | |
32 | const wxValidator& validator = wxDefaultValidator, | |
33 | const wxString& name = wxSliderNameStr) | |
34 | { | |
35 | Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); | |
36 | } | |
37 | ||
38 | ~wxSlider(); | |
39 | ||
40 | bool Create(wxWindow *parent, wxWindowID id, | |
41 | int value, int minValue, int maxValue, | |
42 | const wxPoint& pos = wxDefaultPosition, | |
43 | const wxSize& size = wxDefaultSize, | |
44 | long style = wxSL_HORIZONTAL, | |
45 | const wxValidator& validator = wxDefaultValidator, | |
46 | const wxString& name = wxSliderNameStr); | |
47 | ||
48 | virtual int GetValue() const ; | |
49 | virtual void SetValue(int); | |
409c9842 | 50 | |
0e320a79 | 51 | void GetSize(int *x, int *y) const ; |
0e320a79 | 52 | void GetPosition(int *x, int *y) const ; |
409c9842 | 53 | |
0e320a79 DW |
54 | bool Show(bool show); |
55 | ||
56 | void SetRange(int minValue, int maxValue); | |
57 | ||
58 | inline int GetMin() const { return m_rangeMin; } | |
59 | inline int GetMax() const { return m_rangeMax; } | |
60 | ||
409c9842 DW |
61 | void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
62 | ||
63 | ||
64 | ||
0e320a79 DW |
65 | // For trackbars only |
66 | void SetTickFreq(int n, int pos); | |
67 | inline int GetTickFreq() const { return m_tickFreq; } | |
68 | void SetPageSize(int pageSize); | |
69 | int GetPageSize() const ; | |
70 | void ClearSel() ; | |
71 | void ClearTicks() ; | |
72 | void SetLineSize(int lineSize); | |
73 | int GetLineSize() const ; | |
74 | int GetSelEnd() const ; | |
75 | int GetSelStart() const ; | |
76 | void SetSelection(int minPos, int maxPos); | |
77 | void SetThumbLength(int len) ; | |
78 | int GetThumbLength() const ; | |
79 | void SetTick(int tickPos) ; | |
80 | ||
409c9842 DW |
81 | // IMPLEMENTATION |
82 | WXHWND GetStaticMin() const { return m_staticMin; } | |
83 | WXHWND GetStaticMax() const { return m_staticMax; } | |
84 | WXHWND GetEditValue() const { return m_staticValue; } | |
85 | virtual bool ContainsHWND(WXHWND hWnd) const; | |
86 | ||
0e320a79 | 87 | void Command(wxCommandEvent& event); |
409c9842 DW |
88 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
89 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
90 | virtual bool OS2OnScroll(int orientation, WXWORD wParam, | |
91 | WXWORD pos, WXHWND control); | |
92 | ||
0e320a79 | 93 | protected: |
409c9842 DW |
94 | WXHWND m_staticMin; |
95 | WXHWND m_staticMax; | |
96 | WXHWND m_staticValue; | |
0e320a79 DW |
97 | int m_rangeMin; |
98 | int m_rangeMax; | |
99 | int m_pageSize; | |
100 | int m_lineSize; | |
101 | int m_tickFreq; | |
409c9842 DW |
102 | |
103 | virtual void DoSetSize(int x, int y, | |
104 | int width, int height, | |
105 | int sizeFlags = wxSIZE_AUTO); | |
0e320a79 DW |
106 | }; |
107 | ||
108 | #endif | |
109 | // _WX_SLIDER_H_ |