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];
55 void SetValue(wxInt32 n)
57 wxUIProgressView* v = (wxUIProgressView*)GetWXWidget();
58 wxGauge* wxpeer = (wxGauge*) GetWXPeer();
60 [v setProgress:(float) n / wxpeer->GetRange()];
68 void SetDeterminateMode()
70 // switch back to determinate mode if necessary
75 wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
76 wxWindowMac* WXUNUSED(parent),
77 wxWindowID WXUNUSED(id),
84 long WXUNUSED(extraStyle))
86 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
87 wxUIProgressView* v = [[wxUIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
89 [v setProgress:(float) value/maximum];
91 wxWidgetIPhoneImpl* c = new wxOSXGaugeIPhoneImpl( wxpeer, v );