1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGauge class
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: gauge.cpp 54820 2008-07-29 20:04:11Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
18 #include "wx/osx/private.h"
20 @interface wxUIProgressView : UIProgressView
26 @implementation wxUIProgressView
30 static BOOL initialized = NO;
34 wxOSXIPhoneClassAddWXMethods( self );
40 class wxOSXGaugeIPhoneImpl : public wxWidgetIPhoneImpl
43 wxOSXGaugeIPhoneImpl( wxWindowMac* peer, WXWidget w) : wxWidgetIPhoneImpl( peer, w )
47 void SetMaximum(wxInt32 m)
49 wxUIProgressView* v = (wxUIProgressView*)GetWXWidget();
50 wxGauge* wxpeer = (wxGauge*) GetWXPeer();
52 [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()];
67 void SetDeterminateMode()
69 // switch back to determinate mode if necessary
74 wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
75 wxWindowMac* WXUNUSED(parent),
76 wxWindowID WXUNUSED(id),
83 long WXUNUSED(extraStyle))
85 CGRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
86 wxUIProgressView* v = [[wxUIProgressView alloc] initWithFrame:r];
87 [v setProgress:(float) value/maximum];
89 wxWidgetIPhoneImpl* c = new wxOSXGaugeIPhoneImpl( wxpeer, v );