X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dbeddfb93d3479d03d8ec4c0121dfbe3bbcc422b..cbe067603829728da8852282e895f25b2bccf732:/src/osx/cocoa/gauge.mm diff --git a/src/osx/cocoa/gauge.mm b/src/osx/cocoa/gauge.mm index 80ed675dc8..e9c35f40b5 100644 --- a/src/osx/cocoa/gauge.mm +++ b/src/osx/cocoa/gauge.mm @@ -19,37 +19,20 @@ @interface wxNSProgressIndicator : NSProgressIndicator { - wxWidgetImpl* impl; } -- (void)setImplementation: (wxWidgetImpl *) theImplementation; -- (wxWidgetImpl*) implementation; -- (BOOL) isFlipped; - @end @implementation wxNSProgressIndicator -- (id)initWithFrame:(NSRect)frame -{ - [super initWithFrame:frame]; - impl = NULL; - return self; -} - -- (void)setImplementation: (wxWidgetImpl *) theImplementation ++ (void)initialize { - impl = theImplementation; -} - -- (wxWidgetImpl*) implementation -{ - return impl; -} - -- (BOOL) isFlipped -{ - return YES; + static BOOL initialized = NO; + if (!initialized) + { + initialized = YES; + wxOSXCocoaClassAddWXMethods( self ); + } } @end @@ -60,19 +43,19 @@ public : wxOSXGaugeCocoaImpl( wxWindowMac* peer, WXWidget w) : wxWidgetCocoaImpl( peer, w ) { } - + void SetMaximum(wxInt32 v) { SetDeterminateMode(); wxWidgetCocoaImpl::SetMaximum( v ) ; } - + void SetValue(wxInt32 v) { SetDeterminateMode(); wxWidgetCocoaImpl::SetValue( v ) ; } - + void PulseGauge() { if ( ![(wxNSProgressIndicator*)m_osxView isIndeterminate] ) @@ -94,19 +77,17 @@ protected: }; -wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer, - wxWindowMac* parent, - wxWindowID id, +wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer, + wxWindowMac* WXUNUSED(parent), + wxWindowID WXUNUSED(id), wxInt32 value, wxInt32 minimum, wxInt32 maximum, - const wxPoint& pos, + const wxPoint& pos, const wxSize& size, - long style, - long extraStyle) + long WXUNUSED(style), + long WXUNUSED(extraStyle)) { - NSView* sv = (wxpeer->GetParent()->GetHandle() ); - NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ; wxNSProgressIndicator* v = [[wxNSProgressIndicator alloc] initWithFrame:r]; @@ -114,9 +95,7 @@ wxWidgetImplType* wxWidgetImpl::CreateGauge( wxWindowMac* wxpeer, [v setMaxValue: maximum]; [v setIndeterminate:FALSE]; [v setDoubleValue: (double) value]; - [sv addSubview:v]; wxWidgetCocoaImpl* c = new wxOSXGaugeCocoaImpl( wxpeer, v ); - [v setImplementation:c]; return c; }