]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/dcscreen.cpp
wxPalmOS build fix.
[wxWidgets.git] / src / mac / carbon / dcscreen.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: dcscreen.cpp
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
65571936 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
3d1a4878
SC
12#include "wx/wxprec.h"
13
e9576ca5 14#include "wx/dcscreen.h"
2f1ae414 15#include "wx/mac/uma.h"
e9576ca5 16
e9576ca5 17IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
e9576ca5
SC
18
19// Create a DC representing the whole screen
20wxScreenDC::wxScreenDC()
21{
fa9666fb 22 m_macPort = CreateNewPort() ;
e40298d5
JS
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 ;
ec17cfa9 31#if wxMAC_USE_CORE_GRAPHICS
1181ee3f 32 m_macLocalOriginInPort = m_macLocalOrigin ;
ec17cfa9 33#endif
e40298d5
JS
34 BitMap screenBits;
35 GetQDGlobalsScreenBits( &screenBits );
cc44c710 36 m_minX = screenBits.bounds.left ;
20b69855 37
cc44c710
SC
38 SInt16 height ;
39 GetThemeMenuBarHeight( &height ) ;
40 m_minY = screenBits.bounds.top + height ;
20b69855 41
e40298d5
JS
42 m_maxX = screenBits.bounds.right ;
43 m_maxY = screenBits.bounds.bottom ;
cc44c710
SC
44
45#if wxMAC_USE_CORE_GRAPHICS
46 m_graphicContext = new wxMacCGContext( port ) ;
47#else
e40298d5
JS
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 ) ;
20b69855 51#endif
cc44c710 52 m_ok = TRUE ;
e9576ca5
SC
53}
54
55wxScreenDC::~wxScreenDC()
fa9666fb 56{
20b69855 57#if wxMAC_USE_CORE_GRAPHICS
cc44c710
SC
58 delete m_graphicContext ;
59 m_graphicContext = NULL ;
20b69855 60#endif
cc44c710
SC
61
62 if ( m_macPort )
63 DisposePort( (CGrafPtr) m_macPort ) ;
e9576ca5
SC
64}
65