]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/dcmemory.cpp
Added wxMiniFrame
[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
ec758a20 22wxMemoryDC::wxMemoryDC(void) : wxWindowDC()
c801d85f
KB
23{
24 m_ok = FALSE;
cf7a7e13 25
01111366 26 m_cmap = gtk_widget_get_default_colormap();
ff7b1510 27}
c801d85f 28
ec758a20
RR
29wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
30 : wxWindowDC()
c801d85f
KB
31{
32 m_ok = FALSE;
cf7a7e13 33
01111366 34 m_cmap = gtk_widget_get_default_colormap();
ff7b1510 35}
c801d85f
KB
36
37wxMemoryDC::~wxMemoryDC(void)
38{
ff7b1510 39}
c801d85f
KB
40
41void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
42{
43 m_selected = bitmap;
44 if (m_selected.Ok())
45 {
6f65e337
JS
46 if (m_selected.GetPixmap())
47 {
48 m_window = m_selected.GetPixmap();
49 }
50 else
51 {
52 m_window = m_selected.GetBitmap();
53 }
54
c801d85f 55 SetUpDC();
0180d5da 56
fc54776e 57 m_isMemDC = TRUE;
c801d85f
KB
58 }
59 else
60 {
61 m_ok = FALSE;
c67daf87 62 m_window = (GdkWindow *) NULL;
ff7b1510
RR
63 }
64}
c801d85f 65
0180d5da 66void wxMemoryDC::GetSize( int *width, int *height ) const
c801d85f
KB
67{
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;
ff7b1510
RR
77 }
78}
c801d85f
KB
79
80