]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/dcscreen.cpp
Sort of autoresize if only 1 column is there
[wxWidgets.git] / src / mac / carbon / dcscreen.cpp
CommitLineData
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"
888dde65 15#include "wx/mac/carbon/dcscreen.h"
11dbb4bf 16
2f1ae414 17#include "wx/mac/uma.h"
8acd14d1 18#include "wx/graphics.h"
e9576ca5 19
888dde65 20IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
e9576ca5 21
6239ee05
SC
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
e9576ca5 26// Create a DC representing the whole screen
888dde65
RR
27wxScreenDCImpl::wxScreenDCImpl( wxDC *owner ) :
28 wxWindowDCImpl( owner )
e9576ca5 29{
1bd568fa
SC
30#ifdef __LP64__
31 m_graphicContext = NULL;
32 m_ok = false ;
33#else
a2d6d210 34 CGRect cgbounds ;
513b47e9 35 cgbounds = CGDisplayBounds(CGMainDisplayID());
a2d6d210
VZ
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;
513b47e9 41 WindowAttributes overlayAttributes = kWindowIgnoreClicksAttribute;
a2d6d210
VZ
42 CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, (WindowRef*) &m_overlayWindow );
43 ShowWindow((WindowRef)m_overlayWindow);
513b47e9 44 SetGraphicsContext( wxGraphicsContext::CreateFromNativeWindow( m_overlayWindow ) );
a2d6d210
VZ
45 m_width = (wxCoord)cgbounds.size.width;
46 m_height = (wxCoord)cgbounds.size.height;
a2d6d210 47 m_ok = true ;
1bd568fa 48#endif
e9576ca5
SC
49}
50
888dde65 51wxScreenDCImpl::~wxScreenDCImpl()
11dbb4bf 52{
a2d6d210
VZ
53 delete m_graphicContext;
54 m_graphicContext = NULL;
1bd568fa
SC
55#ifdef __LP64__
56#else
a2d6d210 57 DisposeWindow((WindowRef) m_overlayWindow );
1bd568fa 58#endif
e9576ca5 59}