]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcscreen.cpp
cleanup for 10.5
[wxWidgets.git] / src / mac / carbon / dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/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
16 #include "wx/mac/uma.h"
17
18 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
19
20 // Create a DC representing the whole screen
21 wxScreenDC::wxScreenDC()
22 {
23 #ifndef __LP64__
24 m_macPort = CreateNewPort() ;
25 GrafPtr port ;
26 GetPort( &port ) ;
27 SetPort( (GrafPtr) m_macPort ) ;
28 Point pt = { 0,0 } ;
29 LocalToGlobal( &pt ) ;
30 SetPort( port ) ;
31 m_macLocalOrigin.x = -pt.h ;
32 m_macLocalOrigin.y = -pt.v ;
33 #if wxMAC_USE_CORE_GRAPHICS
34 m_macLocalOriginInPort = m_macLocalOrigin ;
35 #endif
36 BitMap screenBits;
37 GetQDGlobalsScreenBits( &screenBits );
38 m_minX = screenBits.bounds.left ;
39
40 SInt16 height ;
41 GetThemeMenuBarHeight( &height ) ;
42 m_minY = screenBits.bounds.top + height ;
43
44 m_maxX = screenBits.bounds.right ;
45 m_maxY = screenBits.bounds.bottom ;
46
47 #if wxMAC_USE_CORE_GRAPHICS
48 m_graphicContext = new wxMacCGContext( port ) ;
49 #else
50 MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
51 OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
52 CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
53 #endif
54 m_ok = true ;
55 #endif
56 }
57
58 wxScreenDC::~wxScreenDC()
59 {
60 #if wxMAC_USE_CORE_GRAPHICS
61 delete m_graphicContext ;
62 m_graphicContext = NULL ;
63 #endif
64
65 #ifndef __LP64__
66 if ( m_macPort )
67 DisposePort( (CGrafPtr) m_macPort ) ;
68 #endif
69 }