]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/dcmemory.cpp
Listctrl updates
[wxWidgets.git] / src / gtk1 / dcmemory.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: dcmemory.cpp
3// Purpose:
4// Author: Robert Roebling
6f65e337 5// RCS-ID: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling
c801d85f
KB
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
ec758a20 20IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
c801d85f 21
4bc67cc5 22wxMemoryDC::wxMemoryDC() : wxWindowDC()
c801d85f 23{
4bc67cc5 24 m_ok = FALSE;
cf7a7e13 25
4bc67cc5 26 m_cmap = gtk_widget_get_default_colormap();
ff7b1510 27}
c801d85f 28
ec758a20
RR
29wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
30 : wxWindowDC()
c801d85f 31{
4bc67cc5 32 m_ok = FALSE;
cf7a7e13 33
4bc67cc5 34 m_cmap = gtk_widget_get_default_colormap();
ff7b1510 35}
c801d85f 36
4bc67cc5 37wxMemoryDC::~wxMemoryDC()
c801d85f 38{
ff7b1510 39}
c801d85f
KB
40
41void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
42{
4bc67cc5
RR
43 m_selected = bitmap;
44 if (m_selected.Ok())
6f65e337 45 {
4bc67cc5
RR
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;
6f65e337
JS
58 }
59 else
4bc67cc5
RR
60 {
61 m_ok = FALSE;
62 m_window = (GdkWindow *) NULL;
6f65e337 63 }
ff7b1510 64}
c801d85f 65
0180d5da 66void wxMemoryDC::GetSize( int *width, int *height ) const
c801d85f 67{
4bc67cc5
RR
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 }
ff7b1510 78}
c801d85f
KB
79
80