1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/slider.h
3 // Purpose: wxSlider class
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // (c) 2007 Software 2000 Ltd.
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef __WX_COCOA_SLIDER_H__
14 #define __WX_COCOA_SLIDER_H__
16 #include "wx/cocoa/NSSlider.h"
18 // ========================================================================
20 // ========================================================================
21 class WXDLLIMPEXP_CORE wxSlider
: public wxSliderBase
, protected wxCocoaNSSlider
23 DECLARE_DYNAMIC_CLASS(wxSlider
)
25 WX_DECLARE_COCOA_OWNER(NSSlider
,NSControl
,NSView
)
26 // ------------------------------------------------------------------------
28 // ------------------------------------------------------------------------
31 wxSlider(wxWindow
*parent
, wxWindowID winid
,
32 int value
, int minValue
, int maxValue
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 const wxSize
& size
= wxDefaultSize
,
35 long style
= wxSL_HORIZONTAL
,
36 const wxValidator
& validator
= wxDefaultValidator
,
37 const wxString
& name
= wxSliderNameStr
)
39 Create(parent
, winid
, value
, minValue
, maxValue
,
40 pos
, size
, style
, validator
, name
);
43 bool Create(wxWindow
*parent
, wxWindowID winid
,
44 int value
, int minValue
, int maxValue
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& size
= wxDefaultSize
,
47 long style
= wxSL_HORIZONTAL
,
48 const wxValidator
& validator
= wxDefaultValidator
,
49 const wxString
& name
= wxSliderNameStr
);
52 // ------------------------------------------------------------------------
54 // ------------------------------------------------------------------------
56 // Override this so we can use wxCocoaNSControl's target
57 void AssociateNSSlider(WX_NSSlider theSlider
);
59 // Helper method to do the real work
60 virtual void ProcessEventType(wxEventType commandType
);
62 // from wxCocoaNSControl:
63 virtual void CocoaTarget_action();
65 // from wxCocoaNSSlider:
66 virtual void CocoaNotification_startTracking(WX_NSNotification notification
);
67 virtual void CocoaNotification_continueTracking(WX_NSNotification notification
);
68 virtual void CocoaNotification_stopTracking(WX_NSNotification notification
);
70 // ------------------------------------------------------------------------
72 // ------------------------------------------------------------------------
75 virtual int GetValue() const;
76 virtual void SetValue(int value
);
78 // retrieve/change the range
79 virtual void SetRange(int minValue
, int maxValue
);
80 virtual int GetMin() const;
81 virtual int GetMax() const;
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
);
87 virtual void SetPageSize(int pageSize
);
88 virtual int GetLineSize() const;
89 virtual int GetPageSize() const;
91 // these methods get/set the length of the slider pointer in pixels
92 virtual void SetThumbLength(int lenPixels
);
93 virtual int GetThumbLength() const;
95 // copied from (wxSliderCocoa.h)
96 virtual int GetTickFreq() const;
97 virtual void ClearTicks() { SetTickFreq(0); }
99 virtual void SetTickPos(int pos
);
102 // Platform-specific implementation of SetTickFreq
103 virtual void DoSetTickFreq(int freq
);
107 // __WX_COCOA_SLIDER_H__