]> git.saurik.com Git - wxWidgets.git/blame - src/x11/dcmemory.cpp
added WXWIN_COMPATIBILITY_2_8
[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
fea35690 26void wxMemoryDC::Init()
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{
fea35690 39 Init();
3cd0b8c5 40}
83df96d6 41
3cd0b8c5 42wxMemoryDC::~wxMemoryDC()
83df96d6 43{
3cd0b8c5 44}
83df96d6 45
fea35690 46void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
83df96d6 47{
3cd0b8c5 48 Destroy();
de6185e2 49
3cd0b8c5
RR
50 m_selected = bitmap;
51 if (m_selected.Ok())
83df96d6 52 {
3cd0b8c5
RR
53 if (m_selected.GetPixmap())
54 {
55 m_window = (WXWindow) m_selected.GetPixmap();
56 }
57 else
58 {
6799385e 59 m_window = m_selected.GetBitmap();
3cd0b8c5
RR
60 }
61
de6185e2 62 m_isMemDC = true;
3cd0b8c5
RR
63
64 SetUpDC();
83df96d6
JS
65 }
66 else
67 {
de6185e2 68 m_ok = false;
3cd0b8c5
RR
69 m_window = NULL;
70 }
71}
83df96d6
JS
72
73void wxMemoryDC::DoGetSize( int *width, int *height ) const
74{
3cd0b8c5 75 if (m_selected.Ok())
83df96d6 76 {
3cd0b8c5
RR
77 if (width) (*width) = m_selected.GetWidth();
78 if (height) (*height) = m_selected.GetHeight();
83df96d6
JS
79 }
80 else
81 {
82 if (width) (*width) = 0;
83 if (height) (*height) = 0;
3cd0b8c5
RR
84 }
85}