]> git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/dcscreen.cpp
fixing #9910
[wxWidgets.git] / src / osx / carbon / dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/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 #include "wx/wxprec.h"
13
14 #include "wx/dcscreen.h"
15 #include "wx/osx/dcscreen.h"
16
17 #include "wx/osx/private.h"
18 #include "wx/graphics.h"
19
20 IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
21
22 // TODO : for the Screenshot use case, which doesn't work in Quartz
23 // we should do a GetAsBitmap using something like
24 // http://www.cocoabuilder.com/archive/message/cocoa/2005/8/13/144256
25
26 // Create a DC representing the whole screen
27 wxScreenDCImpl::wxScreenDCImpl( wxDC *owner ) :
28 wxWindowDCImpl( owner )
29 {
30 #if wxOSX_USE_COCOA_OR_IPHONE
31 m_graphicContext = NULL;
32 m_ok = false ;
33 #else
34 CGRect cgbounds ;
35 cgbounds = CGDisplayBounds(CGMainDisplayID());
36 Rect bounds;
37 bounds.top = (short)cgbounds.origin.y;
38 bounds.left = (short)cgbounds.origin.x;
39 bounds.bottom = bounds.top + (short)cgbounds.size.height;
40 bounds.right = bounds.left + (short)cgbounds.size.width;
41 WindowAttributes overlayAttributes = kWindowIgnoreClicksAttribute;
42 CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, (WindowRef*) &m_overlayWindow );
43 ShowWindow((WindowRef)m_overlayWindow);
44 SetGraphicsContext( wxGraphicsContext::CreateFromNativeWindow( m_overlayWindow ) );
45 m_width = (wxCoord)cgbounds.size.width;
46 m_height = (wxCoord)cgbounds.size.height;
47 m_ok = true ;
48 #endif
49 }
50
51 wxScreenDCImpl::~wxScreenDCImpl()
52 {
53 delete m_graphicContext;
54 m_graphicContext = NULL;
55 #if wxOSX_USE_COCOA_OR_IPHONE
56 #else
57 DisposeWindow((WindowRef) m_overlayWindow );
58 #endif
59 }