]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/dcmemory.cpp
wxTempFile bug corrected: the temp file is now created in the same dir
[wxWidgets.git] / src / gtk / dcmemory.cpp
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 else
56 {
57 m_ok = FALSE;
58 m_window = NULL;
59 };
60 };
61
62 void wxMemoryDC::GetSize( int *width, int *height )
63 {
64 if (m_selected.Ok())
65 {
66 if (width) (*width) = m_selected.GetWidth();
67 if (height) (*height) = m_selected.GetHeight();
68 }
69 else
70 {
71 if (width) (*width) = 0;
72 if (height) (*height) = 0;
73 };
74 };
75
76