]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcscreen.cpp
Added wx.lib.gestures module from Daniel Pozmanter which supports
[wxWidgets.git] / src / mac / carbon / dcscreen.cpp
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
21 #if !USE_SHARED_LIBRARY
22 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
23 #endif
24
25 // Create a DC representing the whole screen
26 wxScreenDC::wxScreenDC()
27 {
28 m_macPort = CreateNewPort() ;
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 ;
37 m_macLocalOriginInPort = m_macLocalOrigin ;
38
39 BitMap screenBits;
40 GetQDGlobalsScreenBits( &screenBits );
41 m_minX = screenBits.bounds.left ;
42
43 SInt16 height ;
44 GetThemeMenuBarHeight( &height ) ;
45 m_minY = screenBits.bounds.top + height ;
46
47 m_maxX = screenBits.bounds.right ;
48 m_maxY = screenBits.bounds.bottom ;
49
50 #if wxMAC_USE_CORE_GRAPHICS
51 m_graphicContext = new wxMacCGContext( port ) ;
52 #else
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 ) ;
56 #endif
57 m_ok = TRUE ;
58 }
59
60 wxScreenDC::~wxScreenDC()
61 {
62 #if wxMAC_USE_CORE_GRAPHICS
63 delete m_graphicContext ;
64 m_graphicContext = NULL ;
65 #endif
66
67 if ( m_macPort )
68 DisposePort( (CGrafPtr) m_macPort ) ;
69 }
70