1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/dcscreen.cpp
3 // Purpose: wxScreenDC class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/dcscreen.h"
15 #include "wx/osx/dcscreen.h"
17 #include "wx/osx/private.h"
18 #include "wx/graphics.h"
20 IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl
, wxWindowDCImpl
)
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
26 // Create a DC representing the whole screen
27 wxScreenDCImpl::wxScreenDCImpl( wxDC
*owner
) :
28 wxWindowDCImpl( owner
)
30 #if wxOSX_USE_COCOA_OR_IPHONE
31 m_graphicContext
= NULL
;
35 cgbounds
= CGDisplayBounds(CGMainDisplayID());
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
;
51 wxScreenDCImpl::~wxScreenDCImpl()
53 delete m_graphicContext
;
54 m_graphicContext
= NULL
;
55 #if wxOSX_USE_COCOA_OR_IPHONE
57 DisposeWindow((WindowRef
) m_overlayWindow
);