]>
Commit | Line | Data |
---|---|---|
780d37ac | 1 | ///////////////////////////////////////////////////////////////////////////// |
1e6feb95 | 2 | // Name: wx/msw/slider95.h |
7d0d80bd | 3 | // Purpose: wxSlider class, using the Win95 (and later) trackbar control |
780d37ac JS |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
780d37ac JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
6181cef5 VZ |
12 | #ifndef _WX_SLIDER95_H_ |
13 | #define _WX_SLIDER95_H_ | |
780d37ac | 14 | |
6181cef5 VZ |
15 | class WXDLLEXPORT wxSubwindows; |
16 | ||
780d37ac | 17 | // Slider |
7d0d80bd | 18 | class WXDLLEXPORT wxSlider : public wxSliderBase |
780d37ac | 19 | { |
780d37ac | 20 | public: |
7d0d80bd WS |
21 | wxSlider() { Init(); } |
22 | ||
23 | wxSlider(wxWindow *parent, | |
24 | wxWindowID id, | |
25 | int value, | |
26 | int minValue, | |
27 | int maxValue, | |
28 | const wxPoint& pos = wxDefaultPosition, | |
29 | const wxSize& size = wxDefaultSize, | |
30 | long style = wxSL_HORIZONTAL, | |
31 | const wxValidator& validator = wxDefaultValidator, | |
32 | const wxString& name = wxSliderNameStr) | |
bfc6fde4 | 33 | { |
6181cef5 VZ |
34 | Init(); |
35 | ||
36 | (void)Create(parent, id, value, minValue, maxValue, | |
37 | pos, size, style, validator, name); | |
bfc6fde4 VZ |
38 | } |
39 | ||
6181cef5 VZ |
40 | bool Create(wxWindow *parent, |
41 | wxWindowID id, | |
42 | int value, | |
43 | int minValue, int maxValue, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | const wxSize& size = wxDefaultSize, | |
46 | long style = wxSL_HORIZONTAL, | |
47 | const wxValidator& validator = wxDefaultValidator, | |
48 | const wxString& name = wxSliderNameStr); | |
bfc6fde4 | 49 | |
7d0d80bd | 50 | virtual ~wxSlider(); |
bfc6fde4 | 51 | |
6181cef5 | 52 | // slider methods |
7f1cf28c | 53 | virtual int GetValue() const; |
bfc6fde4 VZ |
54 | virtual void SetValue(int); |
55 | ||
bfc6fde4 VZ |
56 | void SetRange(int minValue, int maxValue); |
57 | ||
58 | int GetMin() const { return m_rangeMin; } | |
59 | int GetMax() const { return m_rangeMax; } | |
60 | ||
6181cef5 | 61 | // Win32-specific slider methods |
bfc6fde4 VZ |
62 | void SetTickFreq(int n, int pos); |
63 | int GetTickFreq() const { return m_tickFreq; } | |
64 | void SetPageSize(int pageSize); | |
7f1cf28c VZ |
65 | int GetPageSize() const; |
66 | void ClearSel(); | |
67 | void ClearTicks(); | |
bfc6fde4 | 68 | void SetLineSize(int lineSize); |
7f1cf28c VZ |
69 | int GetLineSize() const; |
70 | int GetSelEnd() const; | |
71 | int GetSelStart() const; | |
bfc6fde4 | 72 | void SetSelection(int minPos, int maxPos); |
7f1cf28c VZ |
73 | void SetThumbLength(int len); |
74 | int GetThumbLength() const; | |
75 | void SetTick(int tickPos); | |
bfc6fde4 | 76 | |
6181cef5 VZ |
77 | // implementation only from now on |
78 | WXHWND GetStaticMin() const; | |
79 | WXHWND GetStaticMax() const; | |
80 | WXHWND GetEditValue() const; | |
bfc6fde4 VZ |
81 | virtual bool ContainsHWND(WXHWND hWnd) const; |
82 | ||
b808efdb VZ |
83 | // we should let background show through the slider (and its labels) |
84 | virtual bool HasTransparentBackground() { return true; } | |
85 | ||
86 | ||
bfc6fde4 | 87 | void Command(wxCommandEvent& event); |
a23fd0e1 VZ |
88 | virtual bool MSWOnScroll(int orientation, WXWORD wParam, |
89 | WXWORD pos, WXHWND control); | |
bfc6fde4 | 90 | |
042ce4cc VZ |
91 | virtual bool Show(bool show = true); |
92 | virtual bool Enable(bool show = true); | |
93 | virtual bool SetFont(const wxFont& font); | |
6181cef5 | 94 | |
6f02a879 VZ |
95 | virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const; |
96 | ||
bfc6fde4 | 97 | protected: |
6181cef5 VZ |
98 | // common part of all ctors |
99 | void Init(); | |
100 | ||
101 | // format an integer value as string | |
102 | static wxString Format(int n) { return wxString::Format(_T("%d"), n); } | |
103 | ||
104 | // get the boundig box for the slider and possible labels | |
105 | wxRect GetBoundingBox() const; | |
106 | ||
107 | // get the height and, if the pointer is not NULL, width of our labels | |
108 | int GetLabelsSize(int *width = NULL) const; | |
109 | ||
110 | ||
111 | // overridden base class virtuals | |
042ce4cc | 112 | virtual void DoGetPosition(int *x, int *y) const; |
6181cef5 VZ |
113 | virtual void DoGetSize(int *width, int *height) const; |
114 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
115 | virtual wxSize DoGetBestSize() const; | |
116 | ||
117 | virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } | |
118 | ||
6181cef5 VZ |
119 | |
120 | // the labels windows, if any | |
121 | wxSubwindows *m_labels; | |
122 | ||
bfc6fde4 VZ |
123 | int m_rangeMin; |
124 | int m_rangeMax; | |
125 | int m_pageSize; | |
126 | int m_lineSize; | |
127 | int m_tickFreq; | |
128 | ||
3c96417a VZ |
129 | // flag needed to detect whether we're getting THUMBRELEASE event because |
130 | // of dragging the thumb or scrolling the mouse wheel | |
131 | bool m_isDragging; | |
57f4f925 | 132 | |
7d0d80bd | 133 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider) |
780d37ac JS |
134 | }; |
135 | ||
6181cef5 VZ |
136 | #endif // _WX_SLIDER95_H_ |
137 |