]> git.saurik.com Git - wxWidgets.git/blame - src/x11/dcmemory.cpp
removed some commented-out code
[wxWidgets.git] / src / x11 / dcmemory.cpp
CommitLineData
83df96d6 1/////////////////////////////////////////////////////////////////////////////
de6185e2 2// Name: src/x11/dcmemory.cpp
83df96d6
JS
3// Purpose: wxMemoryDC class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
de6185e2 9// Licence: wxWindows licence
83df96d6
JS
10/////////////////////////////////////////////////////////////////////////////
11
de6185e2
WS
12// for compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
83df96d6 15#include "wx/dcmemory.h"
de6185e2
WS
16
17#ifndef WX_PRECOMP
18 #include "wx/utils.h"
9eddec69 19 #include "wx/settings.h"
de6185e2
WS
20#endif
21
7266b672 22#include "wx/x11/private.h"
83df96d6 23
3cd0b8c5 24IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
83df96d6 25
3cd0b8c5 26wxMemoryDC::wxMemoryDC() : wxWindowDC()
83df96d6 27{
de6185e2
WS
28 m_ok = false;
29
3cd0b8c5
RR
30 m_display = (WXDisplay *) wxGlobalDisplay();
31
32 int screen = DefaultScreen( wxGlobalDisplay() );
33 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
34}
83df96d6 35
3cd0b8c5
RR
36wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
37 : wxWindowDC()
83df96d6 38{
de6185e2 39 m_ok = false;
3cd0b8c5
RR
40
41 m_display = (WXDisplay *) wxGlobalDisplay();
de6185e2 42
3cd0b8c5
RR
43 int screen = DefaultScreen( wxGlobalDisplay() );
44 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
45}
83df96d6 46
3cd0b8c5 47wxMemoryDC::~wxMemoryDC()
83df96d6 48{
3cd0b8c5 49}
83df96d6
JS
50
51void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
52{
3cd0b8c5 53 Destroy();
de6185e2 54
3cd0b8c5
RR
55 m_selected = bitmap;
56 if (m_selected.Ok())
83df96d6 57 {
3cd0b8c5
RR
58 if (m_selected.GetPixmap())
59 {
60 m_window = (WXWindow) m_selected.GetPixmap();
61 }
62 else
63 {
6799385e 64 m_window = m_selected.GetBitmap();
3cd0b8c5
RR
65 }
66
de6185e2 67 m_isMemDC = true;
3cd0b8c5
RR
68
69 SetUpDC();
83df96d6
JS
70 }
71 else
72 {
de6185e2 73 m_ok = false;
3cd0b8c5
RR
74 m_window = NULL;
75 }
76}
83df96d6
JS
77
78void wxMemoryDC::DoGetSize( int *width, int *height ) const
79{
3cd0b8c5 80 if (m_selected.Ok())
83df96d6 81 {
3cd0b8c5
RR
82 if (width) (*width) = m_selected.GetWidth();
83 if (height) (*height) = m_selected.GetHeight();
83df96d6
JS
84 }
85 else
86 {
87 if (width) (*width) = 0;
88 if (height) (*height) = 0;
3cd0b8c5
RR
89 }
90}