]> git.saurik.com Git - wxWidgets.git/blame - include/wx/slider.h
Applied #15226 wxRichTextCtrl: Implement setting properties with undo for objects...
[wxWidgets.git] / include / wx / slider.h
CommitLineData
1e6feb95
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/slider.h
3// Purpose: wxSlider interface
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 09.02.01
99d80019 7// Copyright: (c) 1996-2001 Vadim Zeitlin
65571936 8// Licence: wxWindows licence
1e6feb95
VZ
9///////////////////////////////////////////////////////////////////////////////
10
34138703
JS
11#ifndef _WX_SLIDER_H_BASE_
12#define _WX_SLIDER_H_BASE_
c801d85f 13
1e6feb95
VZ
14// ----------------------------------------------------------------------------
15// headers
16// ----------------------------------------------------------------------------
17
18#include "wx/defs.h"
19
20#if wxUSE_SLIDER
21
22#include "wx/control.h"
23
86745a19
VZ
24// ----------------------------------------------------------------------------
25// wxSlider flags
26// ----------------------------------------------------------------------------
27
28#define wxSL_HORIZONTAL wxHORIZONTAL /* 0x0004 */
29#define wxSL_VERTICAL wxVERTICAL /* 0x0008 */
30
31#define wxSL_TICKS 0x0010
32#define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks
916f434d 33#define wxSL_LEFT 0x0040
86745a19 34#define wxSL_TOP 0x0080
916f434d 35#define wxSL_RIGHT 0x0100
86745a19 36#define wxSL_BOTTOM 0x0200
86745a19
VZ
37#define wxSL_BOTH 0x0400
38#define wxSL_SELRANGE 0x0800
39#define wxSL_INVERSE 0x1000
8e4a1326 40#define wxSL_MIN_MAX_LABELS 0x2000
cf54980e 41#define wxSL_VALUE_LABEL 0x4000
e0989408 42#define wxSL_LABELS (wxSL_MIN_MAX_LABELS|wxSL_VALUE_LABEL)
86745a19 43
40ff126a
WS
44#if WXWIN_COMPATIBILITY_2_6
45 // obsolete
46 #define wxSL_NOTIFY_DRAG 0x0000
47#endif // WXWIN_COMPATIBILITY_2_6
86745a19 48
53a2db12 49extern WXDLLIMPEXP_DATA_CORE(const char) wxSliderNameStr[];
1e6feb95
VZ
50
51// ----------------------------------------------------------------------------
52// wxSliderBase: define wxSlider interface
53// ----------------------------------------------------------------------------
54
53a2db12 55class WXDLLIMPEXP_CORE wxSliderBase : public wxControl
1e6feb95
VZ
56{
57public:
58 /* the ctor of the derived class should have the following form:
59
60 wxSlider(wxWindow *parent,
61 wxWindowID id,
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);
68 */
fc7a2a60 69 wxSliderBase() { }
1e6feb95
VZ
70
71 // get/set the current slider value (should be in range)
72 virtual int GetValue() const = 0;
73 virtual void SetValue(int value) = 0;
74
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;
a06bb527
SC
79 void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; }
80 void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; }
1e6feb95
VZ
81
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;
89
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;
93
94 // warning: most of subsequent methods are currently only implemented in
95 // wxMSW under Win95 and are silently ignored on other platforms
96
0a12e013 97 void SetTickFreq(int freq) { DoSetTickFreq(freq); }
1e6feb95
VZ
98 virtual int GetTickFreq() const { return 0; }
99 virtual void ClearTicks() { }
100 virtual void SetTick(int WXUNUSED(tickPos)) { }
101
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)) { }
fc7a2a60 106
7bc57fd9 107#if WXWIN_COMPATIBILITY_2_8
0a12e013
VZ
108 wxDEPRECATED_INLINE( void SetTickFreq(int freq, int), DoSetTickFreq(freq); )
109#endif
110
01526d4f 111protected:
0a12e013
VZ
112 // Platform-specific implementation of SetTickFreq
113 virtual void DoSetTickFreq(int WXUNUSED(freq)) { /* unsupported by default */ }
01526d4f 114
dc797d8e
JS
115 // choose the default border for this window
116 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
117
01526d4f
WS
118 // adjust value according to wxSL_INVERSE style
119 virtual int ValueInvertOrNot(int value) const
120 {
121 if (HasFlag(wxSL_INVERSE))
122 return (GetMax() + GetMin()) - value;
123 else
124 return value;
125 }
bd507486 126
fc7a2a60 127private:
c0c133e1 128 wxDECLARE_NO_COPY_CLASS(wxSliderBase);
1e6feb95
VZ
129};
130
131// ----------------------------------------------------------------------------
132// include the real class declaration
133// ----------------------------------------------------------------------------
134
135#if defined(__WXUNIVERSAL__)
136 #include "wx/univ/slider.h"
137#elif defined(__WXMSW__)
936f6353 138 #include "wx/msw/slider.h"
2049ba38 139#elif defined(__WXMOTIF__)
1e6feb95 140 #include "wx/motif/slider.h"
1be7a35c 141#elif defined(__WXGTK20__)
1e6feb95 142 #include "wx/gtk/slider.h"
1be7a35c
MR
143#elif defined(__WXGTK__)
144 #include "wx/gtk1/slider.h"
34138703 145#elif defined(__WXMAC__)
ef0e9220 146 #include "wx/osx/slider.h"
746aa166
DE
147#elif defined(__WXCOCOA__)
148 #include "wx/cocoa/slider.h"
1777b9bb 149#elif defined(__WXPM__)
1e6feb95 150 #include "wx/os2/slider.h"
c801d85f
KB
151#endif
152
1e6feb95
VZ
153#endif // wxUSE_SLIDER
154
c801d85f 155#endif
34138703 156 // _WX_SLIDER_H_BASE_