1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        src/gtk/dcscreen.cpp
3 // Purpose:
4 // Author:      Robert Roebling
5 // Id:          $Id: dcscreen.cpp 39021 2006-05-04 07:57:04Z ABX $
6 // Copyright:   (c) 1998 Robert Roebling
7 // Licence:     wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9 
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12 
13 #include "wx/dcscreen.h"
14 
15 #ifndef WX_PRECOMP
16     #include "wx/window.h"
17 #endif
18 
19 #include <gdk/gdk.h>
20 #include <gdk/gdkx.h>
21 #include <gtk/gtk.h>
22 
23 //-----------------------------------------------------------------------------
24 // global data initialization
25 //-----------------------------------------------------------------------------
26 
27 GdkWindow *wxScreenDC::sm_overlayWindow  = (GdkWindow*) NULL;
28 int wxScreenDC::sm_overlayWindowX = 0;
29 int wxScreenDC::sm_overlayWindowY = 0;
30 
31 //-----------------------------------------------------------------------------
32 // wxScreenDC
33 //-----------------------------------------------------------------------------
34 
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)35 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
36 
37 wxScreenDC::wxScreenDC()
38 {
39     m_ok = false;
40     m_cmap = gdk_colormap_get_system();
41     m_window = gdk_get_default_root_window();
42 
43     m_context = gdk_pango_context_get();
44     // Note: The Sun customised version of Pango shipping with Solaris 10
45     // crashes if the language is left NULL (see bug 1374114)
46     pango_context_set_language( m_context, gtk_get_default_language() );
47     m_layout = pango_layout_new( m_context );
48 //    m_fontdesc = pango_font_description_copy( widget->style->font_desc );
49 
50     m_isScreenDC = true;
51 
52     SetUpDC();
53 
54     gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
55     gdk_gc_set_subwindow( m_brushGC, GDK_INCLUDE_INFERIORS );
56     gdk_gc_set_subwindow( m_textGC, GDK_INCLUDE_INFERIORS );
57     gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS );
58 }
59 
~wxScreenDC()60 wxScreenDC::~wxScreenDC()
61 {
62     gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
63     gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN );
64     gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN );
65     gdk_gc_set_subwindow( m_bgGC, GDK_CLIP_BY_CHILDREN );
66 
67     EndDrawingOnTop();
68 }
69 
StartDrawingOnTop(wxWindow *)70 bool wxScreenDC::StartDrawingOnTop( wxWindow * )
71 {
72     return true;
73 }
74 
StartDrawingOnTop(wxRect *)75 bool wxScreenDC::StartDrawingOnTop( wxRect * )
76 {
77     return true;
78 }
79 
EndDrawingOnTop()80 bool wxScreenDC::EndDrawingOnTop()
81 {
82     return true;
83 }
84 
DoGetSize(int * width,int * height) const85 void wxScreenDC::DoGetSize(int *width, int *height) const
86 {
87     wxDisplaySize(width, height);
88 }
89