]> git.saurik.com Git - wxWidgets.git/blob - src/x11/dcscreen.cpp
don't set minimal column width, it should be possible to set it even to 0 if desired...
[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 #include "wx/window.h"
13 #include "wx/frame.h"
14 #include "wx/dcscreen.h"
15 #include "wx/utils.h"
16 #include "wx/app.h"
17 #include "wx/fontutil.h"
18
19 #include "wx/x11/private.h"
20
21 //-----------------------------------------------------------------------------
22 // global data initialization
23 //-----------------------------------------------------------------------------
24
25 WXWindow *wxScreenDC::sm_overlayWindow = (WXWindow*) NULL;
26 int wxScreenDC::sm_overlayWindowX = 0;
27 int wxScreenDC::sm_overlayWindowY = 0;
28
29 //-----------------------------------------------------------------------------
30 // wxScreenDC
31 //-----------------------------------------------------------------------------
32
33 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
34
35 wxScreenDC::wxScreenDC()
36 {
37 m_ok = FALSE;
38
39 m_display = (WXDisplay *) wxGlobalDisplay();
40
41 int screen = DefaultScreen( (Display*) m_display );
42 m_cmap = (WXColormap) DefaultColormap( (Display*) m_display, screen );
43
44 m_window = (WXWindow) RootWindow( (Display*) m_display, screen );
45
46 m_isScreenDC = TRUE;
47
48 #if wxUSE_UNICODE
49 m_context = wxTheApp->GetPangoContext();
50 m_fontdesc = wxNORMAL_FONT->GetNativeFontInfo()->description;
51 #endif
52
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 );
59 }
60
61 wxScreenDC::~wxScreenDC()
62 {
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
68 EndDrawingOnTop();
69 }
70
71 bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
72 {
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
83 wxRect rect;
84 rect.x = x;
85 rect.y = y;
86 rect.width = 0;
87 rect.height = 0;
88
89 return StartDrawingOnTop( &rect );
90 }
91
92 bool wxScreenDC::StartDrawingOnTop( wxRect *rectIn )
93 {
94 // VZ: should we do the same thing that wxMotif wxScreenDC does here?
95 #if 0
96 wxRect rect;
97 if ( rectIn )
98 {
99 rect = *rectIn;
100 }
101 else
102 {
103 rect.x =
104 rect.y = 0;
105
106 DoGetSize(&rect.width, &rect.height);
107 }
108 #endif // 0
109
110 return TRUE;
111 }
112
113 bool wxScreenDC::EndDrawingOnTop()
114 {
115 return TRUE;
116 }
117
118 void wxScreenDC::DoGetSize(int *width, int *height) const
119 {
120 wxDisplaySize(width, height);
121 }