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