1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/iphone/slider.mm
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
15 #include "wx/slider.h"
16 #include "wx/osx/private.h"
18 @interface wxUISlider : UISlider
23 @implementation wxUISlider
27 static BOOL initialized = NO;
31 wxOSXIPhoneClassAddWXMethods(self);
37 class wxSliderIPhoneImpl : public wxWidgetIPhoneImpl
40 wxSliderIPhoneImpl(wxWindowMac* peer , UISlider* w) :
41 wxWidgetIPhoneImpl(peer, w)
50 void controlAction(void* sender, wxUint32 controlEvent, WX_UIEvent rawEvent)
52 if ( controlEvent == UIControlEventValueChanged )
53 GetWXPeer()->TriggerScrollEvent(wxEVT_SCROLL_THUMBTRACK);
55 wxWidgetIPhoneImpl::controlAction(sender,controlEvent,rawEvent);
58 void SetMaximum(wxInt32 m)
60 [m_control setMaximumValue:m];
63 void SetMinimum(wxInt32 m)
65 [m_control setMinimumValue:m];
68 void SetValue(wxInt32 n)
70 [m_control setValue:n];
73 wxInt32 GetValue() const
75 return [m_control value];
82 wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
83 wxWindowMac* WXUNUSED(parent),
84 wxWindowID WXUNUSED(id),
91 long WXUNUSED(extraStyle))
93 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
94 UISlider* v = [[UISlider alloc] initWithFrame:r];
96 [v setMinimumValue: minimum];
97 [v setMaximumValue: maximum];
98 [v setValue: (double) value];
100 wxWidgetIPhoneImpl* c = new wxSliderIPhoneImpl( wxpeer, v );
104 #endif // wxUSE_SLIDER