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