]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/dcscreen.cpp
Added declaration for GetViewRect to fix compilo.
[wxWidgets.git] / src / gtk / dcscreen.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcscreen.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
11 #pragma implementation "dcscreen.h"
12 #endif
13
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
16
17 #include "wx/dcscreen.h"
18 #include "wx/window.h"
19
20 #include <gdk/gdk.h>
21 #include <gdk/gdkx.h>
22 #include <gtk/gtk.h>
23
24 //-----------------------------------------------------------------------------
25 // global data initialization
26 //-----------------------------------------------------------------------------
27
28 GdkWindow *wxScreenDC::sm_overlayWindow = (GdkWindow*) NULL;
29 int wxScreenDC::sm_overlayWindowX = 0;
30 int wxScreenDC::sm_overlayWindowY = 0;
31
32 //-----------------------------------------------------------------------------
33 // wxScreenDC
34 //-----------------------------------------------------------------------------
35
36 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
37
38 wxScreenDC::wxScreenDC()
39 {
40 m_ok = FALSE;
41 m_cmap = gdk_colormap_get_system();
42 m_window = GDK_ROOT_PARENT();
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 wxScreenDC::~wxScreenDC()
55 {
56 gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
57 gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN );
58 gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN );
59 gdk_gc_set_subwindow( m_bgGC, GDK_CLIP_BY_CHILDREN );
60
61 EndDrawingOnTop();
62 }
63
64 bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
65 {
66 if (!window) return StartDrawingOnTop();
67
68 int x = 0;
69 int y = 0;
70 window->GetPosition( &x, &y );
71 int w = 0;
72 int h = 0;
73 window->GetSize( &w, &h );
74 window->ClientToScreen( &x, &y );
75
76 wxRect rect;
77 rect.x = x;
78 rect.y = y;
79 rect.width = 0;
80 rect.height = 0;
81
82 return StartDrawingOnTop( &rect );
83 }
84
85 bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
86 {
87 int x = 0;
88 int y = 0;
89 int width = gdk_screen_width();
90 int height = gdk_screen_height();
91 if (rect)
92 {
93 x = rect->x;
94 y = rect->y;
95 width = rect->width;
96 height = rect->height;
97 }
98
99 return TRUE;
100 }
101
102 bool wxScreenDC::EndDrawingOnTop()
103 {
104 return TRUE;
105 }
106
107 void wxScreenDC::DoGetSize(int *width, int *height) const
108 {
109 wxDisplaySize(width, height);
110 }