]> git.saurik.com Git - wxWidgets.git/blame - include/wx/slider.h
doing WakeUp in osx_carbon differently for the main event as well
[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
7// RCS-ID: $Id$
99d80019 8// Copyright: (c) 1996-2001 Vadim Zeitlin
65571936 9// Licence: wxWindows licence
1e6feb95
VZ
10///////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_SLIDER_H_BASE_
13#define _WX_SLIDER_H_BASE_
c801d85f 14
1e6feb95
VZ
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19#include "wx/defs.h"
20
21#if wxUSE_SLIDER
22
23#include "wx/control.h"
24
86745a19
VZ
25// ----------------------------------------------------------------------------
26// wxSlider flags
27// ----------------------------------------------------------------------------
28
29#define wxSL_HORIZONTAL wxHORIZONTAL /* 0x0004 */
30#define wxSL_VERTICAL wxVERTICAL /* 0x0008 */
31
32#define wxSL_TICKS 0x0010
33#define wxSL_AUTOTICKS wxSL_TICKS // we don't support manual ticks
916f434d 34#define wxSL_LEFT 0x0040
86745a19 35#define wxSL_TOP 0x0080
916f434d 36#define wxSL_RIGHT 0x0100
86745a19 37#define wxSL_BOTTOM 0x0200
86745a19
VZ
38#define wxSL_BOTH 0x0400
39#define wxSL_SELRANGE 0x0800
40#define wxSL_INVERSE 0x1000
8e4a1326 41#define wxSL_MIN_MAX_LABELS 0x2000
cf54980e 42#define wxSL_VALUE_LABEL 0x4000
e0989408 43#define wxSL_LABELS (wxSL_MIN_MAX_LABELS|wxSL_VALUE_LABEL)
86745a19 44
40ff126a
WS
45#if WXWIN_COMPATIBILITY_2_6
46 // obsolete
47 #define wxSL_NOTIFY_DRAG 0x0000
48#endif // WXWIN_COMPATIBILITY_2_6
86745a19 49
53a2db12 50extern WXDLLIMPEXP_DATA_CORE(const char) wxSliderNameStr[];
1e6feb95
VZ
51
52// ----------------------------------------------------------------------------
53// wxSliderBase: define wxSlider interface
54// ----------------------------------------------------------------------------
55
53a2db12 56class WXDLLIMPEXP_CORE wxSliderBase : public wxControl
1e6feb95
VZ
57{
58public:
59 /* the ctor of the derived class should have the following form:
60
61 wxSlider(wxWindow *parent,
62 wxWindowID id,
63 int value, int minValue, int maxValue,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
66 long style = wxSL_HORIZONTAL,
67 const wxValidator& validator = wxDefaultValidator,
68 const wxString& name = wxSliderNameStr);
69 */
fc7a2a60 70 wxSliderBase() { }
1e6feb95
VZ
71
72 // get/set the current slider value (should be in range)
73 virtual int GetValue() const = 0;
74 virtual void SetValue(int value) = 0;
75
76 // retrieve/change the range
77 virtual void SetRange(int minValue, int maxValue) = 0;
78 virtual int GetMin() const = 0;
79 virtual int GetMax() const = 0;
a06bb527
SC
80 void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; }
81 void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; }
1e6feb95
VZ
82
83 // the line/page size is the increment by which the slider moves when
84 // cursor arrow key/page up or down are pressed (clicking the mouse is like
85 // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
86 virtual void SetLineSize(int lineSize) = 0;
87 virtual void SetPageSize(int pageSize) = 0;
88 virtual int GetLineSize() const = 0;
89 virtual int GetPageSize() const = 0;
90
91 // these methods get/set the length of the slider pointer in pixels
92 virtual void SetThumbLength(int lenPixels) = 0;
93 virtual int GetThumbLength() const = 0;
94
95 // warning: most of subsequent methods are currently only implemented in
96 // wxMSW under Win95 and are silently ignored on other platforms
97
0a12e013 98 void SetTickFreq(int freq) { DoSetTickFreq(freq); }
1e6feb95
VZ
99 virtual int GetTickFreq() const { return 0; }
100 virtual void ClearTicks() { }
101 virtual void SetTick(int WXUNUSED(tickPos)) { }
102
103 virtual void ClearSel() { }
104 virtual int GetSelEnd() const { return GetMin(); }
105 virtual int GetSelStart() const { return GetMax(); }
106 virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { }
fc7a2a60 107
0a12e013
VZ
108#ifdef WXWIN_COMPATIBILITY_2_8
109 wxDEPRECATED_INLINE( void SetTickFreq(int freq, int), DoSetTickFreq(freq); )
110#endif
111
01526d4f 112protected:
0a12e013
VZ
113 // Platform-specific implementation of SetTickFreq
114 virtual void DoSetTickFreq(int WXUNUSED(freq)) { /* unsupported by default */ }
01526d4f 115
dc797d8e
JS
116 // choose the default border for this window
117 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
118
01526d4f
WS
119 // adjust value according to wxSL_INVERSE style
120 virtual int ValueInvertOrNot(int value) const
121 {
122 if (HasFlag(wxSL_INVERSE))
123 return (GetMax() + GetMin()) - value;
124 else
125 return value;
126 }
bd507486 127
fc7a2a60 128private:
c0c133e1 129 wxDECLARE_NO_COPY_CLASS(wxSliderBase);
1e6feb95
VZ
130};
131
132// ----------------------------------------------------------------------------
133// include the real class declaration
134// ----------------------------------------------------------------------------
135
136#if defined(__WXUNIVERSAL__)
137 #include "wx/univ/slider.h"
138#elif defined(__WXMSW__)
936f6353 139 #include "wx/msw/slider.h"
2049ba38 140#elif defined(__WXMOTIF__)
1e6feb95 141 #include "wx/motif/slider.h"
1be7a35c 142#elif defined(__WXGTK20__)
1e6feb95 143 #include "wx/gtk/slider.h"
1be7a35c
MR
144#elif defined(__WXGTK__)
145 #include "wx/gtk1/slider.h"
34138703 146#elif defined(__WXMAC__)
ef0e9220 147 #include "wx/osx/slider.h"
746aa166
DE
148#elif defined(__WXCOCOA__)
149 #include "wx/cocoa/slider.h"
1777b9bb 150#elif defined(__WXPM__)
1e6feb95 151 #include "wx/os2/slider.h"
bdb54365
WS
152#elif defined(__WXPALMOS__)
153 #include "wx/palmos/slider.h"
c801d85f
KB
154#endif
155
1e6feb95
VZ
156#endif // wxUSE_SLIDER
157
c801d85f 158#endif
34138703 159 // _WX_SLIDER_H_BASE_