]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/dcscreen.cpp
Move some things to wxBitmapBase to avoid much duplication.
[wxWidgets.git] / src / mac / carbon / dcscreen.cpp
CommitLineData
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 18IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
e9576ca5
SC
19
20// Create a DC representing the whole screen
21wxScreenDC::wxScreenDC()
22{
fa9666fb 23 m_macPort = CreateNewPort() ;
e40298d5
JS
24 GrafPtr port ;
25 GetPort( &port ) ;
26 SetPort( (GrafPtr) m_macPort ) ;
27 Point pt = { 0,0 } ;
11dbb4bf 28 LocalToGlobal( &pt ) ;
e40298d5
JS
29 SetPort( port ) ;
30 m_macLocalOrigin.x = -pt.h ;
31 m_macLocalOrigin.y = -pt.v ;
ec17cfa9 32#if wxMAC_USE_CORE_GRAPHICS
1181ee3f 33 m_macLocalOriginInPort = m_macLocalOrigin ;
ec17cfa9 34#endif
e40298d5
JS
35 BitMap screenBits;
36 GetQDGlobalsScreenBits( &screenBits );
cc44c710 37 m_minX = screenBits.bounds.left ;
20b69855 38
cc44c710
SC
39 SInt16 height ;
40 GetThemeMenuBarHeight( &height ) ;
41 m_minY = screenBits.bounds.top + height ;
20b69855 42
e40298d5
JS
43 m_maxX = screenBits.bounds.right ;
44 m_maxY = screenBits.bounds.bottom ;
cc44c710
SC
45
46#if wxMAC_USE_CORE_GRAPHICS
11dbb4bf 47 m_graphicContext = new wxMacCGContext( port ) ;
cc44c710 48#else
e40298d5
JS
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 ) ;
20b69855 52#endif
11dbb4bf 53 m_ok = true ;
e9576ca5
SC
54}
55
56wxScreenDC::~wxScreenDC()
11dbb4bf 57{
20b69855 58#if wxMAC_USE_CORE_GRAPHICS
cc44c710
SC
59 delete m_graphicContext ;
60 m_graphicContext = NULL ;
20b69855 61#endif
cc44c710
SC
62
63 if ( m_macPort )
64 DisposePort( (CGrafPtr) m_macPort ) ;
e9576ca5 65}