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