]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dcmemory.cpp | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Created: 01/02/97 | |
6f65e337 | 6 | // RCS-ID: $Id$ |
c801d85f KB |
7 | // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifdef __GNUG__ | |
12 | #pragma implementation "dcmemory.h" | |
13 | #endif | |
14 | ||
15 | #include "wx/dcmemory.h" | |
16 | ||
17 | //----------------------------------------------------------------------------- | |
18 | // wxMemoryDC | |
19 | //----------------------------------------------------------------------------- | |
20 | ||
21 | IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC) | |
22 | ||
23 | wxMemoryDC::wxMemoryDC(void) | |
24 | { | |
25 | m_ok = FALSE; | |
26 | m_cmap = gdk_colormap_get_system(); | |
27 | }; | |
28 | ||
29 | wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) | |
30 | { | |
31 | m_ok = FALSE; | |
32 | m_cmap = gdk_colormap_get_system(); | |
33 | }; | |
34 | ||
35 | wxMemoryDC::~wxMemoryDC(void) | |
36 | { | |
37 | }; | |
38 | ||
39 | void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) | |
40 | { | |
41 | m_selected = bitmap; | |
42 | if (m_selected.Ok()) | |
43 | { | |
6f65e337 JS |
44 | if (m_selected.GetPixmap()) |
45 | { | |
46 | m_window = m_selected.GetPixmap(); | |
47 | } | |
48 | else | |
49 | { | |
50 | m_window = m_selected.GetBitmap(); | |
51 | } | |
52 | ||
c801d85f | 53 | SetUpDC(); |
0180d5da RR |
54 | |
55 | m_isDrawable = FALSE; | |
c801d85f KB |
56 | } |
57 | else | |
58 | { | |
59 | m_ok = FALSE; | |
60 | m_window = NULL; | |
61 | }; | |
62 | }; | |
63 | ||
0180d5da | 64 | void wxMemoryDC::GetSize( int *width, int *height ) const |
c801d85f KB |
65 | { |
66 | if (m_selected.Ok()) | |
67 | { | |
68 | if (width) (*width) = m_selected.GetWidth(); | |
69 | if (height) (*height) = m_selected.GetHeight(); | |
70 | } | |
71 | else | |
72 | { | |
73 | if (width) (*width) = 0; | |
74 | if (height) (*height) = 0; | |
75 | }; | |
76 | }; | |
77 | ||
78 |