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