]> git.saurik.com Git - wxWidgets.git/blob - src/x11/dcscreen.cpp
Same typo.
[wxWidgets.git] / src / x11 / dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcscreen.cpp
3 // Purpose: wxScreenDC class
4 // Author: Julian Smart, Robert Roebling
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "dcscreen.h"
14 #endif
15
16 #include "wx/window.h"
17 #include "wx/frame.h"
18 #include "wx/dcscreen.h"
19 #include "wx/utils.h"
20
21 #include "wx/x11/private.h"
22
23 //-----------------------------------------------------------------------------
24 // global data initialization
25 //-----------------------------------------------------------------------------
26
27 WXWindow *wxScreenDC::sm_overlayWindow = (WXWindow*) NULL;
28 int wxScreenDC::sm_overlayWindowX = 0;
29 int wxScreenDC::sm_overlayWindowY = 0;
30
31 //-----------------------------------------------------------------------------
32 // wxScreenDC
33 //-----------------------------------------------------------------------------
34
35 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
36
37 wxScreenDC::wxScreenDC()
38 {
39 m_ok = FALSE;
40
41 m_display = (WXDisplay *) wxGlobalDisplay();
42
43 int screen = DefaultScreen( (Display*) m_display );
44 m_cmap = (WXColormap) DefaultColormap( (Display*) m_display, screen );
45
46 m_window = (WXWindow) RootWindow( (Display*) m_display, screen );
47
48 m_isScreenDC = TRUE;
49
50 SetUpDC();
51
52 XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, IncludeInferiors );
53 XSetSubwindowMode( (Display*) m_display, (GC) m_brushGC, IncludeInferiors );
54 XSetSubwindowMode( (Display*) m_display, (GC) m_textGC, IncludeInferiors );
55 XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, IncludeInferiors );
56 }
57
58 wxScreenDC::~wxScreenDC()
59 {
60 XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren );
61 XSetSubwindowMode( (Display*) m_display, (GC) m_brushGC, ClipByChildren );
62 XSetSubwindowMode( (Display*) m_display, (GC) m_textGC, ClipByChildren );
63 XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, ClipByChildren );
64
65 EndDrawingOnTop();
66 }
67
68 bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
69 {
70 if (!window) return StartDrawingOnTop();
71
72 int x = 0;
73 int y = 0;
74 window->GetPosition( &x, &y );
75 int w = 0;
76 int h = 0;
77 window->GetSize( &w, &h );
78 window->ClientToScreen( &x, &y );
79
80 wxRect rect;
81 rect.x = x;
82 rect.y = y;
83 rect.width = 0;
84 rect.height = 0;
85
86 return StartDrawingOnTop( &rect );
87 }
88
89 bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
90 {
91 int x = 0;
92 int y = 0;
93 #if 0
94 int width = gdk_screen_width();
95 int height = gdk_screen_height();
96 #else
97 int width = 1024;
98 int height = 768;
99 #endif
100 if (rect)
101 {
102 x = rect->x;
103 y = rect->y;
104 width = rect->width;
105 height = rect->height;
106 }
107
108 return TRUE;
109 }
110
111 bool wxScreenDC::EndDrawingOnTop()
112 {
113 return TRUE;
114 }
115
116 void wxScreenDC::DoGetSize(int *width, int *height) const
117 {
118 wxDisplaySize(width, height);
119 }