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