1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/slider.h
3 // Purpose: wxSlider class implementation using trackbar control
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
14 class WXDLLIMPEXP_FWD_CORE wxSubwindows
;
17 class WXDLLIMPEXP_CORE wxSlider
: public wxSliderBase
20 wxSlider() { Init(); }
22 wxSlider(wxWindow
*parent
,
27 const wxPoint
& pos
= wxDefaultPosition
,
28 const wxSize
& size
= wxDefaultSize
,
29 long style
= wxSL_HORIZONTAL
,
30 const wxValidator
& validator
= wxDefaultValidator
,
31 const wxString
& name
= wxSliderNameStr
)
35 (void)Create(parent
, id
, value
, minValue
, maxValue
,
36 pos
, size
, style
, validator
, name
);
39 bool Create(wxWindow
*parent
,
42 int minValue
, int maxValue
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
45 long style
= wxSL_HORIZONTAL
,
46 const wxValidator
& validator
= wxDefaultValidator
,
47 const wxString
& name
= wxSliderNameStr
);
52 virtual int GetValue() const;
53 virtual void SetValue(int);
55 void SetRange(int minValue
, int maxValue
);
57 int GetMin() const { return m_rangeMin
; }
58 int GetMax() const { return m_rangeMax
; }
60 // Win32-specific slider methods
61 int GetTickFreq() const { return m_tickFreq
; }
62 void SetPageSize(int pageSize
);
63 int GetPageSize() const;
66 void SetLineSize(int lineSize
);
67 int GetLineSize() const;
68 int GetSelEnd() const;
69 int GetSelStart() const;
70 void SetSelection(int minPos
, int maxPos
);
71 void SetThumbLength(int len
);
72 int GetThumbLength() const;
73 void SetTick(int tickPos
);
75 // implementation only from now on
76 WXHWND
GetStaticMin() const;
77 WXHWND
GetStaticMax() const;
78 WXHWND
GetEditValue() const;
79 virtual bool ContainsHWND(WXHWND hWnd
) const;
81 // we should let background show through the slider (and its labels)
82 virtual bool HasTransparentBackground() { return true; }
84 // returns true if the platform should explicitly apply a theme border
85 virtual bool CanApplyThemeBorder() const { return false; }
87 void Command(wxCommandEvent
& event
);
88 virtual bool MSWOnScroll(int orientation
, WXWORD wParam
,
89 WXWORD pos
, WXHWND control
);
91 virtual bool Show(bool show
= true);
92 virtual bool Enable(bool show
= true);
93 virtual bool SetFont(const wxFont
& font
);
95 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const;
98 // common part of all ctors
101 // format an integer value as string
102 static wxString
Format(int n
) { return wxString::Format(wxT("%d"), n
); }
104 // get the boundig box for the slider and possible labels
105 wxRect
GetBoundingBox() const;
107 // Get the height and, if the pointers are non NULL, widths of both labels.
109 // Notice that the return value will be 0 if we don't have wxSL_LABELS
110 // style but we do fill widthMin and widthMax even if we don't have
111 // wxSL_MIN_MAX_LABELS style set so the caller should account for it.
112 int GetLabelsSize(int *widthMin
= NULL
, int *widthMax
= NULL
) const;
115 // overridden base class virtuals
116 virtual void DoGetPosition(int *x
, int *y
) const;
117 virtual void DoGetSize(int *width
, int *height
) const;
118 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
119 virtual wxSize
DoGetBestSize() const;
121 // the labels windows, if any
122 wxSubwindows
*m_labels
;
130 // flag needed to detect whether we're getting THUMBRELEASE event because
131 // of dragging the thumb or scrolling the mouse wheel
134 // Platform-specific implementation of SetTickFreq
135 virtual void DoSetTickFreq(int freq
);
137 DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider
)
140 #endif // _WX_SLIDER_H_