]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/x11/dcmemory.cpp
Fixed MDI context menu event handling problem (Stefan Kowski)
[wxWidgets.git] / src / x11 / dcmemory.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: 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#include "wx/dcmemory.h"
13#include "wx/settings.h"
14#include "wx/utils.h"
15
16#include "wx/x11/private.h"
17
18IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
19
20wxMemoryDC::wxMemoryDC() : wxWindowDC()
21{
22 m_ok = FALSE;
23
24 m_display = (WXDisplay *) wxGlobalDisplay();
25
26 int screen = DefaultScreen( wxGlobalDisplay() );
27 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
28}
29
30wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
31 : wxWindowDC()
32{
33 m_ok = FALSE;
34
35 m_display = (WXDisplay *) wxGlobalDisplay();
36
37 int screen = DefaultScreen( wxGlobalDisplay() );
38 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
39}
40
41wxMemoryDC::~wxMemoryDC()
42{
43}
44
45void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
46{
47 Destroy();
48
49 m_selected = bitmap;
50 if (m_selected.Ok())
51 {
52 if (m_selected.GetPixmap())
53 {
54 m_window = (WXWindow) m_selected.GetPixmap();
55 }
56 else
57 {
58 m_window = m_selected.GetBitmap();
59 }
60
61 m_isMemDC = TRUE;
62
63 SetUpDC();
64 }
65 else
66 {
67 m_ok = FALSE;
68 m_window = NULL;
69 }
70}
71
72void wxMemoryDC::DoGetSize( int *width, int *height ) const
73{
74 if (m_selected.Ok())
75 {
76 if (width) (*width) = m_selected.GetWidth();
77 if (height) (*height) = m_selected.GetHeight();
78 }
79 else
80 {
81 if (width) (*width) = 0;
82 if (height) (*height) = 0;
83 }
84}