]> git.saurik.com Git - wxWidgets.git/blob - src/osx/iphone/slider.mm
Don't call wxSafeYield() from wxGenericListCtrl::EditLabel().
[wxWidgets.git] / src / osx / iphone / slider.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/iphone/slider.mm
3 // Purpose: wxSlider
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_SLIDER
15
16 #include "wx/slider.h"
17 #include "wx/osx/private.h"
18
19 @interface wxUISlider : UISlider
20 {
21 }
22 @end
23
24 @implementation wxUISlider
25
26 + (void)initialize
27 {
28 static BOOL initialized = NO;
29 if (!initialized)
30 {
31 initialized = YES;
32 wxOSXIPhoneClassAddWXMethods(self);
33 }
34 }
35
36 @end
37
38 class wxSliderIPhoneImpl : public wxWidgetIPhoneImpl
39 {
40 public :
41 wxSliderIPhoneImpl(wxWindowMac* peer , UISlider* w) :
42 wxWidgetIPhoneImpl(peer, w)
43 {
44 m_control=w;
45 }
46
47 ~wxSliderIPhoneImpl()
48 {
49 }
50
51 void controlAction(void* sender, wxUint32 controlEvent, WX_UIEvent rawEvent)
52 {
53 if ( controlEvent == UIControlEventValueChanged )
54 GetWXPeer()->TriggerScrollEvent(wxEVT_SCROLL_THUMBTRACK);
55 else
56 wxWidgetIPhoneImpl::controlAction(sender,controlEvent,rawEvent);
57 }
58
59 void SetMaximum(wxInt32 m)
60 {
61 [m_control setMaximumValue:m];
62 }
63
64 void SetMinimum(wxInt32 m)
65 {
66 [m_control setMinimumValue:m];
67 }
68
69 void SetValue(wxInt32 n)
70 {
71 [m_control setValue:n];
72 }
73
74 wxInt32 GetValue() const
75 {
76 return [m_control value];
77 }
78
79 private:
80 UISlider* m_control;
81 };
82
83 wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
84 wxWindowMac* WXUNUSED(parent),
85 wxWindowID WXUNUSED(id),
86 wxInt32 value,
87 wxInt32 minimum,
88 wxInt32 maximum,
89 const wxPoint& pos,
90 const wxSize& size,
91 long style,
92 long WXUNUSED(extraStyle))
93 {
94 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
95 UISlider* v = [[UISlider alloc] initWithFrame:r];
96
97 [v setMinimumValue: minimum];
98 [v setMaximumValue: maximum];
99 [v setValue: (double) value];
100
101 wxWidgetIPhoneImpl* c = new wxSliderIPhoneImpl( wxpeer, v );
102 return c;
103 }
104
105 #endif // wxUSE_SLIDER