]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/gauge.mm
Correct IsMaximized() in wxOSX for non-resizable windows.
[wxWidgets.git] / src / osx / cocoa / gauge.mm
index 80ed675dc876d76471216f240e06cb257ca34624..e9c35f40b55da84f337c4defc7a3f19f6396c4b9 100644 (file)
 
 @interface wxNSProgressIndicator : NSProgressIndicator
 {
 
 @interface wxNSProgressIndicator : NSProgressIndicator
 {
-    wxWidgetImpl* impl;
 }
 
 }
 
-- (void)setImplementation: (wxWidgetImpl *) theImplementation;
-- (wxWidgetImpl*) implementation;
-- (BOOL) isFlipped;
-
 @end
 
 @implementation wxNSProgressIndicator
 
 @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
 }
 
 @end
@@ -60,19 +43,19 @@ public :
     wxOSXGaugeCocoaImpl( wxWindowMac* peer, WXWidget w) : wxWidgetCocoaImpl( peer, w )
     {
     }
     wxOSXGaugeCocoaImpl( wxWindowMac* peer, WXWidget w) : wxWidgetCocoaImpl( peer, w )
     {
     }
-    
+
     void SetMaximum(wxInt32 v)
     {
         SetDeterminateMode();
         wxWidgetCocoaImpl::SetMaximum( v ) ;
     }
     void SetMaximum(wxInt32 v)
     {
         SetDeterminateMode();
         wxWidgetCocoaImpl::SetMaximum( v ) ;
     }
-    
+
     void SetValue(wxInt32 v)
     {
         SetDeterminateMode();
         wxWidgetCocoaImpl::SetValue( v ) ;
     }
     void SetValue(wxInt32 v)
     {
         SetDeterminateMode();
         wxWidgetCocoaImpl::SetValue( v ) ;
     }
-    
+
     void PulseGauge()
     {
         if ( ![(wxNSProgressIndicator*)m_osxView isIndeterminate] )
     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,
                                     wxInt32 value,
                                     wxInt32 minimum,
                                     wxInt32 maximum,
-                                    const wxPoint& pos, 
+                                    const wxPoint& pos,
                                     const wxSize& size,
                                     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];
 
     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];
     [v setMaxValue: maximum];
     [v setIndeterminate:FALSE];
     [v setDoubleValue: (double) value];
-    [sv addSubview:v];
     wxWidgetCocoaImpl* c = new wxOSXGaugeCocoaImpl( wxpeer, v );
     wxWidgetCocoaImpl* c = new wxOSXGaugeCocoaImpl( wxpeer, v );
-    [v setImplementation:c];
     return c;
 }
 
     return c;
 }