]> git.saurik.com Git - wxWidgets.git/blob - src/x11/dcmemory.cpp
Added missing wx_aui.dsp file
[wxWidgets.git] / src / x11 / dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/x11/dcmemory.cpp
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // for compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #include "wx/dcmemory.h"
16
17 #ifndef WX_PRECOMP
18 #include "wx/utils.h"
19 #include "wx/settings.h"
20 #endif
21
22 #include "wx/x11/private.h"
23
24 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
25
26 wxMemoryDC::wxMemoryDC() : wxWindowDC()
27 {
28 m_ok = false;
29
30 m_display = (WXDisplay *) wxGlobalDisplay();
31
32 int screen = DefaultScreen( wxGlobalDisplay() );
33 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
34 }
35
36 wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
37 : wxWindowDC()
38 {
39 m_ok = false;
40
41 m_display = (WXDisplay *) wxGlobalDisplay();
42
43 int screen = DefaultScreen( wxGlobalDisplay() );
44 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
45 }
46
47 wxMemoryDC::~wxMemoryDC()
48 {
49 }
50
51 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
52 {
53 Destroy();
54
55 m_selected = bitmap;
56 if (m_selected.Ok())
57 {
58 if (m_selected.GetPixmap())
59 {
60 m_window = (WXWindow) m_selected.GetPixmap();
61 }
62 else
63 {
64 m_window = m_selected.GetBitmap();
65 }
66
67 m_isMemDC = true;
68
69 SetUpDC();
70 }
71 else
72 {
73 m_ok = false;
74 m_window = NULL;
75 }
76 }
77
78 void wxMemoryDC::DoGetSize( int *width, int *height ) const
79 {
80 if (m_selected.Ok())
81 {
82 if (width) (*width) = m_selected.GetWidth();
83 if (height) (*height) = m_selected.GetHeight();
84 }
85 else
86 {
87 if (width) (*width) = 0;
88 if (height) (*height) = 0;
89 }
90 }