]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcscreen.cpp
pragma and prec-header patch applied
[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 #if TARGET_CARBON
29 m_macPort = CreateNewPort() ;
30 GrafPtr port ;
31 GetPort( &port ) ;
32 SetPort( (GrafPtr) m_macPort ) ;
33 Point pt = { 0,0 } ;
34 LocalToGlobal( &pt ) ;
35 SetPort( port ) ;
36 m_macLocalOrigin.x = -pt.h ;
37 m_macLocalOrigin.y = -pt.v ;
38 #else
39 m_macPort = LMGetWMgrPort() ;
40 m_macLocalOrigin.x = 0 ;
41 m_macLocalOrigin.y = 0 ;
42 #endif
43 m_ok = TRUE ;
44 BitMap screenBits;
45 GetQDGlobalsScreenBits( &screenBits );
46 m_minX = screenBits.bounds.left ;
47 #if TARGET_CARBON
48 SInt16 height ;
49 GetThemeMenuBarHeight( &height ) ;
50 m_minY = screenBits.bounds.top + height ;
51 #else
52 m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
53 #endif
54 m_maxX = screenBits.bounds.right ;
55 m_maxY = screenBits.bounds.bottom ;
56 MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
57 OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
58 CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
59 }
60
61 wxScreenDC::~wxScreenDC()
62 {
63 DisposePort( (CGrafPtr) m_macPort ) ;
64 }
65