]>
Commit | Line | Data |
---|---|---|
780d37ac JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: slidrmsw.h | |
3 | // Purpose: wxSliderMSW class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc JS |
8 | // Copyright: (c) Julian Smart |
9 | // Licence: wxWindows licence | |
780d37ac JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _SLIDRMSW_H_ | |
13 | #define _SLIDRMSW_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "slidrmsw.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/control.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr; | |
22 | ||
23 | // Slider | |
24 | class WXDLLEXPORT wxSliderMSW: public wxControl | |
25 | { | |
26 | DECLARE_DYNAMIC_CLASS(wxSliderMSW) | |
27 | ||
28 | public: | |
29 | wxSliderMSW(void); | |
30 | ||
debe6624 JS |
31 | inline wxSliderMSW(wxWindow *parent, wxWindowID id, |
32 | int value, int minValue, int maxValue, | |
780d37ac JS |
33 | const wxPoint& pos = wxDefaultPosition, |
34 | const wxSize& size = wxDefaultSize, | |
debe6624 | 35 | long style = wxSL_HORIZONTAL, |
780d37ac JS |
36 | const wxValidator& validator = wxDefaultValidator, |
37 | const wxString& name = wxSliderNameStr) | |
38 | { | |
39 | Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name); | |
40 | } | |
41 | ||
42 | ~wxSliderMSW(void); | |
43 | ||
debe6624 JS |
44 | bool Create(wxWindow *parent, wxWindowID id, |
45 | int value, int minValue, int maxValue, | |
780d37ac JS |
46 | const wxPoint& pos = wxDefaultPosition, |
47 | const wxSize& size = wxDefaultSize, | |
debe6624 | 48 | long style = wxSL_HORIZONTAL, |
780d37ac JS |
49 | const wxValidator& validator = wxDefaultValidator, |
50 | const wxString& name = wxSliderNameStr); | |
51 | ||
52 | virtual int GetValue(void) const ; | |
debe6624 | 53 | virtual void SetValue(int); |
4fabb575 | 54 | |
780d37ac | 55 | void GetSize(int *x, int *y) const ; |
4fabb575 JS |
56 | wxSize GetSize() const { return wxWindow::GetSize(); } |
57 | ||
debe6624 | 58 | void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
4fabb575 JS |
59 | void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO) |
60 | { wxWindow::SetSize(rect, sizeFlags); } | |
61 | void SetSize(const wxSize& size) { wxWindow::SetSize(size); } | |
62 | ||
780d37ac | 63 | void GetPosition(int *x, int *y) const ; |
4fabb575 JS |
64 | wxPoint GetPosition() const { return wxWindow::GetPosition(); } |
65 | ||
debe6624 | 66 | bool Show(bool show); |
780d37ac | 67 | |
debe6624 | 68 | void SetRange(int minValue, int maxValue); |
780d37ac JS |
69 | |
70 | inline int GetMin(void) const { return m_rangeMin; } | |
71 | inline int GetMax(void) const { return m_rangeMax; } | |
72 | ||
73 | // For trackbars only | |
debe6624 | 74 | void SetTickFreq(int n, int pos); |
780d37ac | 75 | inline int GetTickFreq(void) const { return m_tickFreq; } |
debe6624 | 76 | void SetPageSize(int pageSize); |
780d37ac JS |
77 | int GetPageSize(void) const ; |
78 | void ClearSel(void) ; | |
79 | void ClearTicks(void) ; | |
debe6624 | 80 | void SetLineSize(int lineSize); |
780d37ac JS |
81 | int GetLineSize(void) const ; |
82 | int GetSelEnd(void) const ; | |
83 | int GetSelStart(void) const ; | |
debe6624 JS |
84 | void SetSelection(int minPos, int maxPos); |
85 | void SetThumbLength(int len) ; | |
780d37ac | 86 | int GetThumbLength(void) const ; |
debe6624 | 87 | void SetTick(int tickPos) ; |
780d37ac JS |
88 | |
89 | // IMPLEMENTATION | |
90 | inline WXHWND GetStaticMin() const { return m_staticMin; } | |
91 | inline WXHWND GetStaticMax() const { return m_staticMax; } | |
92 | inline WXHWND GetEditValue() const { return m_staticValue; } | |
93 | virtual bool ContainsHWND(WXHWND hWnd) const; | |
94 | ||
95 | // Backward compatibility: translate to familiar wxEVT_COMMAND_SLIDER_UPDATED | |
96 | #if WXWIN_COMPATIBILITY | |
97 | void OnScroll(wxScrollEvent& event); | |
98 | #endif | |
99 | ||
100 | void Command(wxCommandEvent& event); | |
debe6624 | 101 | virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, |
780d37ac | 102 | WXUINT message, WXWPARAM wParam, WXLPARAM lParam); |
debe6624 JS |
103 | void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control); |
104 | void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control); | |
780d37ac JS |
105 | |
106 | protected: | |
107 | WXHWND m_staticMin; | |
108 | WXHWND m_staticMax; | |
109 | WXHWND m_staticValue; | |
110 | int m_rangeMin; | |
111 | int m_rangeMax; | |
112 | int m_pageSize; | |
113 | int m_lineSize; | |
114 | int m_tickFreq; | |
115 | DECLARE_EVENT_TABLE() | |
116 | }; | |
117 | ||
118 | #endif | |
119 | // _SLIDRMSW_H_ |