1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/slider.h
3 // Purpose: wxSlider class implementation using trackbar control
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 class WXDLLIMPEXP_FWD_CORE wxSubwindows
;
18 class WXDLLIMPEXP_CORE wxSlider
: public wxSliderBase
21 wxSlider() { Init(); }
23 wxSlider(wxWindow
*parent
,
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
)
36 (void)Create(parent
, id
, value
, minValue
, maxValue
,
37 pos
, size
, style
, validator
, name
);
40 bool Create(wxWindow
*parent
,
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
);
53 virtual int GetValue() const;
54 virtual void SetValue(int);
56 void SetRange(int minValue
, int maxValue
);
58 int GetMin() const { return m_rangeMin
; }
59 int GetMax() const { return m_rangeMax
; }
61 // Win32-specific slider methods
62 int GetTickFreq() const { return m_tickFreq
; }
63 void SetPageSize(int pageSize
);
64 int GetPageSize() const;
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
);
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;
82 // we should let background show through the slider (and its labels)
83 virtual bool HasTransparentBackground() { return true; }
85 // returns true if the platform should explicitly apply a theme border
86 virtual bool CanApplyThemeBorder() const { return false; }
88 void Command(wxCommandEvent
& event
);
89 virtual bool MSWOnScroll(int orientation
, WXWORD wParam
,
90 WXWORD pos
, WXHWND control
);
92 virtual bool Show(bool show
= true);
93 virtual bool Enable(bool show
= true);
94 virtual bool SetFont(const wxFont
& font
);
96 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const;
99 // common part of all ctors
102 // format an integer value as string
103 static wxString
Format(int n
) { return wxString::Format(wxT("%d"), n
); }
105 // get the boundig box for the slider and possible labels
106 wxRect
GetBoundingBox() const;
108 // Get the height and, if the pointers are non NULL, widths of both labels.
109 int GetLabelsSize(int *widthMin
= NULL
, int *widthMax
= NULL
) const;
112 // overridden base class virtuals
113 virtual void DoGetPosition(int *x
, int *y
) const;
114 virtual void DoGetSize(int *width
, int *height
) const;
115 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
116 virtual wxSize
DoGetBestSize() const;
118 // the labels windows, if any
119 wxSubwindows
*m_labels
;
127 // flag needed to detect whether we're getting THUMBRELEASE event because
128 // of dragging the thumb or scrolling the mouse wheel
131 // Platform-specific implementation of SetTickFreq
132 virtual void DoSetTickFreq(int freq
);
134 DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider
)
137 #endif // _WX_SLIDER_H_