]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/gauge.mm
The alignment controls are now left-aligned if the floating controls are not shown.
[wxWidgets.git] / src / osx / cocoa / gauge.mm
index 895a70cae809a09f7ff0741cb27fbc1c2a81e368..cf82bd434b3ca22c4ba83daeb21cd01245f49340 100644 (file)
@@ -1,10 +1,9 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gauge.mm
+// Name:        src/osx/cocoa/gauge.mm
 // Purpose:     wxGauge class
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
-// RCS-ID:      $Id: gauge.cpp 54820 2008-07-29 20:04:11Z SC $
 // Copyright:   (c) Stefan Csomor
 // Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -28,7 +27,7 @@
 + (void)initialize
 {
     static BOOL initialized = NO;
-    if (!initialized) 
+    if (!initialized)
     {
         initialized = YES;
         wxOSXCocoaClassAddWXMethods( self );
 
 @end
 
+@interface NSView(PossibleSizeMethods)
+- (NSControlSize)controlSize;
+@end
+
+namespace
+{
+
 class wxOSXGaugeCocoaImpl : public wxWidgetCocoaImpl
 {
 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] )
@@ -64,6 +70,27 @@ public :
             [(wxNSProgressIndicator*)m_osxView startAnimation:nil];
         }
     }
+
+    void GetLayoutInset(int &left , int &top , int &right, int &bottom) const
+    {
+        left = top = right = bottom = 0;
+        NSControlSize size = [(wxNSProgressIndicator*)m_osxView controlSize];
+
+        switch( size )
+        {
+            case NSRegularControlSize:
+                left = right = 2;
+                top = 0;
+                bottom = 4;
+                break;
+            case NSMiniControlSize:
+            case NSSmallControlSize:
+                left = right = 1;
+                top = 0;
+                bottom = 2;
+                break;
+        }
+    }
 protected:
     void SetDeterminateMode()
     {
@@ -75,18 +102,19 @@ protected:
         }
     }
 };
+    
+} // anonymous namespace
 
-
-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))
 {
     NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
     wxNSProgressIndicator* v = [[wxNSProgressIndicator alloc] initWithFrame:r];