]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/dcmemory.cpp
fixed MouseUp handling when window was captured
[wxWidgets.git] / src / mac / carbon / dcmemory.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: dcmemory.cpp
3// Purpose: wxMemoryDC class
4// Author: AUTHOR
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "dcmemory.h"
14#endif
15
16#include "wx/dcmemory.h"
76a5e5d2 17#include "wx/mac/private.h"
e9576ca5
SC
18
19//-----------------------------------------------------------------------------
20// wxMemoryDC
21//-----------------------------------------------------------------------------
22
23IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
24
25wxMemoryDC::wxMemoryDC(void)
26{
0a67a93b
SC
27 m_ok = TRUE;
28 SetBackground(*wxWHITE_BRUSH);
29 SetBrush(*wxWHITE_BRUSH);
30 SetPen(*wxBLACK_PEN);
e9576ca5
SC
31 m_ok = FALSE;
32};
33
34wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
35{
0a67a93b
SC
36 m_ok = TRUE;
37 SetBackground(*wxWHITE_BRUSH);
38 SetBrush(*wxWHITE_BRUSH);
39 SetPen(*wxBLACK_PEN);
e9576ca5
SC
40 m_ok = FALSE;
41};
42
3dec57ad 43wxMemoryDC::~wxMemoryDC()
e9576ca5 44{
2f1ae414
SC
45 if ( m_selected.Ok() )
46 {
76a5e5d2 47 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
2f1ae414 48 }
e9576ca5
SC
49};
50
51void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
52{
2f1ae414
SC
53 if ( m_selected.Ok() )
54 {
76a5e5d2 55 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
2f1ae414 56 }
3dec57ad
SC
57 m_selected = bitmap;
58 if (m_selected.Ok())
59 {
60 if ( m_selected.GetHBITMAP() )
519cb848 61 {
3dec57ad 62 m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
2f1ae414 63 LockPixels( GetGWorldPixMap( (CGrafPtr) m_macPort ) ) ;
8208e181
SC
64 wxMask * mask = bitmap.GetMask() ;
65 if ( mask )
66 {
67 m_macMask = mask->GetMaskBitmap() ;
68 }
66a09d47
SC
69 SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
70 CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
519cb848 71 m_ok = TRUE ;
519cb848
SC
72 }
73 else
74 {
3dec57ad 75 m_ok = FALSE;
519cb848 76 }
e9576ca5
SC
77 }
78 else
79 {
80 m_ok = FALSE;
3dec57ad
SC
81 }
82}
e9576ca5 83
0a67a93b 84void wxMemoryDC::DoGetSize( int *width, int *height ) const
e9576ca5
SC
85{
86 if (m_selected.Ok())
87 {
88 if (width) (*width) = m_selected.GetWidth();
89 if (height) (*height) = m_selected.GetHeight();
90 }
91 else
92 {
93 if (width) (*width) = 0;
94 if (height) (*height) = 0;
3dec57ad
SC
95 }
96}
e9576ca5
SC
97
98