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