]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/dcmemory.cpp
Bit of CVS clean-up
[wxWidgets.git] / src / gtk / 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 //-----------------------------------------------------------------------------
17 // wxMemoryDC
18 //-----------------------------------------------------------------------------
19
20 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
21
22 wxMemoryDC::wxMemoryDC() : wxWindowDC()
23 {
24 m_ok = FALSE;
25
26 m_cmap = gtk_widget_get_default_colormap();
27 }
28
29 wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
30 : wxWindowDC()
31 {
32 m_ok = FALSE;
33
34 m_cmap = gtk_widget_get_default_colormap();
35 }
36
37 wxMemoryDC::~wxMemoryDC()
38 {
39 }
40
41 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
42 {
43 m_selected = bitmap;
44 if (m_selected.Ok())
45 {
46 if (m_selected.GetPixmap())
47 {
48 m_window = m_selected.GetPixmap();
49 }
50 else
51 {
52 m_window = m_selected.GetBitmap();
53 }
54
55 SetUpDC();
56
57 m_isMemDC = TRUE;
58 }
59 else
60 {
61 m_ok = FALSE;
62 m_window = (GdkWindow *) NULL;
63 }
64 }
65
66 void wxMemoryDC::GetSize( int *width, int *height ) const
67 {
68 if (m_selected.Ok())
69 {
70 if (width) (*width) = m_selected.GetWidth();
71 if (height) (*height) = m_selected.GetHeight();
72 }
73 else
74 {
75 if (width) (*width) = 0;
76 if (height) (*height) = 0;
77 }
78 }
79
80