]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxScreenDC class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/dcscreen.h"
15 #include "wx/mac/uma.h"
17 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC
, wxWindowDC
)
19 // Create a DC representing the whole screen
20 wxScreenDC::wxScreenDC()
22 m_macPort
= CreateNewPort() ;
25 SetPort( (GrafPtr
) m_macPort
) ;
27 LocalToGlobal( &pt
) ;
29 m_macLocalOrigin
.x
= -pt
.h
;
30 m_macLocalOrigin
.y
= -pt
.v
;
31 #if wxMAC_USE_CORE_GRAPHICS
32 m_macLocalOriginInPort
= m_macLocalOrigin
;
35 GetQDGlobalsScreenBits( &screenBits
);
36 m_minX
= screenBits
.bounds
.left
;
39 GetThemeMenuBarHeight( &height
) ;
40 m_minY
= screenBits
.bounds
.top
+ height
;
42 m_maxX
= screenBits
.bounds
.right
;
43 m_maxY
= screenBits
.bounds
.bottom
;
45 #if wxMAC_USE_CORE_GRAPHICS
46 m_graphicContext
= new wxMacCGContext( port
) ;
48 MacSetRectRgn( (RgnHandle
) m_macBoundaryClipRgn
, m_minX
, m_minY
, m_maxX
, m_maxY
) ;
49 OffsetRgn( (RgnHandle
) m_macBoundaryClipRgn
, m_macLocalOrigin
.x
, m_macLocalOrigin
.y
) ;
50 CopyRgn( (RgnHandle
) m_macBoundaryClipRgn
, (RgnHandle
) m_macCurrentClipRgn
) ;
55 wxScreenDC::~wxScreenDC()
57 #if wxMAC_USE_CORE_GRAPHICS
58 delete m_graphicContext
;
59 m_graphicContext
= NULL
;
63 DisposePort( (CGrafPtr
) m_macPort
) ;