1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/iphone/gauge.mm
3 // Purpose: wxGauge class
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
17 #include "wx/osx/private.h"
19 @interface wxUIProgressView : UIProgressView
25 @implementation wxUIProgressView
29 static BOOL initialized = NO;
33 wxOSXIPhoneClassAddWXMethods( self );
39 class wxOSXGaugeIPhoneImpl : public wxWidgetIPhoneImpl
42 wxOSXGaugeIPhoneImpl( wxWindowMac* peer, WXWidget w) : wxWidgetIPhoneImpl( peer, w )
46 void SetMaximum(wxInt32 m)
48 wxUIProgressView* v = (wxUIProgressView*)GetWXWidget();
49 wxGauge* wxpeer = (wxGauge*) GetWXPeer();
51 [v setProgress:(float) wxpeer->GetValue() / m];
54 void SetValue(wxInt32 n)
56 wxUIProgressView* v = (wxUIProgressView*)GetWXWidget();
57 wxGauge* wxpeer = (wxGauge*) GetWXPeer();
59 [v setProgress:(float) n / wxpeer->GetRange()];
66 void SetDeterminateMode()
68 // switch back to determinate mode if necessary
73 wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
74 wxWindowMac* WXUNUSED(parent),
75 wxWindowID WXUNUSED(id),
82 long WXUNUSED(extraStyle))
84 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
85 wxUIProgressView* v = [[wxUIProgressView alloc] initWithFrame:r];
86 [v setProgress:(float) value/maximum];
88 wxWidgetIPhoneImpl* c = new wxOSXGaugeIPhoneImpl( wxpeer, v );