]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: dcmemory.cpp | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Created: 01/02/97 | |
6 | // RCS-ID: $Id$ | |
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 | { | |
44 | if (m_selected.GetPixmap()) | |
45 | { | |
46 | m_window = m_selected.GetPixmap(); | |
47 | } | |
48 | else | |
49 | { | |
50 | m_window = m_selected.GetBitmap(); | |
51 | } | |
52 | ||
53 | SetUpDC(); | |
54 | ||
55 | m_isDrawable = FALSE; | |
56 | } | |
57 | else | |
58 | { | |
59 | m_ok = FALSE; | |
60 | m_window = NULL; | |
61 | }; | |
62 | }; | |
63 | ||
64 | void wxMemoryDC::GetSize( int *width, int *height ) const | |
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 |