]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcscreen.cpp
cleanup - reformat; minor code tweaks
[wxWidgets.git] / src / mac / carbon / dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcscreen.cpp
3 // Purpose: wxScreenDC class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #include "wx/dcscreen.h"
15 #include "wx/mac/uma.h"
16
17 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
18
19 // Create a DC representing the whole screen
20 wxScreenDC::wxScreenDC()
21 {
22 m_macPort = CreateNewPort() ;
23 GrafPtr port ;
24 GetPort( &port ) ;
25 SetPort( (GrafPtr) m_macPort ) ;
26 Point pt = { 0,0 } ;
27 LocalToGlobal( &pt ) ;
28 SetPort( port ) ;
29 m_macLocalOrigin.x = -pt.h ;
30 m_macLocalOrigin.y = -pt.v ;
31 #if wxMAC_USE_CORE_GRAPHICS
32 m_macLocalOriginInPort = m_macLocalOrigin ;
33 #endif
34 BitMap screenBits;
35 GetQDGlobalsScreenBits( &screenBits );
36 m_minX = screenBits.bounds.left ;
37
38 SInt16 height ;
39 GetThemeMenuBarHeight( &height ) ;
40 m_minY = screenBits.bounds.top + height ;
41
42 m_maxX = screenBits.bounds.right ;
43 m_maxY = screenBits.bounds.bottom ;
44
45 #if wxMAC_USE_CORE_GRAPHICS
46 m_graphicContext = new wxMacCGContext( port ) ;
47 #else
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 ) ;
51 #endif
52 m_ok = TRUE ;
53 }
54
55 wxScreenDC::~wxScreenDC()
56 {
57 #if wxMAC_USE_CORE_GRAPHICS
58 delete m_graphicContext ;
59 m_graphicContext = NULL ;
60 #endif
61
62 if ( m_macPort )
63 DisposePort( (CGrafPtr) m_macPort ) ;
64 }
65