]>
Commit | Line | Data |
---|---|---|
e9576ca5 | 1 | ///////////////////////////////////////////////////////////////////////////// |
11dbb4bf | 2 | // Name: src/mac/carbon/dcscreen.cpp |
e9576ca5 | 3 | // Purpose: wxScreenDC class |
a31a5f85 | 4 | // Author: Stefan Csomor |
e9576ca5 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
e9576ca5 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
11dbb4bf | 9 | // Licence: wxWindows licence |
e9576ca5 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
3d1a4878 SC |
12 | #include "wx/wxprec.h" |
13 | ||
e9576ca5 | 14 | #include "wx/dcscreen.h" |
11dbb4bf | 15 | |
2f1ae414 | 16 | #include "wx/mac/uma.h" |
e9576ca5 | 17 | |
e9576ca5 | 18 | IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) |
e9576ca5 SC |
19 | |
20 | // Create a DC representing the whole screen | |
21 | wxScreenDC::wxScreenDC() | |
22 | { | |
4f74e0d1 | 23 | #ifndef __LP64__ |
fa9666fb | 24 | m_macPort = CreateNewPort() ; |
e40298d5 JS |
25 | GrafPtr port ; |
26 | GetPort( &port ) ; | |
27 | SetPort( (GrafPtr) m_macPort ) ; | |
28 | Point pt = { 0,0 } ; | |
11dbb4bf | 29 | LocalToGlobal( &pt ) ; |
e40298d5 JS |
30 | SetPort( port ) ; |
31 | m_macLocalOrigin.x = -pt.h ; | |
32 | m_macLocalOrigin.y = -pt.v ; | |
ec17cfa9 | 33 | #if wxMAC_USE_CORE_GRAPHICS |
1181ee3f | 34 | m_macLocalOriginInPort = m_macLocalOrigin ; |
ec17cfa9 | 35 | #endif |
e40298d5 JS |
36 | BitMap screenBits; |
37 | GetQDGlobalsScreenBits( &screenBits ); | |
cc44c710 | 38 | m_minX = screenBits.bounds.left ; |
20b69855 | 39 | |
cc44c710 SC |
40 | SInt16 height ; |
41 | GetThemeMenuBarHeight( &height ) ; | |
42 | m_minY = screenBits.bounds.top + height ; | |
20b69855 | 43 | |
e40298d5 JS |
44 | m_maxX = screenBits.bounds.right ; |
45 | m_maxY = screenBits.bounds.bottom ; | |
cc44c710 SC |
46 | |
47 | #if wxMAC_USE_CORE_GRAPHICS | |
11dbb4bf | 48 | m_graphicContext = new wxMacCGContext( port ) ; |
cc44c710 | 49 | #else |
e40298d5 JS |
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 ) ; | |
20b69855 | 53 | #endif |
11dbb4bf | 54 | m_ok = true ; |
4f74e0d1 | 55 | #endif |
e9576ca5 SC |
56 | } |
57 | ||
58 | wxScreenDC::~wxScreenDC() | |
11dbb4bf | 59 | { |
20b69855 | 60 | #if wxMAC_USE_CORE_GRAPHICS |
cc44c710 SC |
61 | delete m_graphicContext ; |
62 | m_graphicContext = NULL ; | |
20b69855 | 63 | #endif |
cc44c710 | 64 | |
4f74e0d1 | 65 | #ifndef __LP64__ |
cc44c710 SC |
66 | if ( m_macPort ) |
67 | DisposePort( (CGrafPtr) m_macPort ) ; | |
4f74e0d1 | 68 | #endif |
e9576ca5 | 69 | } |