]> git.saurik.com Git - wxWidgets.git/blame - include/wx/slider.h
Fix up NSSlider code to not use class posing and instantiate the proper type (now...
[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
34#define wxSL_LABELS 0x0020
916f434d 35#define wxSL_LEFT 0x0040
86745a19 36#define wxSL_TOP 0x0080
916f434d 37#define wxSL_RIGHT 0x0100
86745a19 38#define wxSL_BOTTOM 0x0200
86745a19
VZ
39#define wxSL_BOTH 0x0400
40#define wxSL_SELRANGE 0x0800
41#define wxSL_INVERSE 0x1000
42
40ff126a
WS
43#if WXWIN_COMPATIBILITY_2_6
44 // obsolete
45 #define wxSL_NOTIFY_DRAG 0x0000
46#endif // WXWIN_COMPATIBILITY_2_6
86745a19 47
63ec432b 48extern WXDLLEXPORT_DATA(const wxChar) wxSliderNameStr[];
1e6feb95
VZ
49
50// ----------------------------------------------------------------------------
51// wxSliderBase: define wxSlider interface
52// ----------------------------------------------------------------------------
53
54class WXDLLEXPORT wxSliderBase : public wxControl
55{
56public:
57 /* the ctor of the derived class should have the following form:
58
59 wxSlider(wxWindow *parent,
60 wxWindowID id,
61 int value, int minValue, int maxValue,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
64 long style = wxSL_HORIZONTAL,
65 const wxValidator& validator = wxDefaultValidator,
66 const wxString& name = wxSliderNameStr);
67 */
fc7a2a60 68 wxSliderBase() { }
1e6feb95
VZ
69
70 // get/set the current slider value (should be in range)
71 virtual int GetValue() const = 0;
72 virtual void SetValue(int value) = 0;
73
74 // retrieve/change the range
75 virtual void SetRange(int minValue, int maxValue) = 0;
76 virtual int GetMin() const = 0;
77 virtual int GetMax() const = 0;
a06bb527
SC
78 void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; }
79 void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; }
1e6feb95
VZ
80
81 // the line/page size is the increment by which the slider moves when
82 // cursor arrow key/page up or down are pressed (clicking the mouse is like
83 // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
84 virtual void SetLineSize(int lineSize) = 0;
85 virtual void SetPageSize(int pageSize) = 0;
86 virtual int GetLineSize() const = 0;
87 virtual int GetPageSize() const = 0;
88
89 // these methods get/set the length of the slider pointer in pixels
90 virtual void SetThumbLength(int lenPixels) = 0;
91 virtual int GetThumbLength() const = 0;
92
93 // warning: most of subsequent methods are currently only implemented in
94 // wxMSW under Win95 and are silently ignored on other platforms
95
96 virtual void SetTickFreq(int WXUNUSED(n), int WXUNUSED(pos)) { }
97 virtual int GetTickFreq() const { return 0; }
98 virtual void ClearTicks() { }
99 virtual void SetTick(int WXUNUSED(tickPos)) { }
100
101 virtual void ClearSel() { }
102 virtual int GetSelEnd() const { return GetMin(); }
103 virtual int GetSelStart() const { return GetMax(); }
104 virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { }
fc7a2a60 105
01526d4f
WS
106protected:
107
108 // adjust value according to wxSL_INVERSE style
109 virtual int ValueInvertOrNot(int value) const
110 {
111 if (HasFlag(wxSL_INVERSE))
112 return (GetMax() + GetMin()) - value;
113 else
114 return value;
115 }
bd507486 116
fc7a2a60
VZ
117private:
118 DECLARE_NO_COPY_CLASS(wxSliderBase)
1e6feb95
VZ
119};
120
121// ----------------------------------------------------------------------------
122// include the real class declaration
123// ----------------------------------------------------------------------------
124
125#if defined(__WXUNIVERSAL__)
126 #include "wx/univ/slider.h"
127#elif defined(__WXMSW__)
5c2e9376 128 #include "wx/msw/slider95.h"
2049ba38 129#elif defined(__WXMOTIF__)
1e6feb95 130 #include "wx/motif/slider.h"
1be7a35c 131#elif defined(__WXGTK20__)
1e6feb95 132 #include "wx/gtk/slider.h"
1be7a35c
MR
133#elif defined(__WXGTK__)
134 #include "wx/gtk1/slider.h"
34138703 135#elif defined(__WXMAC__)
1e6feb95 136 #include "wx/mac/slider.h"
746aa166
DE
137#elif defined(__WXCOCOA__)
138 #include "wx/cocoa/slider.h"
1777b9bb 139#elif defined(__WXPM__)
1e6feb95 140 #include "wx/os2/slider.h"
bdb54365
WS
141#elif defined(__WXPALMOS__)
142 #include "wx/palmos/slider.h"
c801d85f
KB
143#endif
144
1e6feb95
VZ
145#endif // wxUSE_SLIDER
146
c801d85f 147#endif
34138703 148 // _WX_SLIDER_H_BASE_