]>
Commit | Line | Data |
---|---|---|
83df96d6 | 1 | ///////////////////////////////////////////////////////////////////////////// |
670f9935 | 2 | // Name: src/x11/dcscreen.cpp |
83df96d6 | 3 | // Purpose: wxScreenDC class |
3cd0b8c5 | 4 | // Author: Julian Smart, Robert Roebling |
83df96d6 JS |
5 | // Modified by: |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
3cd0b8c5 | 8 | // Copyright: (c) Julian Smart, Robert Roebling |
670f9935 | 9 | // Licence: wxWindows licence |
83df96d6 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
670f9935 WS |
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" | |
de6185e2 | 19 | #include "wx/utils.h" |
cdccdfab | 20 | #include "wx/window.h" |
76b49cf4 | 21 | #include "wx/frame.h" |
670f9935 WS |
22 | #endif |
23 | ||
2b5f62a0 | 24 | #include "wx/fontutil.h" |
83df96d6 | 25 | |
bc797f4c | 26 | #include "wx/x11/private.h" |
83df96d6 | 27 | |
3cd0b8c5 RR |
28 | //----------------------------------------------------------------------------- |
29 | // global data initialization | |
30 | //----------------------------------------------------------------------------- | |
83df96d6 | 31 | |
3cd0b8c5 | 32 | WXWindow *wxScreenDC::sm_overlayWindow = (WXWindow*) NULL; |
83df96d6 JS |
33 | int wxScreenDC::sm_overlayWindowX = 0; |
34 | int wxScreenDC::sm_overlayWindowY = 0; | |
35 | ||
3cd0b8c5 RR |
36 | //----------------------------------------------------------------------------- |
37 | // wxScreenDC | |
38 | //----------------------------------------------------------------------------- | |
39 | ||
40 | IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC) | |
41 | ||
83df96d6 JS |
42 | wxScreenDC::wxScreenDC() |
43 | { | |
670f9935 WS |
44 | m_ok = false; |
45 | ||
3cd0b8c5 | 46 | m_display = (WXDisplay *) wxGlobalDisplay(); |
670f9935 | 47 | |
3cd0b8c5 RR |
48 | int screen = DefaultScreen( (Display*) m_display ); |
49 | m_cmap = (WXColormap) DefaultColormap( (Display*) m_display, screen ); | |
670f9935 | 50 | |
3cd0b8c5 RR |
51 | m_window = (WXWindow) RootWindow( (Display*) m_display, screen ); |
52 | ||
670f9935 | 53 | m_isScreenDC = true; |
3cd0b8c5 | 54 | |
2b5f62a0 VZ |
55 | #if wxUSE_UNICODE |
56 | m_context = wxTheApp->GetPangoContext(); | |
57 | m_fontdesc = wxNORMAL_FONT->GetNativeFontInfo()->description; | |
58 | #endif | |
59 | ||
3cd0b8c5 RR |
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 ); | |
83df96d6 JS |
66 | } |
67 | ||
68 | wxScreenDC::~wxScreenDC() | |
69 | { | |
3cd0b8c5 RR |
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 | ||
83df96d6 JS |
75 | EndDrawingOnTop(); |
76 | } | |
77 | ||
3cd0b8c5 | 78 | bool wxScreenDC::StartDrawingOnTop( wxWindow *window ) |
83df96d6 | 79 | { |
3cd0b8c5 RR |
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 | ||
83df96d6 | 90 | wxRect rect; |
3cd0b8c5 RR |
91 | rect.x = x; |
92 | rect.y = y; | |
93 | rect.width = 0; | |
94 | rect.height = 0; | |
95 | ||
96 | return StartDrawingOnTop( &rect ); | |
83df96d6 JS |
97 | } |
98 | ||
2b5f62a0 | 99 | bool wxScreenDC::StartDrawingOnTop( wxRect *rectIn ) |
83df96d6 | 100 | { |
2b5f62a0 | 101 | // VZ: should we do the same thing that wxMotif wxScreenDC does here? |
3cd0b8c5 | 102 | #if 0 |
2b5f62a0 VZ |
103 | wxRect rect; |
104 | if ( rectIn ) | |
105 | { | |
106 | rect = *rectIn; | |
107 | } | |
108 | else | |
83df96d6 | 109 | { |
2b5f62a0 VZ |
110 | rect.x = |
111 | rect.y = 0; | |
112 | ||
113 | DoGetSize(&rect.width, &rect.height); | |
83df96d6 | 114 | } |
2b5f62a0 | 115 | #endif // 0 |
3cd0b8c5 | 116 | |
670f9935 | 117 | return true; |
83df96d6 JS |
118 | } |
119 | ||
120 | bool wxScreenDC::EndDrawingOnTop() | |
121 | { | |
670f9935 | 122 | return true; |
3cd0b8c5 RR |
123 | } |
124 | ||
125 | void wxScreenDC::DoGetSize(int *width, int *height) const | |
126 | { | |
127 | wxDisplaySize(width, height); | |
83df96d6 | 128 | } |