]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/carbon/dcscreen.cpp
cleanup, fixing exports
[wxWidgets.git] / src / mac / carbon / dcscreen.cpp
... / ...
CommitLineData
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
16#include "wx/mac/uma.h"
17#include "wx/graphics.h"
18
19IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
20
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
25// Create a DC representing the whole screen
26wxScreenDC::wxScreenDC()
27{
28#ifdef __LP64__
29 m_graphicContext = NULL;
30 m_ok = false ;
31#else
32 CGRect cgbounds ;
33 cgbounds = CGDisplayBounds(CGMainDisplayID());
34 Rect bounds;
35 bounds.top = (short)cgbounds.origin.y;
36 bounds.left = (short)cgbounds.origin.x;
37 bounds.bottom = bounds.top + (short)cgbounds.size.height;
38 bounds.right = bounds.left + (short)cgbounds.size.width;
39 WindowAttributes overlayAttributes = kWindowIgnoreClicksAttribute;
40 CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, (WindowRef*) &m_overlayWindow );
41 ShowWindow((WindowRef)m_overlayWindow);
42 SetGraphicsContext( wxGraphicsContext::CreateFromNativeWindow( m_overlayWindow ) );
43 m_width = (wxCoord)cgbounds.size.width;
44 m_height = (wxCoord)cgbounds.size.height;
45 m_ok = true ;
46#endif
47}
48
49wxScreenDC::~wxScreenDC()
50{
51 delete m_graphicContext;
52 m_graphicContext = NULL;
53#ifdef __LP64__
54#else
55 DisposeWindow((WindowRef) m_overlayWindow );
56#endif
57}