]> git.saurik.com Git - wxWidgets.git/blame - src/x11/dcmemory.cpp
always return something in GetCommandForVerb() second argument, even if verb not...
[wxWidgets.git] / src / x11 / dcmemory.cpp
CommitLineData
83df96d6
JS
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
65571936 9// Licence: wxWindows licence
83df96d6
JS
10/////////////////////////////////////////////////////////////////////////////
11
83df96d6
JS
12#include "wx/dcmemory.h"
13#include "wx/settings.h"
14#include "wx/utils.h"
15
7266b672 16#include "wx/x11/private.h"
83df96d6 17
3cd0b8c5 18IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
83df96d6 19
3cd0b8c5 20wxMemoryDC::wxMemoryDC() : wxWindowDC()
83df96d6 21{
3cd0b8c5 22 m_ok = FALSE;
83df96d6 23
3cd0b8c5
RR
24 m_display = (WXDisplay *) wxGlobalDisplay();
25
26 int screen = DefaultScreen( wxGlobalDisplay() );
27 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
28}
83df96d6 29
3cd0b8c5
RR
30wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
31 : wxWindowDC()
83df96d6 32{
3cd0b8c5
RR
33 m_ok = FALSE;
34
35 m_display = (WXDisplay *) wxGlobalDisplay();
83df96d6 36
3cd0b8c5
RR
37 int screen = DefaultScreen( wxGlobalDisplay() );
38 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
39}
83df96d6 40
3cd0b8c5 41wxMemoryDC::~wxMemoryDC()
83df96d6 42{
3cd0b8c5 43}
83df96d6
JS
44
45void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
46{
3cd0b8c5 47 Destroy();
83df96d6 48
3cd0b8c5
RR
49 m_selected = bitmap;
50 if (m_selected.Ok())
83df96d6 51 {
3cd0b8c5
RR
52 if (m_selected.GetPixmap())
53 {
54 m_window = (WXWindow) m_selected.GetPixmap();
55 }
56 else
57 {
6799385e 58 m_window = m_selected.GetBitmap();
3cd0b8c5
RR
59 }
60
61 m_isMemDC = TRUE;
62
63 SetUpDC();
83df96d6
JS
64 }
65 else
66 {
67 m_ok = FALSE;
3cd0b8c5
RR
68 m_window = NULL;
69 }
70}
83df96d6
JS
71
72void wxMemoryDC::DoGetSize( int *width, int *height ) const
73{
3cd0b8c5 74 if (m_selected.Ok())
83df96d6 75 {
3cd0b8c5
RR
76 if (width) (*width) = m_selected.GetWidth();
77 if (height) (*height) = m_selected.GetHeight();
83df96d6
JS
78 }
79 else
80 {
81 if (width) (*width) = 0;
82 if (height) (*height) = 0;
3cd0b8c5
RR
83 }
84}