1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        src/gtk/dcscreen.cpp
3 // Purpose:
4 // Author:      Robert Roebling
5 // Copyright:   (c) 1998 Robert Roebling
6 // Licence:     wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8 
9 // For compilers that support precompilation, includes "wx.h".
10 #include "wx/wxprec.h"
11 
12 #include "wx/gtk/dcscreen.h"
13 
14 #include <gtk/gtk.h>
15 
16 //-----------------------------------------------------------------------------
17 // wxScreenDCImpl
18 //-----------------------------------------------------------------------------
19 
IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl,wxWindowDCImpl)20 IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
21 
22 wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner )
23   : wxWindowDCImpl( owner )
24 {
25     Init();
26 }
27 
Init()28 void wxScreenDCImpl::Init()
29 {
30     m_ok = false;
31     m_cmap = gdk_colormap_get_system();
32     m_gdkwindow = gdk_get_default_root_window();
33 
34     m_context = gdk_pango_context_get();
35     // Note: The Sun customised version of Pango shipping with Solaris 10
36     // crashes if the language is left NULL (see bug 1374114)
37     pango_context_set_language( m_context, gtk_get_default_language() );
38     m_layout = pango_layout_new( m_context );
39 //    m_fontdesc = pango_font_description_copy( widget->style->font_desc );
40 
41     m_isScreenDC = true;
42 
43     SetUpDC();
44 
45     gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
46     gdk_gc_set_subwindow( m_brushGC, GDK_INCLUDE_INFERIORS );
47     gdk_gc_set_subwindow( m_textGC, GDK_INCLUDE_INFERIORS );
48     gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS );
49 }
50 
~wxScreenDCImpl()51 wxScreenDCImpl::~wxScreenDCImpl()
52 {
53     g_object_unref(m_context);
54 
55     gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
56     gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN );
57     gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN );
58     gdk_gc_set_subwindow( m_bgGC, GDK_CLIP_BY_CHILDREN );
59 }
60 
DoGetSize(int * width,int * height) const61 void wxScreenDCImpl::DoGetSize(int *width, int *height) const
62 {
63     wxDisplaySize(width, height);
64 }
65