remove wxGraphicsContext dependency for transparent background support
[wxWidgets.git] / src / gtk / dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/dcscreen.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
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 #include "wx/gtk/dcscreen.h"
15
16 #include <gtk/gtk.h>
17 #include <gdk/gdkx.h>
18
19 //-----------------------------------------------------------------------------
20 // wxScreenDCImpl
21 //-----------------------------------------------------------------------------
22
23 IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
24
25 wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner )
26 : wxWindowDCImpl( owner )
27 {
28 Init();
29 }
30
31 void wxScreenDCImpl::Init()
32 {
33 m_ok = false;
34 m_cmap = gdk_colormap_get_system();
35 m_gdkwindow = gdk_get_default_root_window();
36
37 m_context = gdk_pango_context_get();
38 // Note: The Sun customised version of Pango shipping with Solaris 10
39 // crashes if the language is left NULL (see bug 1374114)
40 pango_context_set_language( m_context, gtk_get_default_language() );
41 m_layout = pango_layout_new( m_context );
42 // m_fontdesc = pango_font_description_copy( widget->style->font_desc );
43
44 m_isScreenDC = true;
45
46 SetUpDC();
47
48 gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
49 gdk_gc_set_subwindow( m_brushGC, GDK_INCLUDE_INFERIORS );
50 gdk_gc_set_subwindow( m_textGC, GDK_INCLUDE_INFERIORS );
51 gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS );
52 }
53
54 wxScreenDCImpl::~wxScreenDCImpl()
55 {
56 g_object_unref(m_context);
57
58 gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
59 gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN );
60 gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN );
61 gdk_gc_set_subwindow( m_bgGC, GDK_CLIP_BY_CHILDREN );
62 }
63
64 void wxScreenDCImpl::DoGetSize(int *width, int *height) const
65 {
66 wxDisplaySize(width, height);
67 }