]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/dcmemory.cpp
tab traversal now works better (using uninitialized variable was a bad idea :-)
[wxWidgets.git] / src / gtk1 / dcmemory.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: dcmemory.cpp
3// Purpose:
4// Author: Robert Roebling
5// Created: 01/02/97
6f65e337 6// RCS-ID: $Id$
c801d85f
KB
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
cf7a7e13
RR
17#ifdef USE_GDK_IMLIB
18#include "../gdk_imlib/gdk_imlib.h"
19#endif
20
c801d85f
KB
21//-----------------------------------------------------------------------------
22// wxMemoryDC
23//-----------------------------------------------------------------------------
24
25IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
26
27wxMemoryDC::wxMemoryDC(void)
28{
29 m_ok = FALSE;
cf7a7e13
RR
30
31#ifdef USE_GDK_IMLIB
32 m_cmap = gdk_imlib_get_colormap();
33#else
c801d85f 34 m_cmap = gdk_colormap_get_system();
cf7a7e13 35#endif
ff7b1510 36}
c801d85f
KB
37
38wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
39{
40 m_ok = FALSE;
cf7a7e13
RR
41
42#ifdef USE_GDK_IMLIB
43 m_cmap = gdk_imlib_get_colormap();
44#else
c801d85f 45 m_cmap = gdk_colormap_get_system();
cf7a7e13 46#endif
ff7b1510 47}
c801d85f
KB
48
49wxMemoryDC::~wxMemoryDC(void)
50{
ff7b1510 51}
c801d85f
KB
52
53void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
54{
55 m_selected = bitmap;
56 if (m_selected.Ok())
57 {
6f65e337
JS
58 if (m_selected.GetPixmap())
59 {
60 m_window = m_selected.GetPixmap();
61 }
62 else
63 {
64 m_window = m_selected.GetBitmap();
65 }
66
c801d85f 67 SetUpDC();
0180d5da
RR
68
69 m_isDrawable = FALSE;
c801d85f
KB
70 }
71 else
72 {
73 m_ok = FALSE;
c67daf87 74 m_window = (GdkWindow *) NULL;
ff7b1510
RR
75 }
76}
c801d85f 77
0180d5da 78void wxMemoryDC::GetSize( int *width, int *height ) const
c801d85f
KB
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;
ff7b1510
RR
89 }
90}
c801d85f
KB
91
92