1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSlider class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "slider.h"
19 #include "wx/control.h"
20 #include "wx/slider.h"
21 #include "wx/stattext.h"
23 WXDLLEXPORT_DATA(extern const wxChar
*) wxSliderNameStr
;
26 class WXDLLEXPORT wxSlider
: public wxControl
28 DECLARE_DYNAMIC_CLASS(wxSlider
)
33 inline wxSlider(wxWindow
*parent
, wxWindowID id
,
34 int value
, int minValue
, int maxValue
,
35 const wxPoint
& pos
= wxDefaultPosition
,
36 const wxSize
& size
= wxDefaultSize
,
37 long style
= wxSL_HORIZONTAL
,
38 const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
& name
= wxSliderNameStr
)
41 Create(parent
, id
, value
, minValue
, maxValue
, pos
, size
, style
, validator
, name
);
46 bool Create(wxWindow
*parent
, wxWindowID id
,
47 int value
, int minValue
, int maxValue
,
48 const wxPoint
& pos
= wxDefaultPosition
,
49 const wxSize
& size
= wxDefaultSize
,
50 long style
= wxSL_HORIZONTAL
,
51 const wxValidator
& validator
= wxDefaultValidator
,
52 const wxString
& name
= wxSliderNameStr
);
54 virtual int GetValue() const ;
55 virtual void SetValue(int);
57 void SetRange(int minValue
, int maxValue
);
59 inline int GetMin() const { return m_rangeMin
; }
60 inline int GetMax() const { return m_rangeMax
; }
62 void SetMin(int minValue
) { SetRange(minValue
, m_rangeMax
); }
63 void SetMax(int maxValue
) { SetRange(m_rangeMin
, maxValue
); }
66 void SetTickFreq(int n
, int pos
);
67 inline int GetTickFreq() const { return m_tickFreq
; }
68 void SetPageSize(int pageSize
);
69 int GetPageSize() const ;
72 void SetLineSize(int lineSize
);
73 int GetLineSize() const ;
74 int GetSelEnd() const ;
75 int GetSelStart() const ;
76 void SetSelection(int minPos
, int maxPos
);
77 void SetThumbLength(int len
) ;
78 int GetThumbLength() const ;
79 void SetTick(int tickPos
) ;
82 // set min/max size of the slider
83 virtual void DoSetSizeHints( int minW
, int minH
,
84 int maxW
= -1, int maxH
= -1,
85 int incW
= -1, int incH
= -1 );
88 virtual wxSize
DoGetBestSize() const;
89 virtual void DoSetSize(int x
, int y
, int w
, int h
, int sizeFlags
);
90 virtual void DoMoveWindow(int x
, int y
, int w
, int h
);
92 void Command(wxCommandEvent
& event
);
93 virtual wxInt32
MacControlHit( WXEVENTHANDLERREF handler
, WXEVENTREF event
) ;
94 void MacHandleControlClick( WXWidget control
, wxInt16 controlpart
, bool mouseStillDown
) ;
96 // Common processing to invert slider values based on wxSL_INVERSE
97 int MacInvertOrNot(int value
) const;
99 wxStaticText
* m_macMinimumStatic
;
100 wxStaticText
* m_macMaximumStatic
;
101 wxStaticText
* m_macValueStatic
;
109 DECLARE_EVENT_TABLE()