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