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