1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/iphone/slider.mm
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: slider.cpp 54129 2008-06-11 19:30:52Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/slider.h"
17 #include "wx/osx/private.h"
19 @interface wxUISlider : UISlider
24 @implementation wxUISlider
28 static BOOL initialized = NO;
32 wxOSXIPhoneClassAddWXMethods(self);
38 class wxSliderIPhoneImpl : public wxWidgetIPhoneImpl
41 wxSliderIPhoneImpl(wxWindowMac* peer , UISlider* w) :
42 wxWidgetIPhoneImpl(peer, w)
51 void controlAction(void* sender, wxUint32 controlEvent, WX_UIEvent rawEvent)
53 if ( controlEvent == UIControlEventValueChanged )
54 GetWXPeer()->TriggerScrollEvent(wxEVT_SCROLL_THUMBTRACK);
56 wxWidgetIPhoneImpl::controlAction(sender,controlEvent,rawEvent);
59 void SetMaximum(wxInt32 m)
61 [m_control setMaximumValue:m];
64 void SetMinimum(wxInt32 m)
66 [m_control setMinimumValue:m];
69 void SetValue(wxInt32 n)
71 [m_control setValue:n];
74 wxInt32 GetValue() const
76 return [m_control value];
83 wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
84 wxWindowMac* WXUNUSED(parent),
85 wxWindowID WXUNUSED(id),
92 long WXUNUSED(extraStyle))
94 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
95 UISlider* v = [[UISlider alloc] initWithFrame:r];
97 [v setMinimumValue: minimum];
98 [v setMaximumValue: maximum];
99 [v setValue: (double) value];
101 wxWidgetIPhoneImpl* c = new wxSliderIPhoneImpl( wxpeer, v );
105 #endif // wxUSE_SLIDER