]>
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 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 David Elliott | |
ddac39da | 10 | // (c) 2007 Software 2000 Ltd. |
1b88201f | 11 | // Licence: wxWindows licence |
2ec55dc0 DE |
12 | ///////////////////////////////////////////////////////////////////////////// |
13 | ||
14 | #ifndef __WX_COCOA_SLIDER_H__ | |
15 | #define __WX_COCOA_SLIDER_H__ | |
16 | ||
ddac39da | 17 | #include "wx/cocoa/NSSlider.h" |
2ec55dc0 DE |
18 | |
19 | // ======================================================================== | |
20 | // wxSlider | |
21 | // ======================================================================== | |
ddac39da | 22 | class WXDLLEXPORT wxSlider: public wxSliderBase, protected wxCocoaNSSlider |
2ec55dc0 DE |
23 | { |
24 | DECLARE_DYNAMIC_CLASS(wxSlider) | |
25 | DECLARE_EVENT_TABLE() | |
ddac39da | 26 | WX_DECLARE_COCOA_OWNER(NSSlider,NSControl,NSView) |
2ec55dc0 DE |
27 | // ------------------------------------------------------------------------ |
28 | // initialization | |
29 | // ------------------------------------------------------------------------ | |
30 | public: | |
31 | wxSlider() { } | |
32 | wxSlider(wxWindow *parent, wxWindowID winid, | |
33 | int value, int minValue, int maxValue, | |
34 | const wxPoint& pos = wxDefaultPosition, | |
35 | const wxSize& size = wxDefaultSize, | |
36 | long style = wxSL_HORIZONTAL, | |
37 | const wxValidator& validator = wxDefaultValidator, | |
bfddb923 | 38 | const wxString& name = wxSliderNameStr) |
2ec55dc0 DE |
39 | { |
40 | Create(parent, winid, value, minValue, maxValue, | |
41 | pos, size, style, validator, name); | |
42 | } | |
43 | ||
44 | bool Create(wxWindow *parent, wxWindowID winid, | |
45 | int value, int minValue, int maxValue, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = wxSL_HORIZONTAL, | |
49 | const wxValidator& validator = wxDefaultValidator, | |
bfddb923 | 50 | const wxString& name = wxSliderNameStr); |
2ec55dc0 DE |
51 | virtual ~wxSlider(); |
52 | ||
53 | // ------------------------------------------------------------------------ | |
54 | // Cocoa callbacks | |
55 | // ------------------------------------------------------------------------ | |
56 | protected: | |
ddac39da DE |
57 | // from NSSLider |
58 | virtual void ProcessEventType(wxEventType commandType); | |
59 | virtual void Cocoa_wxNSSliderUpArrowKeyDown(void) { ProcessEventType(wxEVT_SCROLL_PAGEDOWN); } | |
60 | virtual void Cocoa_wxNSSliderDownArrowKeyDown(void) { ProcessEventType(wxEVT_SCROLL_PAGEUP); } | |
61 | virtual void Cocoa_wxNSSliderLeftArrowKeyDown(void) { ProcessEventType(wxEVT_SCROLL_PAGEUP); } | |
62 | virtual void Cocoa_wxNSSliderRightArrowKeyDown(void) { ProcessEventType(wxEVT_SCROLL_PAGEDOWN); } | |
63 | virtual void Cocoa_wxNSSliderPageUpKeyDown(void) { ProcessEventType(wxEVT_SCROLL_BOTTOM); } | |
64 | virtual void Cocoa_wxNSSliderPageDownKeyDown(void) { ProcessEventType(wxEVT_SCROLL_TOP); } | |
65 | virtual void Cocoa_wxNSSliderMoveUp(void) { ProcessEventType(wxEVT_SCROLL_PAGEDOWN); } | |
66 | virtual void Cocoa_wxNSSliderMoveDown(void) { ProcessEventType(wxEVT_SCROLL_PAGEUP); } | |
67 | virtual void Cocoa_wxNSSliderMoveLeft(void) { ProcessEventType(wxEVT_SCROLL_PAGEUP); } | |
68 | virtual void Cocoa_wxNSSliderMoveRight(void) { ProcessEventType(wxEVT_SCROLL_PAGEDOWN); } | |
69 | virtual void Cocoa_wxNSSliderPageUp(void) { ProcessEventType(wxEVT_SCROLL_BOTTOM); } | |
70 | virtual void Cocoa_wxNSSliderPageDown(void) { ProcessEventType(wxEVT_SCROLL_TOP); } | |
71 | virtual void CocoaNotification_startTracking(WX_NSNotification notification); | |
72 | virtual void CocoaNotification_continueTracking(WX_NSNotification notification); | |
73 | virtual void CocoaNotification_stopTracking(WX_NSNotification notification); | |
74 | ||
75 | ||
2ec55dc0 DE |
76 | // ------------------------------------------------------------------------ |
77 | // Implementation | |
78 | // ------------------------------------------------------------------------ | |
79 | public: | |
80 | // Pure Virtuals | |
ddac39da DE |
81 | virtual int GetValue() const; |
82 | virtual void SetValue(int value); | |
2ec55dc0 DE |
83 | |
84 | // retrieve/change the range | |
ddac39da DE |
85 | virtual void SetRange(int minValue, int maxValue); |
86 | virtual int GetMin() const; | |
87 | virtual int GetMax() const; | |
2ec55dc0 DE |
88 | |
89 | // the line/page size is the increment by which the slider moves when | |
90 | // cursor arrow key/page up or down are pressed (clicking the mouse is like | |
91 | // pressing PageUp/Down) and are by default set to 1 and 1/10 of the range | |
ddac39da DE |
92 | virtual void SetLineSize(int lineSize); |
93 | virtual void SetPageSize(int pageSize); | |
94 | virtual int GetLineSize() const; | |
95 | virtual int GetPageSize() const; | |
2ec55dc0 DE |
96 | |
97 | // these methods get/set the length of the slider pointer in pixels | |
ddac39da DE |
98 | virtual void SetThumbLength(int lenPixels); |
99 | virtual int GetThumbLength() const; | |
100 | ||
101 | // copied from (wxSliderCocoa.h) | |
102 | virtual void SetTickFreq(int n, int pos); | |
103 | virtual int GetTickFreq() const; | |
104 | virtual void ClearTicks() { SetTickFreq(0, 0); } | |
105 | ||
106 | virtual void SetTickPos(int pos); | |
2ec55dc0 DE |
107 | |
108 | }; | |
109 | ||
1b88201f WS |
110 | #endif |
111 | // __WX_COCOA_SLIDER_H__ |