]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/slider.h
remove SetBackgroundStyle call from OnInternalIdle, it should be done from realize...
[wxWidgets.git] / include / wx / msw / slider.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/slider.h
3 // Purpose: wxSlider class implementation using trackbar control
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_SLIDER_H_
13 #define _WX_SLIDER_H_
14
15 class WXDLLIMPEXP_FWD_CORE wxSubwindows;
16
17 // Slider
18 class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase
19 {
20 public:
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)
33 {
34 Init();
35
36 (void)Create(parent, id, value, minValue, maxValue,
37 pos, size, style, validator, name);
38 }
39
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);
49
50 virtual ~wxSlider();
51
52 // slider methods
53 virtual int GetValue() const;
54 virtual void SetValue(int);
55
56 void SetRange(int minValue, int maxValue);
57
58 int GetMin() const { return m_rangeMin; }
59 int GetMax() const { return m_rangeMax; }
60
61 // Win32-specific slider methods
62 int GetTickFreq() const { return m_tickFreq; }
63 void SetPageSize(int pageSize);
64 int GetPageSize() const;
65 void ClearSel();
66 void ClearTicks();
67 void SetLineSize(int lineSize);
68 int GetLineSize() const;
69 int GetSelEnd() const;
70 int GetSelStart() const;
71 void SetSelection(int minPos, int maxPos);
72 void SetThumbLength(int len);
73 int GetThumbLength() const;
74 void SetTick(int tickPos);
75
76 // implementation only from now on
77 WXHWND GetStaticMin() const;
78 WXHWND GetStaticMax() const;
79 WXHWND GetEditValue() const;
80 virtual bool ContainsHWND(WXHWND hWnd) const;
81
82 // we should let background show through the slider (and its labels)
83 virtual bool HasTransparentBackground() { return true; }
84
85 // returns true if the platform should explicitly apply a theme border
86 virtual bool CanApplyThemeBorder() const { return false; }
87
88 void Command(wxCommandEvent& event);
89 virtual bool MSWOnScroll(int orientation, WXWORD wParam,
90 WXWORD pos, WXHWND control);
91
92 virtual bool Show(bool show = true);
93 virtual bool Enable(bool show = true);
94 virtual bool SetFont(const wxFont& font);
95
96 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
97
98 protected:
99 // common part of all ctors
100 void Init();
101
102 // format an integer value as string
103 static wxString Format(int n) { return wxString::Format(wxT("%d"), n); }
104
105 // get the boundig box for the slider and possible labels
106 wxRect GetBoundingBox() const;
107
108 // Get the height and, if the pointers are non NULL, widths of both labels.
109 //
110 // Notice that the return value will be 0 if we don't have wxSL_LABELS
111 // style but we do fill widthMin and widthMax even if we don't have
112 // wxSL_MIN_MAX_LABELS style set so the caller should account for it.
113 int GetLabelsSize(int *widthMin = NULL, int *widthMax = NULL) const;
114
115
116 // overridden base class virtuals
117 virtual void DoGetPosition(int *x, int *y) const;
118 virtual void DoGetSize(int *width, int *height) const;
119 virtual void DoMoveWindow(int x, int y, int width, int height);
120 virtual wxSize DoGetBestSize() const;
121
122 // the labels windows, if any
123 wxSubwindows *m_labels;
124
125 int m_rangeMin;
126 int m_rangeMax;
127 int m_pageSize;
128 int m_lineSize;
129 int m_tickFreq;
130
131 // flag needed to detect whether we're getting THUMBRELEASE event because
132 // of dragging the thumb or scrolling the mouse wheel
133 bool m_isDragging;
134
135 // Platform-specific implementation of SetTickFreq
136 virtual void DoSetTickFreq(int freq);
137
138 DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider)
139 };
140
141 #endif // _WX_SLIDER_H_
142