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