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
25 - (void)setImplementation: (wxWidgetImpl *) theImplementation;
26 - (wxWidgetImpl*) implementation;
31 @implementation wxNSProgressIndicator
33 - (id)initWithFrame:(NSRect)frame
35 [super initWithFrame:frame];
40 - (void)setImplementation: (wxWidgetImpl *) theImplementation
42 impl = theImplementation;
45 - (wxWidgetImpl*) implementation
57 class wxOSXGaugeCocoaImpl : public wxWidgetCocoaImpl
60 wxOSXGaugeCocoaImpl( wxWindowMac* peer, WXWidget w) : wxWidgetCocoaImpl( peer, w )
64 void SetMaximum(wxInt32 v)
67 wxWidgetCocoaImpl::SetMaximum( v ) ;
70 void SetValue(wxInt32 v)
73 wxWidgetCocoaImpl::SetValue( v ) ;
78 if ( ![(wxNSProgressIndicator*)m_osxView isIndeterminate] )
80 [(wxNSProgressIndicator*)m_osxView setIndeterminate:YES];
81 [(wxNSProgressIndicator*)m_osxView startAnimation:nil];
85 void SetDeterminateMode()
87 // switch back to determinate mode if necessary
88 if ( [(wxNSProgressIndicator*)m_osxView isIndeterminate] )
90 [(wxNSProgressIndicator*)m_osxView stopAnimation:nil];
91 [(wxNSProgressIndicator*)m_osxView setIndeterminate:NO];
97 wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer,
108 NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
109 wxNSProgressIndicator* v = [[wxNSProgressIndicator alloc] initWithFrame:r];
111 [v setMinValue: minimum];
112 [v setMaxValue: maximum];
113 [v setIndeterminate:FALSE];
114 [v setDoubleValue: (double) value];
115 wxWidgetCocoaImpl* c = new wxOSXGaugeCocoaImpl( wxpeer, v );
116 [v setImplementation:c];
120 #endif // wxUSE_GAUGE