]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/dcscreen.cpp
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"
16 #include "wx/mac/uma.h"
18 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC
, wxWindowDC
)
20 // Create a DC representing the whole screen
21 wxScreenDC::wxScreenDC()
23 m_macPort
= CreateNewPort() ;
26 SetPort( (GrafPtr
) m_macPort
) ;
28 LocalToGlobal( &pt
) ;
30 m_macLocalOrigin
.x
= -pt
.h
;
31 m_macLocalOrigin
.y
= -pt
.v
;
32 #if wxMAC_USE_CORE_GRAPHICS
33 m_macLocalOriginInPort
= m_macLocalOrigin
;
36 GetQDGlobalsScreenBits( &screenBits
);
37 m_minX
= screenBits
.bounds
.left
;
40 GetThemeMenuBarHeight( &height
) ;
41 m_minY
= screenBits
.bounds
.top
+ height
;
43 m_maxX
= screenBits
.bounds
.right
;
44 m_maxY
= screenBits
.bounds
.bottom
;
46 #if wxMAC_USE_CORE_GRAPHICS
47 m_graphicContext
= new wxMacCGContext( port
) ;
49 MacSetRectRgn( (RgnHandle
) m_macBoundaryClipRgn
, m_minX
, m_minY
, m_maxX
, m_maxY
) ;
50 OffsetRgn( (RgnHandle
) m_macBoundaryClipRgn
, m_macLocalOrigin
.x
, m_macLocalOrigin
.y
) ;
51 CopyRgn( (RgnHandle
) m_macBoundaryClipRgn
, (RgnHandle
) m_macCurrentClipRgn
) ;
56 wxScreenDC::~wxScreenDC()
58 #if wxMAC_USE_CORE_GRAPHICS
59 delete m_graphicContext
;
60 m_graphicContext
= NULL
;
64 DisposePort( (CGrafPtr
) m_macPort
) ;