]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/dcclient.cpp
substitute '@b NB:' with '@note'; first partial revision of e*h headers; replace...
[wxWidgets.git] / src / mac / carbon / dcclient.cpp
index bb06309b127253618ab8abe9d36bf2e6196556d3..4c2c1a8b9fc30574ff05561b3f878bea50431eba 100644 (file)
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        src/mac/carbon/dcclient.cpp
-// Purpose:     wxClientDC class
+// Purpose:     wxClientDCImpl class
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     01/02/97
 #include "wx/mac/private.h"
 
 //-----------------------------------------------------------------------------
-// constants
+// wxWindowDCImpl
 //-----------------------------------------------------------------------------
 
-//-----------------------------------------------------------------------------
-// wxPaintDC
-//-----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
-IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
-IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
-
-/*
- * wxWindowDC
- */
-
-#include "wx/mac/uma.h"
-#include "wx/notebook.h"
-#include "wx/tabctrl.h"
-
+IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxGCDCImpl)
 
-static wxBrush MacGetBackgroundBrush( wxWindow* window )
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
+   : wxGCDCImpl( owner )
 {
-    wxBrush bkdBrush = window->MacGetBackgroundBrush() ;
-    return bkdBrush ;
-}
-
-wxWindowDC::wxWindowDC()
-{
-    m_window = NULL ;
     m_release = false;
 }
 
-wxWindowDC::wxWindowDC(wxWindow *window)
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window )
+   : wxGCDCImpl( owner )
 {
-    m_window = window ;
-    wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
+    m_window = window;
+    
+    WindowRef rootwindow = (WindowRef) window->MacGetTopLevelWindowRef() ;
     if (!rootwindow)
         return;
 
@@ -87,14 +68,14 @@ wxWindowDC::wxWindowDC(wxWindow *window)
 
         SetGraphicsContext( wxGraphicsContext::CreateFromNative( cg ) );
     }
-    SetClippingRegion( 0 , 0 , m_width , m_height ) ;
+    DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
 
-    SetBackground(MacGetBackgroundBrush(window));
+    SetBackground(wxBrush(window->GetBackgroundColour(),wxSOLID));
 
     SetFont( window->GetFont() ) ;
 }
 
-wxWindowDC::~wxWindowDC()
+wxWindowDCImpl::~wxWindowDCImpl()
 {
     if ( m_release )
     {
@@ -105,7 +86,7 @@ wxWindowDC::~wxWindowDC()
     }
 }
 
-void wxWindowDC::DoGetSize( int* width, int* height ) const
+void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
 {
     if ( width )
         *width = m_width;
@@ -113,17 +94,20 @@ void wxWindowDC::DoGetSize( int* width, int* height ) const
         *height = m_height;
 }
 
-wxBitmap wxWindowDC::DoGetAsBitmap(const wxRect *subrect) const
+wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
 {
     // wxScreenDC is derived from wxWindowDC, so a screen dc will
     // call this method when a Blit is performed with it as a source.
     if (!m_window)
         return wxNullBitmap;
 
+#ifdef __LP64__
+    return wxNullBitmap;
+#else
     ControlRef handle = (ControlRef) m_window->GetHandle();
     if ( !handle )
         return wxNullBitmap;
-
+    
     HIRect rect;
     CGImageRef image;
     CGContextRef context;
@@ -166,49 +150,54 @@ wxBitmap wxWindowDC::DoGetAsBitmap(const wxRect *subrect) const
     }
 
     return bmp;
+#endif
 }
 
 /*
- * wxClientDC
+ * wxClientDCImpl
  */
 
-wxClientDC::wxClientDC()
+IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
+
+wxClientDCImpl::wxClientDCImpl( wxDC *owner )
+ : wxWindowDCImpl( owner )
 {
-    m_window = NULL ;
 }
 
-wxClientDC::wxClientDC(wxWindow *window) :
-    wxWindowDC( window )
+wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) :
+    wxWindowDCImpl( owner, window )
 {
-    wxCHECK_RET( window, _T("invalid window in wxClientDC") );
+    wxCHECK_RET( window, _T("invalid window in wxClientDCImpl") );
     wxPoint origin = window->GetClientAreaOrigin() ;
     m_window->GetClientSize( &m_width , &m_height);
     SetDeviceOrigin( origin.x, origin.y );
-    SetClippingRegion( 0 , 0 , m_width , m_height ) ;
+    DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
 }
 
-wxClientDC::~wxClientDC()
+wxClientDCImpl::~wxClientDCImpl()
 {
 }
 
 /*
- * wxPaintDC
+ * wxPaintDCImpl
  */
 
-wxPaintDC::wxPaintDC()
+IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxWindowDCImpl)
+
+wxPaintDCImpl::wxPaintDCImpl( wxDC *owner )
+ : wxWindowDCImpl( owner )
 {
-    m_window = NULL ;
 }
 
-wxPaintDC::wxPaintDC(wxWindow *window) :
-    wxWindowDC( window )
+wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) :
+    wxWindowDCImpl( owner, window )
 {
     wxPoint origin = window->GetClientAreaOrigin() ;
     m_window->GetClientSize( &m_width , &m_height);
     SetDeviceOrigin( origin.x, origin.y );
-    SetClippingRegion( 0 , 0 , m_width , m_height ) ;
+    DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
 }
 
-wxPaintDC::~wxPaintDC()
+wxPaintDCImpl::~wxPaintDCImpl()
 {
 }