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