]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/dcmemory.cpp
wxMenu ctor made compatible again
[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
83624f79
RR
16#include "gdk/gdk.h"
17#include "gtk/gtk.h"
18
c801d85f
KB
19//-----------------------------------------------------------------------------
20// wxMemoryDC
21//-----------------------------------------------------------------------------
22
ec758a20 23IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
c801d85f 24
4bc67cc5 25wxMemoryDC::wxMemoryDC() : wxWindowDC()
c801d85f 26{
4bc67cc5 27 m_ok = FALSE;
cf7a7e13 28
4bc67cc5 29 m_cmap = gtk_widget_get_default_colormap();
ff7b1510 30}
c801d85f 31
ec758a20
RR
32wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
33 : wxWindowDC()
c801d85f 34{
4bc67cc5 35 m_ok = FALSE;
cf7a7e13 36
4bc67cc5 37 m_cmap = gtk_widget_get_default_colormap();
ff7b1510 38}
c801d85f 39
4bc67cc5 40wxMemoryDC::~wxMemoryDC()
c801d85f 41{
ff7b1510 42}
c801d85f
KB
43
44void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
45{
4bc67cc5
RR
46 m_selected = bitmap;
47 if (m_selected.Ok())
6f65e337 48 {
4bc67cc5
RR
49 if (m_selected.GetPixmap())
50 {
51 m_window = m_selected.GetPixmap();
52 }
53 else
54 {
55 m_window = m_selected.GetBitmap();
56 }
57
58 SetUpDC();
59
60 m_isMemDC = TRUE;
6f65e337
JS
61 }
62 else
4bc67cc5
RR
63 {
64 m_ok = FALSE;
65 m_window = (GdkWindow *) NULL;
6f65e337 66 }
ff7b1510 67}
c801d85f 68
4e4ea166 69void wxMemoryDC::DoGetSize( int *width, int *height ) const
c801d85f 70{
4bc67cc5
RR
71 if (m_selected.Ok())
72 {
73 if (width) (*width) = m_selected.GetWidth();
74 if (height) (*height) = m_selected.GetHeight();
75 }
76 else
77 {
78 if (width) (*width) = 0;
79 if (height) (*height) = 0;
80 }
ff7b1510 81}
c801d85f
KB
82
83