]>
Commit | Line | Data |
---|---|---|
e9576ca5 | 1 | ///////////////////////////////////////////////////////////////////////////// |
11dbb4bf | 2 | // Name: src/mac/carbon/dcscreen.cpp |
e9576ca5 | 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 |
11dbb4bf | 9 | // Licence: wxWindows licence |
e9576ca5 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
3d1a4878 SC |
12 | #include "wx/wxprec.h" |
13 | ||
e9576ca5 | 14 | #include "wx/dcscreen.h" |
11dbb4bf | 15 | |
2f1ae414 | 16 | #include "wx/mac/uma.h" |
8acd14d1 | 17 | #include "wx/graphics.h" |
e9576ca5 | 18 | |
e9576ca5 | 19 | IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) |
e9576ca5 | 20 | |
6239ee05 SC |
21 | // TODO : for the Screenshot use case, which doesn't work in Quartz |
22 | // we should do a GetAsBitmap using something like | |
23 | // http://www.cocoabuilder.com/archive/message/cocoa/2005/8/13/144256 | |
24 | ||
e9576ca5 SC |
25 | // Create a DC representing the whole screen |
26 | wxScreenDC::wxScreenDC() | |
27 | { | |
a2d6d210 | 28 | CGRect cgbounds ; |
513b47e9 | 29 | cgbounds = CGDisplayBounds(CGMainDisplayID()); |
a2d6d210 VZ |
30 | Rect bounds; |
31 | bounds.top = (short)cgbounds.origin.y; | |
32 | bounds.left = (short)cgbounds.origin.x; | |
33 | bounds.bottom = bounds.top + (short)cgbounds.size.height; | |
34 | bounds.right = bounds.left + (short)cgbounds.size.width; | |
513b47e9 | 35 | WindowAttributes overlayAttributes = kWindowIgnoreClicksAttribute; |
a2d6d210 VZ |
36 | CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, (WindowRef*) &m_overlayWindow ); |
37 | ShowWindow((WindowRef)m_overlayWindow); | |
513b47e9 | 38 | SetGraphicsContext( wxGraphicsContext::CreateFromNativeWindow( m_overlayWindow ) ); |
a2d6d210 VZ |
39 | m_width = (wxCoord)cgbounds.size.width; |
40 | m_height = (wxCoord)cgbounds.size.height; | |
a2d6d210 | 41 | m_ok = true ; |
e9576ca5 SC |
42 | } |
43 | ||
44 | wxScreenDC::~wxScreenDC() | |
11dbb4bf | 45 | { |
a2d6d210 VZ |
46 | delete m_graphicContext; |
47 | m_graphicContext = NULL; | |
48 | DisposeWindow((WindowRef) m_overlayWindow ); | |
e9576ca5 | 49 | } |