]>
Commit | Line | Data |
---|---|---|
2ec55dc0 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cocoa/slider.h | |
3 | // Purpose: wxSlider class | |
4 | // Author: David Elliott | |
ddac39da | 5 | // Mark Oxenham |
2ec55dc0 DE |
6 | // Modified by: |
7 | // Created: 2003/06/19 | |
2ec55dc0 | 8 | // Copyright: (c) 2003 David Elliott |
ddac39da | 9 | // (c) 2007 Software 2000 Ltd. |
1b88201f | 10 | // Licence: wxWindows licence |
2ec55dc0 DE |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef __WX_COCOA_SLIDER_H__ | |
14 | #define __WX_COCOA_SLIDER_H__ | |
15 | ||
ddac39da | 16 | #include "wx/cocoa/NSSlider.h" |
2ec55dc0 DE |
17 | |
18 | // ======================================================================== | |
19 | // wxSlider | |
20 | // ======================================================================== | |
53a2db12 | 21 | class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase, protected wxCocoaNSSlider |
2ec55dc0 DE |
22 | { |
23 | DECLARE_DYNAMIC_CLASS(wxSlider) | |
24 | DECLARE_EVENT_TABLE() | |
ddac39da | 25 | WX_DECLARE_COCOA_OWNER(NSSlider,NSControl,NSView) |
2ec55dc0 DE |
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, | |
bfddb923 | 37 | const wxString& name = wxSliderNameStr) |
2ec55dc0 DE |
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, | |
bfddb923 | 49 | const wxString& name = wxSliderNameStr); |
2ec55dc0 DE |
50 | virtual ~wxSlider(); |
51 | ||
52 | // ------------------------------------------------------------------------ | |
53 | // Cocoa callbacks | |
54 | // ------------------------------------------------------------------------ | |
55 | protected: | |
4f46c20b DE |
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 | |
ddac39da | 60 | virtual void ProcessEventType(wxEventType commandType); |
4f46c20b DE |
61 | |
62 | // from wxCocoaNSControl: | |
63 | virtual void CocoaTarget_action(); | |
64 | ||
65 | // from wxCocoaNSSlider: | |
ddac39da DE |
66 | virtual void CocoaNotification_startTracking(WX_NSNotification notification); |
67 | virtual void CocoaNotification_continueTracking(WX_NSNotification notification); | |
68 | virtual void CocoaNotification_stopTracking(WX_NSNotification notification); | |
4f46c20b | 69 | |
2ec55dc0 DE |
70 | // ------------------------------------------------------------------------ |
71 | // Implementation | |
72 | // ------------------------------------------------------------------------ | |
73 | public: | |
74 | // Pure Virtuals | |
ddac39da DE |
75 | virtual int GetValue() const; |
76 | virtual void SetValue(int value); | |
2ec55dc0 DE |
77 | |
78 | // retrieve/change the range | |
ddac39da DE |
79 | virtual void SetRange(int minValue, int maxValue); |
80 | virtual int GetMin() const; | |
81 | virtual int GetMax() const; | |
2ec55dc0 DE |
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 | |
ddac39da DE |
86 | virtual void SetLineSize(int lineSize); |
87 | virtual void SetPageSize(int pageSize); | |
88 | virtual int GetLineSize() const; | |
89 | virtual int GetPageSize() const; | |
2ec55dc0 DE |
90 | |
91 | // these methods get/set the length of the slider pointer in pixels | |
ddac39da DE |
92 | virtual void SetThumbLength(int lenPixels); |
93 | virtual int GetThumbLength() const; | |
03647350 | 94 | |
ddac39da | 95 | // copied from (wxSliderCocoa.h) |
ddac39da | 96 | virtual int GetTickFreq() const; |
0a12e013 | 97 | virtual void ClearTicks() { SetTickFreq(0); } |
ddac39da DE |
98 | |
99 | virtual void SetTickPos(int pos); | |
2ec55dc0 | 100 | |
0a12e013 VZ |
101 | protected: |
102 | // Platform-specific implementation of SetTickFreq | |
103 | virtual void DoSetTickFreq(int freq); | |
2ec55dc0 DE |
104 | }; |
105 | ||
1b88201f WS |
106 | #endif |
107 | // __WX_COCOA_SLIDER_H__ |