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 wxNSProgressIndicator : NSProgressIndicator
26 @implementation wxNSProgressIndicator
30 static BOOL initialized = NO;
34 wxOSXCocoaClassAddWXMethods( self );
40 class wxOSXGaugeCocoaImpl : public wxWidgetCocoaImpl
43 wxOSXGaugeCocoaImpl( wxWindowMac* peer, WXWidget w) : wxWidgetCocoaImpl( peer, w )
47 void SetMaximum(wxInt32 v)
50 wxWidgetCocoaImpl::SetMaximum( v ) ;
53 void SetValue(wxInt32 v)
56 wxWidgetCocoaImpl::SetValue( v ) ;
61 if ( ![(wxNSProgressIndicator*)m_osxView isIndeterminate] )
63 [(wxNSProgressIndicator*)m_osxView setIndeterminate:YES];
64 [(wxNSProgressIndicator*)m_osxView startAnimation:nil];
68 void SetDeterminateMode()
70 // switch back to determinate mode if necessary
71 if ( [(wxNSProgressIndicator*)m_osxView isIndeterminate] )
73 [(wxNSProgressIndicator*)m_osxView stopAnimation:nil];
74 [(wxNSProgressIndicator*)m_osxView setIndeterminate:NO];
80 wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
81 wxWindowMac* WXUNUSED(parent),
82 wxWindowID WXUNUSED(id),
89 long WXUNUSED(extraStyle))
91 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
92 wxNSProgressIndicator* v = [[wxNSProgressIndicator alloc] initWithFrame:r];
94 [v setMinValue: minimum];
95 [v setMaxValue: maximum];
96 [v setIndeterminate:FALSE];
97 [v setDoubleValue: (double) value];
98 wxWidgetCocoaImpl* c = new wxOSXGaugeCocoaImpl( wxpeer, v );
102 #endif // wxUSE_GAUGE