]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcclient.cpp
c90d675f8dad8e567b7464e179484aa0d003930c
   1 ///////////////////////////////////////////////////////////////////////////// 
   3 // Purpose:     wxClientDC class 
   8 // Copyright:   (c) AUTHOR 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  13 #pragma implementation "dcclient.h" 
  16 #include "wx/dcclient.h" 
  17 #include "wx/dcmemory.h" 
  18 #include "wx/region.h" 
  19 #include "wx/window.h" 
  22 //----------------------------------------------------------------------------- 
  24 //----------------------------------------------------------------------------- 
  26 #define RAD2DEG 57.2957795131 
  28 //----------------------------------------------------------------------------- 
  30 //----------------------------------------------------------------------------- 
  32 #if !USE_SHARED_LIBRARY 
  33 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC
, wxDC
) 
  34 IMPLEMENT_DYNAMIC_CLASS(wxClientDC
, wxWindowDC
) 
  35 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC
, wxWindowDC
) 
  42 #include "wx/mac/uma.h" 
  44 wxWindowDC::wxWindowDC()  
  48 wxWindowDC::wxWindowDC(wxWindow 
*the_canvas
)  
  51         wxWindowMac
* rootwindow 
; 
  53         // this time it is really the full window 
  55         the_canvas
->MacGetPortParams(&m_macLocalOrigin
, &clipRect 
, &windowref 
, &rootwindow 
); 
  56         SetRectRgn( m_macBoundaryClipRgn 
, clipRect
.left 
, clipRect
.top 
, clipRect
.right 
, clipRect
.bottom 
) ; 
  57         SectRgn( m_macBoundaryClipRgn 
, the_canvas
->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn 
) ; 
  58         CopyRgn( m_macBoundaryClipRgn 
, m_macCurrentClipRgn 
) ; 
  59         m_macPort 
= UMAGetWindowPort( windowref 
) ; 
  61         wxSize size 
= the_canvas
->GetSize() ; 
  66   SetBackground(the_canvas
->MacGetBackgroundBrush()); 
  69 wxWindowDC::~wxWindowDC() 
  77 wxClientDC::wxClientDC() 
  81 wxClientDC::wxClientDC(wxWindow 
*window
) 
  84         wxWindowMac
* rootwindow 
; 
  87         wxPoint origin 
= window
->GetClientAreaOrigin() ; 
  89         window
->MacGetPortClientParams(&m_macLocalOrigin
, &clipRect 
, &windowref 
, &rootwindow 
); 
  90         SetRectRgn( m_macBoundaryClipRgn 
, clipRect
.left 
+ origin
.x 
, clipRect
.top 
+ origin
.y 
, clipRect
.right 
+ origin
.x 
, clipRect
.bottom 
+ origin
.y 
) ; 
  91         SectRgn( m_macBoundaryClipRgn 
, window
->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn 
) ; 
  92         OffsetRgn( m_macBoundaryClipRgn 
, -origin
.x 
, -origin
.y 
) ; 
  93         CopyRgn( m_macBoundaryClipRgn 
, m_macCurrentClipRgn 
) ; 
  94         m_macPort 
= UMAGetWindowPort( windowref 
) ; 
  96         wxSize size 
= window
->GetSize() ; 
 100   SetBackground(window
->MacGetBackgroundBrush()); 
 101         SetFont( window
->GetFont() ) ; 
 104 wxClientDC::~wxClientDC() 
 112 wxPaintDC::wxPaintDC() 
 116 wxPaintDC::wxPaintDC(wxWindow 
*window
) 
 118         WindowRef windowref 
; 
 119         wxWindowMac
* rootwindow 
; 
 122         wxPoint origin 
= window
->GetClientAreaOrigin() ; 
 124         window
->MacGetPortClientParams(&m_macLocalOrigin
, &clipRect 
, &windowref 
, &rootwindow 
); 
 125         SetRectRgn( m_macBoundaryClipRgn 
, clipRect
.left 
+ origin
.x 
, clipRect
.top 
+ origin
.y 
, clipRect
.right 
+ origin
.x 
, clipRect
.bottom 
+ origin
.y 
) ; 
 126         SectRgn( m_macBoundaryClipRgn 
, window
->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn 
) ; 
 127         OffsetRgn( m_macBoundaryClipRgn 
, -origin
.x 
, -origin
.y 
) ; 
 128   SectRgn( m_macBoundaryClipRgn  
, window
->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn 
) ; 
 129         CopyRgn( m_macBoundaryClipRgn 
, m_macCurrentClipRgn 
) ; 
 130         m_macPort 
= UMAGetWindowPort( windowref 
) ; 
 133         wxCoord x , y ,w , h ; 
 134         window->GetUpdateRegion().GetBox( x , y , w , h ) ; 
 136         wxSize size = window->GetSize() ; 
 139         SetClippingRegion( x , y , w , h ) ; 
 141   SetBackground(window
->MacGetBackgroundBrush()); 
 142   SetFont(window
->GetFont() ) ; 
 145 wxPaintDC::~wxPaintDC()