]> git.saurik.com Git - wxWidgets.git/blame - src/x11/dcmemory.cpp
implemented declared but never defined resize() method
[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"
19#endif
20
83df96d6 21#include "wx/settings.h"
83df96d6 22
7266b672 23#include "wx/x11/private.h"
83df96d6 24
3cd0b8c5 25IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
83df96d6 26
3cd0b8c5 27wxMemoryDC::wxMemoryDC() : wxWindowDC()
83df96d6 28{
de6185e2
WS
29 m_ok = false;
30
3cd0b8c5
RR
31 m_display = (WXDisplay *) wxGlobalDisplay();
32
33 int screen = DefaultScreen( wxGlobalDisplay() );
34 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
35}
83df96d6 36
3cd0b8c5
RR
37wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
38 : wxWindowDC()
83df96d6 39{
de6185e2 40 m_ok = false;
3cd0b8c5
RR
41
42 m_display = (WXDisplay *) wxGlobalDisplay();
de6185e2 43
3cd0b8c5
RR
44 int screen = DefaultScreen( wxGlobalDisplay() );
45 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
46}
83df96d6 47
3cd0b8c5 48wxMemoryDC::~wxMemoryDC()
83df96d6 49{
3cd0b8c5 50}
83df96d6
JS
51
52void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
53{
3cd0b8c5 54 Destroy();
de6185e2 55
3cd0b8c5
RR
56 m_selected = bitmap;
57 if (m_selected.Ok())
83df96d6 58 {
3cd0b8c5
RR
59 if (m_selected.GetPixmap())
60 {
61 m_window = (WXWindow) m_selected.GetPixmap();
62 }
63 else
64 {
6799385e 65 m_window = m_selected.GetBitmap();
3cd0b8c5
RR
66 }
67
de6185e2 68 m_isMemDC = true;
3cd0b8c5
RR
69
70 SetUpDC();
83df96d6
JS
71 }
72 else
73 {
de6185e2 74 m_ok = false;
3cd0b8c5
RR
75 m_window = NULL;
76 }
77}
83df96d6
JS
78
79void wxMemoryDC::DoGetSize( int *width, int *height ) const
80{
3cd0b8c5 81 if (m_selected.Ok())
83df96d6 82 {
3cd0b8c5
RR
83 if (width) (*width) = m_selected.GetWidth();
84 if (height) (*height) = m_selected.GetHeight();
83df96d6
JS
85 }
86 else
87 {
88 if (width) (*width) = 0;
89 if (height) (*height) = 0;
3cd0b8c5
RR
90 }
91}