]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/slider.mm
Add wxTimer::StartOnce().
[wxWidgets.git] / src / osx / cocoa / slider.mm
index 6e31a40e436160adb52030dfa28f38e0e2a2d7a8..3bab4cc06adb58cec97cca0ce3da44a0ed277947 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
-// RCS-ID:      $Id: slider.cpp 54129 2008-06-11 19:30:52Z SC $
+// RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
 // Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) Stefan Csomor
 // Licence:       wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -26,7 +26,7 @@
 + (void)initialize
 {
     static BOOL initialized = NO;
 + (void)initialize
 {
     static BOOL initialized = NO;
-    if (!initialized) 
+    if (!initialized)
     {
         initialized = YES;
         wxOSXCocoaClassAddWXMethods(self);
     {
         initialized = YES;
         wxOSXCocoaClassAddWXMethods(self);
@@ -42,7 +42,7 @@ public :
         wxWidgetCocoaImpl(peer, w)
     {
     }
         wxWidgetCocoaImpl(peer, w)
     {
     }
-    
+
     ~wxSliderCocoaImpl()
     {
     }
     ~wxSliderCocoaImpl()
     {
     }
@@ -51,13 +51,13 @@ public :
     virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd);
 };
 
     virtual void mouseEvent(WX_NSEvent event, WXWidget slf, void* _cmd);
 };
 
-// we will have a mouseDown, then in the native 
+// we will have a mouseDown, then in the native
 // implementation of mouseDown the tracking code
 // is calling clickedAction, therefore we wire this
 // implementation of mouseDown the tracking code
 // is calling clickedAction, therefore we wire this
-// to thumbtrack and only after super mouseDown 
+// to thumbtrack and only after super mouseDown
 // returns we will call the thumbrelease
 
 // returns we will call the thumbrelease
 
-void wxSliderCocoaImpl::controlAction( WXWidget slf, void *_cmd, void *sender)
+void wxSliderCocoaImpl::controlAction( WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd), void *WXUNUSED(sender))
 {
     wxWindow* wxpeer = (wxWindow*) GetWXPeer();
     if ( wxpeer )
 {
     wxWindow* wxpeer = (wxWindow*) GetWXPeer();
     if ( wxpeer )
@@ -67,7 +67,7 @@ void wxSliderCocoaImpl::controlAction( WXWidget slf, void *_cmd, void *sender)
 void wxSliderCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
 {
     wxWidgetCocoaImpl::mouseEvent(event, slf, _cmd);
 void wxSliderCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
 {
     wxWidgetCocoaImpl::mouseEvent(event, slf, _cmd);
-    
+
     if ( strcmp( sel_getName((SEL) _cmd) , "mouseDown:") == 0 )
     {
         wxWindow* wxpeer = (wxWindow*) GetWXPeer();
     if ( strcmp( sel_getName((SEL) _cmd) , "mouseDown:") == 0 )
     {
         wxWindow* wxpeer = (wxWindow*) GetWXPeer();
@@ -78,18 +78,25 @@ void wxSliderCocoaImpl::mouseEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
 
 
 
 
 
 
-wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer, 
-                                    wxWindowMac* parent, 
-                                    wxWindowID id, 
+wxWidgetImplType* wxWidgetImpl::CreateSlider( 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 style,
+                                    long WXUNUSED(extraStyle))
 {
     NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
 {
     NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
+    if ( size == wxDefaultSize )
+    {
+        if ( style & wxSL_VERTICAL )
+            r.size.height = r.size.width * 2;
+        else
+            r.size.width = r.size.height * 2;
+    }
     wxNSSlider* v = [[wxNSSlider alloc] initWithFrame:r];
 
     int tickMarks = 0;
     wxNSSlider* v = [[wxNSSlider alloc] initWithFrame:r];
 
     int tickMarks = 0;
@@ -101,7 +108,7 @@ wxWidgetImplType* wxWidgetImpl::CreateSlider( wxWindowMac* wxpeer,
         // it to a UInt16
         while (tickMarks > 20)
             tickMarks /= 5;
         // it to a UInt16
         while (tickMarks > 20)
             tickMarks /= 5;
-            
+
         [v setNumberOfTickMarks:tickMarks];
         [v setTickMarkPosition:NSTickMarkBelow];
     }
         [v setNumberOfTickMarks:tickMarks];
         [v setTickMarkPosition:NSTickMarkBelow];
     }