1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSlider interface
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 1996-2001 Vadim Zeitlin
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_SLIDER_H_BASE_
12 #define _WX_SLIDER_H_BASE_
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
22 #include "wx/control.h"
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 #define wxSL_HORIZONTAL wxHORIZONTAL /* 0x0004 */
29 #define wxSL_VERTICAL wxVERTICAL /* 0x0008 */
31 #define wxSL_TICKS 0x0010
32 #define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks
33 #define wxSL_LEFT 0x0040
34 #define wxSL_TOP 0x0080
35 #define wxSL_RIGHT 0x0100
36 #define wxSL_BOTTOM 0x0200
37 #define wxSL_BOTH 0x0400
38 #define wxSL_SELRANGE 0x0800
39 #define wxSL_INVERSE 0x1000
40 #define wxSL_MIN_MAX_LABELS 0x2000
41 #define wxSL_VALUE_LABEL 0x4000
42 #define wxSL_LABELS (wxSL_MIN_MAX_LABELS|wxSL_VALUE_LABEL)
44 #if WXWIN_COMPATIBILITY_2_6
46 #define wxSL_NOTIFY_DRAG 0x0000
47 #endif // WXWIN_COMPATIBILITY_2_6
49 extern WXDLLIMPEXP_DATA_CORE(const char) wxSliderNameStr
[];
51 // ----------------------------------------------------------------------------
52 // wxSliderBase: define wxSlider interface
53 // ----------------------------------------------------------------------------
55 class WXDLLIMPEXP_CORE wxSliderBase
: public wxControl
58 /* the ctor of the derived class should have the following form:
60 wxSlider(wxWindow *parent,
62 int value, int minValue, int maxValue,
63 const wxPoint& pos = wxDefaultPosition,
64 const wxSize& size = wxDefaultSize,
65 long style = wxSL_HORIZONTAL,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxSliderNameStr);
71 // get/set the current slider value (should be in range)
72 virtual int GetValue() const = 0;
73 virtual void SetValue(int value
) = 0;
75 // retrieve/change the range
76 virtual void SetRange(int minValue
, int maxValue
) = 0;
77 virtual int GetMin() const = 0;
78 virtual int GetMax() const = 0;
79 void SetMin( int minValue
) { SetRange( minValue
, GetMax() ) ; }
80 void SetMax( int maxValue
) { SetRange( GetMin() , maxValue
) ; }
82 // the line/page size is the increment by which the slider moves when
83 // cursor arrow key/page up or down are pressed (clicking the mouse is like
84 // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
85 virtual void SetLineSize(int lineSize
) = 0;
86 virtual void SetPageSize(int pageSize
) = 0;
87 virtual int GetLineSize() const = 0;
88 virtual int GetPageSize() const = 0;
90 // these methods get/set the length of the slider pointer in pixels
91 virtual void SetThumbLength(int lenPixels
) = 0;
92 virtual int GetThumbLength() const = 0;
94 // warning: most of subsequent methods are currently only implemented in
95 // wxMSW under Win95 and are silently ignored on other platforms
97 void SetTickFreq(int freq
) { DoSetTickFreq(freq
); }
98 virtual int GetTickFreq() const { return 0; }
99 virtual void ClearTicks() { }
100 virtual void SetTick(int WXUNUSED(tickPos
)) { }
102 virtual void ClearSel() { }
103 virtual int GetSelEnd() const { return GetMin(); }
104 virtual int GetSelStart() const { return GetMax(); }
105 virtual void SetSelection(int WXUNUSED(min
), int WXUNUSED(max
)) { }
107 #if WXWIN_COMPATIBILITY_2_8
108 wxDEPRECATED_INLINE( void SetTickFreq(int freq
, int), DoSetTickFreq(freq
); )
112 // Platform-specific implementation of SetTickFreq
113 virtual void DoSetTickFreq(int WXUNUSED(freq
)) { /* unsupported by default */ }
115 // choose the default border for this window
116 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
118 // adjust value according to wxSL_INVERSE style
119 virtual int ValueInvertOrNot(int value
) const
121 if (HasFlag(wxSL_INVERSE
))
122 return (GetMax() + GetMin()) - value
;
128 wxDECLARE_NO_COPY_CLASS(wxSliderBase
);
131 // ----------------------------------------------------------------------------
132 // include the real class declaration
133 // ----------------------------------------------------------------------------
135 #if defined(__WXUNIVERSAL__)
136 #include "wx/univ/slider.h"
137 #elif defined(__WXMSW__)
138 #include "wx/msw/slider.h"
139 #elif defined(__WXMOTIF__)
140 #include "wx/motif/slider.h"
141 #elif defined(__WXGTK20__)
142 #include "wx/gtk/slider.h"
143 #elif defined(__WXGTK__)
144 #include "wx/gtk1/slider.h"
145 #elif defined(__WXMAC__)
146 #include "wx/osx/slider.h"
147 #elif defined(__WXCOCOA__)
148 #include "wx/cocoa/slider.h"
149 #elif defined(__WXPM__)
150 #include "wx/os2/slider.h"
153 #endif // wxUSE_SLIDER
156 // _WX_SLIDER_H_BASE_