]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/dcmemory.cpp
wxListBox::FindString(): it's not an error if the string is not found, so
[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 #ifdef USE_GDK_IMLIB
18 #include "../gdk_imlib/gdk_imlib.h"
19 #endif
20
21 //-----------------------------------------------------------------------------
22 // wxMemoryDC
23 //-----------------------------------------------------------------------------
24
25 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
26
27 wxMemoryDC::wxMemoryDC(void)
28 {
29 m_ok = FALSE;
30
31 #ifdef USE_GDK_IMLIB
32 m_cmap = gdk_imlib_get_colormap();
33 #else
34 m_cmap = gdk_colormap_get_system();
35 #endif
36 }
37
38 wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
39 {
40 m_ok = FALSE;
41
42 #ifdef USE_GDK_IMLIB
43 m_cmap = gdk_imlib_get_colormap();
44 #else
45 m_cmap = gdk_colormap_get_system();
46 #endif
47 }
48
49 wxMemoryDC::~wxMemoryDC(void)
50 {
51 }
52
53 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
54 {
55 m_selected = bitmap;
56 if (m_selected.Ok())
57 {
58 if (m_selected.GetPixmap())
59 {
60 m_window = m_selected.GetPixmap();
61 }
62 else
63 {
64 m_window = m_selected.GetBitmap();
65 }
66
67 SetUpDC();
68
69 m_isDrawable = FALSE;
70 }
71 else
72 {
73 m_ok = FALSE;
74 m_window = (GdkWindow *) NULL;
75 }
76 }
77
78 void wxMemoryDC::GetSize( int *width, int *height ) const
79 {
80 if (m_selected.Ok())
81 {
82 if (width) (*width) = m_selected.GetWidth();
83 if (height) (*height) = m_selected.GetHeight();
84 }
85 else
86 {
87 if (width) (*width) = 0;
88 if (height) (*height) = 0;
89 }
90 }
91
92