]> git.saurik.com Git - wxWidgets.git/blame - include/wx/slider.h
oops, removed duplicate SetIcons[s]() added in last commit
[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$
77ffb593 8// Copyright: (c) 1996-2001 wxWidgets team
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
16cba29d 25extern WXDLLEXPORT_DATA(const wxChar*) wxSliderNameStr;
1e6feb95
VZ
26
27// ----------------------------------------------------------------------------
28// wxSliderBase: define wxSlider interface
29// ----------------------------------------------------------------------------
30
31class WXDLLEXPORT wxSliderBase : public wxControl
32{
33public:
34 /* the ctor of the derived class should have the following form:
35
36 wxSlider(wxWindow *parent,
37 wxWindowID id,
38 int value, int minValue, int maxValue,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = wxSL_HORIZONTAL,
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxSliderNameStr);
44 */
fc7a2a60 45 wxSliderBase() { }
1e6feb95
VZ
46
47 // get/set the current slider value (should be in range)
48 virtual int GetValue() const = 0;
49 virtual void SetValue(int value) = 0;
50
51 // retrieve/change the range
52 virtual void SetRange(int minValue, int maxValue) = 0;
53 virtual int GetMin() const = 0;
54 virtual int GetMax() const = 0;
a06bb527
SC
55 void SetMin( int minValue ) { SetRange( minValue , GetMax() ) ; }
56 void SetMax( int maxValue ) { SetRange( GetMin() , maxValue ) ; }
1e6feb95
VZ
57
58 // the line/page size is the increment by which the slider moves when
59 // cursor arrow key/page up or down are pressed (clicking the mouse is like
60 // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
61 virtual void SetLineSize(int lineSize) = 0;
62 virtual void SetPageSize(int pageSize) = 0;
63 virtual int GetLineSize() const = 0;
64 virtual int GetPageSize() const = 0;
65
66 // these methods get/set the length of the slider pointer in pixels
67 virtual void SetThumbLength(int lenPixels) = 0;
68 virtual int GetThumbLength() const = 0;
69
70 // warning: most of subsequent methods are currently only implemented in
71 // wxMSW under Win95 and are silently ignored on other platforms
72
73 virtual void SetTickFreq(int WXUNUSED(n), int WXUNUSED(pos)) { }
74 virtual int GetTickFreq() const { return 0; }
75 virtual void ClearTicks() { }
76 virtual void SetTick(int WXUNUSED(tickPos)) { }
77
78 virtual void ClearSel() { }
79 virtual int GetSelEnd() const { return GetMin(); }
80 virtual int GetSelStart() const { return GetMax(); }
81 virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { }
fc7a2a60 82
cc0bffac
RD
83 virtual void ApplyParentThemeBackground(const wxColour& bg)
84 { SetBackgroundColour(bg); }
85
01526d4f
WS
86protected:
87
88 // adjust value according to wxSL_INVERSE style
89 virtual int ValueInvertOrNot(int value) const
90 {
91 if (HasFlag(wxSL_INVERSE))
92 return (GetMax() + GetMin()) - value;
93 else
94 return value;
95 }
bd507486 96
fc7a2a60
VZ
97private:
98 DECLARE_NO_COPY_CLASS(wxSliderBase)
1e6feb95
VZ
99};
100
101// ----------------------------------------------------------------------------
102// include the real class declaration
103// ----------------------------------------------------------------------------
104
105#if defined(__WXUNIVERSAL__)
106 #include "wx/univ/slider.h"
107#elif defined(__WXMSW__)
5c2e9376 108 #include "wx/msw/slider95.h"
7d0d80bd
WS
109 #if WXWIN_COMPATIBILITY_2_4
110 #define wxSlider95 wxSlider
111 #endif
2049ba38 112#elif defined(__WXMOTIF__)
1e6feb95 113 #include "wx/motif/slider.h"
2049ba38 114#elif defined(__WXGTK__)
1e6feb95 115 #include "wx/gtk/slider.h"
34138703 116#elif defined(__WXMAC__)
1e6feb95 117 #include "wx/mac/slider.h"
746aa166
DE
118#elif defined(__WXCOCOA__)
119 #include "wx/cocoa/slider.h"
1777b9bb 120#elif defined(__WXPM__)
1e6feb95 121 #include "wx/os2/slider.h"
bdb54365
WS
122#elif defined(__WXPALMOS__)
123 #include "wx/palmos/slider.h"
c801d85f
KB
124#endif
125
1e6feb95
VZ
126#endif // wxUSE_SLIDER
127
c801d85f 128#endif
34138703 129 // _WX_SLIDER_H_BASE_