]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/slider.h
Add lambda-friendly wxDialog::ShowWindowModalThenDo().
[wxWidgets.git] / include / wx / cocoa / slider.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/slider.h
3 // Purpose: wxSlider class
4 // Author: David Elliott
5 // Mark Oxenham
6 // Modified by:
7 // Created: 2003/06/19
8 // Copyright: (c) 2003 David Elliott
9 // (c) 2007 Software 2000 Ltd.
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef __WX_COCOA_SLIDER_H__
14 #define __WX_COCOA_SLIDER_H__
15
16 #include "wx/cocoa/NSSlider.h"
17
18 // ========================================================================
19 // wxSlider
20 // ========================================================================
21 class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase, protected wxCocoaNSSlider
22 {
23 DECLARE_DYNAMIC_CLASS(wxSlider)
24 DECLARE_EVENT_TABLE()
25 WX_DECLARE_COCOA_OWNER(NSSlider,NSControl,NSView)
26 // ------------------------------------------------------------------------
27 // initialization
28 // ------------------------------------------------------------------------
29 public:
30 wxSlider() { }
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)
38 {
39 Create(parent, winid, value, minValue, maxValue,
40 pos, size, style, validator, name);
41 }
42
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);
50 virtual ~wxSlider();
51
52 // ------------------------------------------------------------------------
53 // Cocoa callbacks
54 // ------------------------------------------------------------------------
55 protected:
56 // Override this so we can use wxCocoaNSControl's target
57 void AssociateNSSlider(WX_NSSlider theSlider);
58
59 // Helper method to do the real work
60 virtual void ProcessEventType(wxEventType commandType);
61
62 // from wxCocoaNSControl:
63 virtual void CocoaTarget_action();
64
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);
69
70 // ------------------------------------------------------------------------
71 // Implementation
72 // ------------------------------------------------------------------------
73 public:
74 // Pure Virtuals
75 virtual int GetValue() const;
76 virtual void SetValue(int value);
77
78 // retrieve/change the range
79 virtual void SetRange(int minValue, int maxValue);
80 virtual int GetMin() const;
81 virtual int GetMax() const;
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);
87 virtual void SetPageSize(int pageSize);
88 virtual int GetLineSize() const;
89 virtual int GetPageSize() const;
90
91 // these methods get/set the length of the slider pointer in pixels
92 virtual void SetThumbLength(int lenPixels);
93 virtual int GetThumbLength() const;
94
95 // copied from (wxSliderCocoa.h)
96 virtual int GetTickFreq() const;
97 virtual void ClearTicks() { SetTickFreq(0); }
98
99 virtual void SetTickPos(int pos);
100
101 protected:
102 // Platform-specific implementation of SetTickFreq
103 virtual void DoSetTickFreq(int freq);
104 };
105
106 #endif
107 // __WX_COCOA_SLIDER_H__