]> git.saurik.com Git - wxWidgets.git/blob - src/mac/dcmemory.cpp
changed wxSystemSettings::HasFrameDecorations to more general GetCapability(index)
[wxWidgets.git] / src / mac / dcmemory.cpp
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"
17
18 //-----------------------------------------------------------------------------
19 // wxMemoryDC
20 //-----------------------------------------------------------------------------
21
22 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
23
24 wxMemoryDC::wxMemoryDC(void)
25 {
26 m_ok = TRUE;
27 SetBackground(*wxWHITE_BRUSH);
28 SetBrush(*wxWHITE_BRUSH);
29 SetPen(*wxBLACK_PEN);
30 m_ok = FALSE;
31 };
32
33 wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
34 {
35 m_ok = TRUE;
36 SetBackground(*wxWHITE_BRUSH);
37 SetBrush(*wxWHITE_BRUSH);
38 SetPen(*wxBLACK_PEN);
39 m_ok = FALSE;
40 };
41
42 wxMemoryDC::~wxMemoryDC()
43 {
44 if ( m_selected.Ok() )
45 {
46 UnlockPixels( GetGWorldPixMap(m_selected.GetHBITMAP()) );
47 }
48 };
49
50 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
51 {
52 if ( m_selected.Ok() )
53 {
54 UnlockPixels( GetGWorldPixMap(m_selected.GetHBITMAP()) );
55 }
56 m_selected = bitmap;
57 if (m_selected.Ok())
58 {
59 if ( m_selected.GetHBITMAP() )
60 {
61 m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
62 LockPixels( GetGWorldPixMap( (CGrafPtr) m_macPort ) ) ;
63 wxMask * mask = bitmap.GetMask() ;
64 if ( mask )
65 {
66 m_macMask = mask->GetMaskBitmap() ;
67 }
68 m_ok = TRUE ;
69 }
70 else
71 {
72 m_ok = FALSE;
73 }
74 }
75 else
76 {
77 m_ok = FALSE;
78 }
79 }
80
81 void wxMemoryDC::DoGetSize( int *width, int *height ) const
82 {
83 if (m_selected.Ok())
84 {
85 if (width) (*width) = m_selected.GetWidth();
86 if (height) (*height) = m_selected.GetHeight();
87 }
88 else
89 {
90 if (width) (*width) = 0;
91 if (height) (*height) = 0;
92 }
93 }
94
95