]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/dcscreen.cpp
added automatic growing of in-place wxTextCtrls for generic wxListCtrl and wxTreeCtrl
[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 #ifdef __GNUG__
11 #pragma implementation "dcscreen.h"
12 #endif
13
14 #include "wx/dcscreen.h"
15 #include "wx/window.h"
16
17 #include <gdk/gdk.h>
18 #include <gdk/gdkx.h>
19 #include <gtk/gtk.h>
20
21 //-----------------------------------------------------------------------------
22 // global data initialization
23 //-----------------------------------------------------------------------------
24
25 GdkWindow *wxScreenDC::sm_overlayWindow = (GdkWindow*) NULL;
26 int wxScreenDC::sm_overlayWindowX = 0;
27 int wxScreenDC::sm_overlayWindowY = 0;
28
29 //-----------------------------------------------------------------------------
30 // wxScreenDC
31 //-----------------------------------------------------------------------------
32
33 IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
34
35 wxScreenDC::wxScreenDC()
36 {
37 m_ok = FALSE;
38 m_cmap = gdk_colormap_get_system();
39 m_window = GDK_ROOT_PARENT();
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
51 wxScreenDC::~wxScreenDC()
52 {
53 gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
54 gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN );
55 gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN );
56 gdk_gc_set_subwindow( m_bgGC, GDK_CLIP_BY_CHILDREN );
57
58 EndDrawingOnTop();
59 }
60
61 bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
62 {
63 if (!window) return StartDrawingOnTop();
64
65 int x = 0;
66 int y = 0;
67 window->GetPosition( &x, &y );
68 int w = 0;
69 int h = 0;
70 window->GetSize( &w, &h );
71 window->ClientToScreen( &x, &y );
72
73 wxRect rect;
74 rect.x = x;
75 rect.y = y;
76 rect.width = 0;
77 rect.height = 0;
78
79 return StartDrawingOnTop( &rect );
80 }
81
82 bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
83 {
84 int x = 0;
85 int y = 0;
86 int width = gdk_screen_width();
87 int height = gdk_screen_height();
88 if (rect)
89 {
90 x = rect->x;
91 y = rect->y;
92 width = rect->width;
93 height = rect->height;
94 }
95
96 return TRUE;
97 }
98
99 bool wxScreenDC::EndDrawingOnTop()
100 {
101 return TRUE;
102 }
103