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