Index: src/manager.cpp
===================================================================
--- src/manager.cpp	(revision 431)
+++ src/manager.cpp	(working copy)
@@ -35,7 +35,14 @@
 wxDockInfo wxNullDockInfo;
 DEFINE_EVENT_TYPE(wxEVT_AUI_PANEBUTTON)
 
+#ifdef __WXMAC__
+    // a few defines to avoid nameclashes
+    #define __MAC_OS_X_MEMORY_MANAGER_CLEAN__ 1
+    #define __AIFF__
+    #include "wx/mac/private.h"
+#endif
 
+
 // -- wxDefaultDockArt class implementation --
 
 // wxDefaultDockArt is an art provider class which does all of the drawing for
@@ -116,7 +123,14 @@
 
 wxDefaultDockArt::wxDefaultDockArt()
 {
+#ifdef __WXMAC__
+    wxBrush toolbarbrush;
+    toolbarbrush.MacSetTheme( kThemeBrushToolbarBackground );
+    wxColor base_color = toolbarbrush.GetColour();
+#else
     wxColor base_color = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
+#endif
+    
     wxColor darker1_color = StepColour(base_color, 85);
     wxColor darker2_color = StepColour(base_color, 70);
     wxColor darker3_color = StepColour(base_color, 60);
@@ -130,34 +144,65 @@
     m_inactive_caption_gradient_colour = darker1_color;
     m_inactive_caption_text_colour = *wxBLACK;
 
+#ifdef __WXMAC__
+    m_sash_brush = toolbarbrush;
+    m_background_brush = toolbarbrush;
+    m_gripper_brush = toolbarbrush;
+#else
     m_sash_brush = wxBrush(base_color);
     m_background_brush = wxBrush(base_color);
+    m_gripper_brush = wxBrush(base_color);
+#endif
     m_border_pen = wxPen(darker2_color);
-    m_gripper_brush = wxBrush(base_color);
     m_gripper_pen1 = wxPen(darker5_color);
     m_gripper_pen2 = wxPen(darker3_color);
     m_gripper_pen3 = *wxWHITE_PEN;
 
+#ifdef __WXMAC__
+    m_caption_font = *wxSMALL_FONT;
+#else
     m_caption_font = wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE);
+#endif
 
     // some built in bitmaps
+#ifdef __WXMAC__
+     static unsigned char close_bits[]={
+         0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x03, 0xF8, 0x01, 0xF0, 0x19, 0xF3,
+         0xB8, 0xE3, 0xF0, 0xE1, 0xE0, 0xE0, 0xF0, 0xE1, 0xB8, 0xE3, 0x19, 0xF3,
+         0x01, 0xF0, 0x03, 0xF8, 0x0F, 0xFE, 0xFF, 0xFF };
+#else
     static unsigned char close_bits[]={
         0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0xfb,0xcf,0xf9,
         0x9f,0xfc,0x3f,0xfe,0x3f,0xfe,0x9f,0xfc,0xcf,0xf9,0xef,0xfb,
         0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
-        
+#endif
+
     static unsigned char pin_bits[]={
         0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
         0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
         0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
           
+#ifdef __WXMAC__
+    m_inactive_close_bitmap = BitmapFromBits(close_bits, 16, 16, *wxWHITE);
+#else
     m_inactive_close_bitmap = BitmapFromBits(close_bits, 16, 16, m_inactive_caption_text_colour);
+#endif
     m_inactive_pin_bitmap = BitmapFromBits(pin_bits, 16, 16, m_inactive_caption_text_colour);
+#ifdef __WXMAC__
+    m_active_close_bitmap = BitmapFromBits(close_bits, 16, 16, *wxWHITE );
+#else
     m_active_close_bitmap = BitmapFromBits(close_bits, 16, 16, m_active_caption_text_colour);
+#endif
     m_active_pin_bitmap = BitmapFromBits(pin_bits, 16, 16, m_active_caption_text_colour);
 
     // default metric values
+#ifdef __WXMAC__
+    SInt32 height;
+    GetThemeMetric( kThemeMetricSmallPaneSplitterHeight , &height );
+    m_sash_size = height;
+#else
     m_sash_size = 4;
+#endif
     m_caption_size = 17;
     m_border_size = 1;
     m_button_size = 14;
@@ -252,15 +297,47 @@
 
 void wxDefaultDockArt::DrawSash(wxDC& dc, int, const wxRect& rect)
 {
+#ifdef __WXMAC__
+    HIRect splitterRect = CGRectMake( rect.x , rect.y , rect.width , rect.height );
+    CGContextRef cgContext ;
+#if wxMAC_USE_CORE_GRAPHICS
+    cgContext = ((wxMacCGContext*)(dc.GetGraphicContext()))->GetNativeContext() ;
+#else
+    Rect bounds ;
+    GetPortBounds( (CGrafPtr) dc.m_macPort , &bounds ) ;
+    QDBeginCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
+    CGContextTranslateCTM( cgContext , 0 , bounds.bottom - bounds.top ) ;
+    CGContextScaleCTM( cgContext , 1 , -1 ) ;
+#endif
+    
+    HIThemeSplitterDrawInfo drawInfo ;
+    drawInfo.version = 0 ;
+    drawInfo.state = kThemeStateActive ;
+    drawInfo.adornment = kHIThemeSplitterAdornmentNone ;
+    HIThemeDrawPaneSplitter( &splitterRect , &drawInfo , cgContext , kHIThemeOrientationNormal ) ;    
+    
+#if wxMAC_USE_CORE_GRAPHICS
+#else
+    QDEndCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
+#endif
+
+#else
     dc.SetPen(*wxTRANSPARENT_PEN);
     dc.SetBrush(m_sash_brush);
     dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
+#endif
 }
 
 
 void wxDefaultDockArt::DrawBackground(wxDC& dc, int, const wxRect& rect)
 {
     dc.SetPen(*wxTRANSPARENT_PEN);
+#ifdef __WXMAC__
+    // we have to clear first, otherwise we are drawing a light striped pattern
+    // over an already darker striped background
+    dc.SetBrush(*wxWHITE_BRUSH) ;
+    dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
+#endif
     dc.SetBrush(m_background_brush);
     dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height);
 }
@@ -315,17 +392,33 @@
     {
         if (active)
         {
+            // on mac the gradients are expected to become darker from the top
+#ifdef __WXMAC__
             DrawGradientRectangle(dc, rect,
+                                 m_active_caption_gradient_colour,
                                  m_active_caption_colour,
+                                 m_gradient_type);
+#else
+            DrawGradientRectangle(dc, rect,
+                                 m_active_caption_colour,
                                  m_active_caption_gradient_colour,
                                  m_gradient_type);
+#endif
         }
          else
         {
+            // on mac the gradients are expected to become darker from the top
+#ifdef __WXMAC__
             DrawGradientRectangle(dc, rect,
+                                 m_inactive_caption_gradient_colour,
                                  m_inactive_caption_colour,
+                                 m_gradient_type);
+#else
+            DrawGradientRectangle(dc, rect,
+                                 m_inactive_caption_colour,
                                  m_inactive_caption_gradient_colour,
                                  m_gradient_type);
+#endif
         }
     }
 }
@@ -471,7 +564,7 @@
 // which, in the future, would allow for nested managed frames.
 // For now, with wxMSW, the wxMiniFrame window is used, but on wxGTK, wxFrame
 
-#ifdef __WXMSW__
+#if defined( __WXMSW__ ) || defined( __WXMAC__ )
 #define wxFloatingPaneBaseClass wxMiniFrame
 #else
 #define wxFloatingPaneBaseClass wxFrame
@@ -674,6 +767,10 @@
         return (m & 0x100) ? true : false;
         //return (m & 0x1F00) ? true : false;
         #endif
+        
+        #ifdef __WXMAC__
+        return GetCurrentEventButtonState() & 0x01 ;
+        #endif
     }
 
 private:
@@ -3463,6 +3560,9 @@
 
 void wxFrameManager::Render(wxDC* dc)
 {
+#ifdef __WXMAC__
+    dc->Clear() ;
+#endif
     int i, part_count;
     for (i = 0, part_count = m_uiparts.GetCount();
          i < part_count; ++i)
@@ -3501,6 +3601,14 @@
 
 void wxFrameManager::Repaint(wxDC* dc)
 {
+#ifdef __WXMAC__
+    if ( dc == NULL )
+    {
+        m_frame->Refresh() ;
+        m_frame->Update() ;
+        return ;
+    }
+#endif
     int w, h;
     m_frame->GetClientSize(&w, &h);
 
@@ -3536,6 +3644,9 @@
 
 void wxFrameManager::OnEraseBackground(wxEraseEvent& event)
 {
+#ifdef __WXMAC__
+    event.Skip() ;
+#endif
 }
 
 void wxFrameManager::OnSize(wxSizeEvent& event)
@@ -3678,9 +3789,21 @@
                                       event.m_y - part->rect.y);
             m_frame->CaptureMouse();
         }
+#ifdef __WXMAC__
+        else
+        {
+            event.Skip();
+        }
+#endif
     }
-
+#ifdef __WXMAC__
+    else
+    {
+        event.Skip();
+    }
+#else
     event.Skip();
+#endif
 }
 
 
