]>
git.saurik.com Git - wxWidgets.git/blob - src/x11/dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxScreenDC class
4 // Author: Julian Smart, Robert Roebling
8 // Copyright: (c) Julian Smart, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dcscreen.h"
16 #include "wx/window.h"
18 #include "wx/dcscreen.h"
21 #include "wx/x11/private.h"
23 //-----------------------------------------------------------------------------
24 // global data initialization
25 //-----------------------------------------------------------------------------
27 WXWindow
*wxScreenDC::sm_overlayWindow
= (WXWindow
*) NULL
;
28 int wxScreenDC::sm_overlayWindowX
= 0;
29 int wxScreenDC::sm_overlayWindowY
= 0;
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC
,wxPaintDC
)
37 wxScreenDC::wxScreenDC()
41 m_display
= (WXDisplay
*) wxGlobalDisplay();
43 int screen
= DefaultScreen( (Display
*) m_display
);
44 m_cmap
= (WXColormap
) DefaultColormap( (Display
*) m_display
, screen
);
46 m_window
= (WXWindow
) RootWindow( (Display
*) m_display
, screen
);
52 XSetSubwindowMode( (Display
*) m_display
, (GC
) m_penGC
, IncludeInferiors
);
53 XSetSubwindowMode( (Display
*) m_display
, (GC
) m_brushGC
, IncludeInferiors
);
54 XSetSubwindowMode( (Display
*) m_display
, (GC
) m_textGC
, IncludeInferiors
);
55 XSetSubwindowMode( (Display
*) m_display
, (GC
) m_bgGC
, IncludeInferiors
);
58 wxScreenDC::~wxScreenDC()
60 XSetSubwindowMode( (Display
*) m_display
, (GC
) m_penGC
, ClipByChildren
);
61 XSetSubwindowMode( (Display
*) m_display
, (GC
) m_brushGC
, ClipByChildren
);
62 XSetSubwindowMode( (Display
*) m_display
, (GC
) m_textGC
, ClipByChildren
);
63 XSetSubwindowMode( (Display
*) m_display
, (GC
) m_bgGC
, ClipByChildren
);
68 bool wxScreenDC::StartDrawingOnTop( wxWindow
*window
)
70 if (!window
) return StartDrawingOnTop();
74 window
->GetPosition( &x
, &y
);
77 window
->GetSize( &w
, &h
);
78 window
->ClientToScreen( &x
, &y
);
86 return StartDrawingOnTop( &rect
);
89 bool wxScreenDC::StartDrawingOnTop( wxRect
*rect
)
94 int width
= gdk_screen_width();
95 int height
= gdk_screen_height();
105 height
= rect
->height
;
111 bool wxScreenDC::EndDrawingOnTop()
116 void wxScreenDC::DoGetSize(int *width
, int *height
) const
118 wxDisplaySize(width
, height
);