]> git.saurik.com Git - wxWidgets.git/blob - src/x11/dcmemory.cpp
generate key events for Space/Enter in addition to the activate events, as wxMSW...
[wxWidgets.git] / src / x11 / dcmemory.cpp
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
20 #include "wx/x11/private.h"
21
22 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
23
24 wxMemoryDC::wxMemoryDC() : wxWindowDC()
25 {
26 m_ok = FALSE;
27
28 m_display = (WXDisplay *) wxGlobalDisplay();
29
30 int screen = DefaultScreen( wxGlobalDisplay() );
31 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
32 }
33
34 wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
35 : wxWindowDC()
36 {
37 m_ok = FALSE;
38
39 m_display = (WXDisplay *) wxGlobalDisplay();
40
41 int screen = DefaultScreen( wxGlobalDisplay() );
42 m_cmap = (WXColormap) DefaultColormap( wxGlobalDisplay(), screen );
43 }
44
45 wxMemoryDC::~wxMemoryDC()
46 {
47 }
48
49 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
50 {
51 Destroy();
52
53 m_selected = bitmap;
54 if (m_selected.Ok())
55 {
56 if (m_selected.GetPixmap())
57 {
58 m_window = (WXWindow) m_selected.GetPixmap();
59 }
60 else
61 {
62 // m_window = m_selected.GetBitmap();
63 }
64
65 m_isMemDC = TRUE;
66
67 SetUpDC();
68 }
69 else
70 {
71 m_ok = FALSE;
72 m_window = NULL;
73 }
74 }
75
76 void wxMemoryDC::DoGetSize( int *width, int *height ) const
77 {
78 if (m_selected.Ok())
79 {
80 if (width) (*width) = m_selected.GetWidth();
81 if (height) (*height) = m_selected.GetHeight();
82 }
83 else
84 {
85 if (width) (*width) = 0;
86 if (height) (*height) = 0;
87 }
88 }