]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/x11/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 | // for compilers that support precompilation, includes "wx.h". | |
13 | #include "wx/wxprec.h" | |
14 | ||
15 | #include "wx/dcscreen.h" | |
16 | ||
17 | #ifndef WX_PRECOMP | |
18 | #include "wx/app.h" | |
19 | #include "wx/utils.h" | |
20 | #include "wx/window.h" | |
21 | #include "wx/frame.h" | |
22 | #endif | |
23 | ||
24 | #include "wx/fontutil.h" | |
25 | ||
26 | #include "wx/x11/private.h" | |
27 | ||
28 | //----------------------------------------------------------------------------- | |
29 | // global data initialization | |
30 | //----------------------------------------------------------------------------- | |
31 | ||
32 | WXWindow *wxScreenDC::sm_overlayWindow = (WXWindow*) NULL; | |
33 | int wxScreenDC::sm_overlayWindowX = 0; | |
34 | int wxScreenDC::sm_overlayWindowY = 0; | |
35 | ||
36 | //----------------------------------------------------------------------------- | |
37 | // wxScreenDC | |
38 | //----------------------------------------------------------------------------- | |
39 | ||
40 | IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC) | |
41 | ||
42 | wxScreenDC::wxScreenDC() | |
43 | { | |
44 | m_ok = false; | |
45 | ||
46 | m_display = (WXDisplay *) wxGlobalDisplay(); | |
47 | ||
48 | int screen = DefaultScreen( (Display*) m_display ); | |
49 | m_cmap = (WXColormap) DefaultColormap( (Display*) m_display, screen ); | |
50 | ||
51 | m_window = (WXWindow) RootWindow( (Display*) m_display, screen ); | |
52 | ||
53 | m_isScreenDC = true; | |
54 | ||
55 | #if wxUSE_UNICODE | |
56 | m_context = wxTheApp->GetPangoContext(); | |
57 | m_fontdesc = wxNORMAL_FONT->GetNativeFontInfo()->description; | |
58 | #endif | |
59 | ||
60 | SetUpDC(); | |
61 | ||
62 | XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, IncludeInferiors ); | |
63 | XSetSubwindowMode( (Display*) m_display, (GC) m_brushGC, IncludeInferiors ); | |
64 | XSetSubwindowMode( (Display*) m_display, (GC) m_textGC, IncludeInferiors ); | |
65 | XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, IncludeInferiors ); | |
66 | } | |
67 | ||
68 | wxScreenDC::~wxScreenDC() | |
69 | { | |
70 | XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren ); | |
71 | XSetSubwindowMode( (Display*) m_display, (GC) m_brushGC, ClipByChildren ); | |
72 | XSetSubwindowMode( (Display*) m_display, (GC) m_textGC, ClipByChildren ); | |
73 | XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, ClipByChildren ); | |
74 | ||
75 | EndDrawingOnTop(); | |
76 | } | |
77 | ||
78 | bool wxScreenDC::StartDrawingOnTop( wxWindow *window ) | |
79 | { | |
80 | if (!window) return StartDrawingOnTop(); | |
81 | ||
82 | int x = 0; | |
83 | int y = 0; | |
84 | window->GetPosition( &x, &y ); | |
85 | int w = 0; | |
86 | int h = 0; | |
87 | window->GetSize( &w, &h ); | |
88 | window->ClientToScreen( &x, &y ); | |
89 | ||
90 | wxRect rect; | |
91 | rect.x = x; | |
92 | rect.y = y; | |
93 | rect.width = 0; | |
94 | rect.height = 0; | |
95 | ||
96 | return StartDrawingOnTop( &rect ); | |
97 | } | |
98 | ||
99 | bool wxScreenDC::StartDrawingOnTop( wxRect *WXUNUSED(rectIn) ) | |
100 | { | |
101 | // VZ: should we do the same thing that wxMotif wxScreenDC does here? | |
102 | return true; | |
103 | } | |
104 | ||
105 | bool wxScreenDC::EndDrawingOnTop() | |
106 | { | |
107 | return true; | |
108 | } | |
109 | ||
110 | void wxScreenDC::DoGetSize(int *width, int *height) const | |
111 | { | |
112 | wxDisplaySize(width, height); | |
113 | } |