]>
git.saurik.com Git - wxWidgets.git/blob - src/x11/dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/x11/dcscreen.cpp
3 // Purpose: wxScreenDC class
4 // Author: Julian Smart, Robert Roebling
8 // Copyright: (c) Julian Smart, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // for compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
15 #include "wx/dcscreen.h"
20 #include "wx/window.h"
24 #include "wx/fontutil.h"
26 #include "wx/x11/private.h"
28 //-----------------------------------------------------------------------------
29 // global data initialization
30 //-----------------------------------------------------------------------------
32 WXWindow
*wxScreenDC::sm_overlayWindow
= (WXWindow
*) NULL
;
33 int wxScreenDC::sm_overlayWindowX
= 0;
34 int wxScreenDC::sm_overlayWindowY
= 0;
36 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
40 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC
,wxPaintDC
)
42 wxScreenDC::wxScreenDC()
46 m_display
= (WXDisplay
*) wxGlobalDisplay();
48 int screen
= DefaultScreen( (Display
*) m_display
);
49 m_cmap
= (WXColormap
) DefaultColormap( (Display
*) m_display
, screen
);
51 m_window
= (WXWindow
) RootWindow( (Display
*) m_display
, screen
);
56 m_context
= wxTheApp
->GetPangoContext();
57 m_fontdesc
= wxNORMAL_FONT
->GetNativeFontInfo()->description
;
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
);
68 wxScreenDC::~wxScreenDC()
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
);
78 bool wxScreenDC::StartDrawingOnTop( wxWindow
*window
)
80 if (!window
) return StartDrawingOnTop();
84 window
->GetPosition( &x
, &y
);
87 window
->GetSize( &w
, &h
);
88 window
->ClientToScreen( &x
, &y
);
96 return StartDrawingOnTop( &rect
);
99 bool wxScreenDC::StartDrawingOnTop( wxRect
*rectIn
)
101 // VZ: should we do the same thing that wxMotif wxScreenDC does here?
113 DoGetSize(&rect
.width
, &rect
.height
);
120 bool wxScreenDC::EndDrawingOnTop()
125 void wxScreenDC::DoGetSize(int *width
, int *height
) const
127 wxDisplaySize(width
, height
);