]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/dcscreen.cpp
made wxNumberEntryDialog public; extracted it and wxGetNumberFromUser() in a separate...
[wxWidgets.git] / src / gtk1 / dcscreen.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: dcscreen.cpp
3// Purpose:
4// Author: Robert Roebling
dbf858b5 5// Id: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling
72cdf4c9 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
14f355c2 10#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
c801d85f
KB
11#pragma implementation "dcscreen.h"
12#endif
13
14f355c2
VS
14// For compilers that support precompilation, includes "wx.h".
15#include "wx/wxprec.h"
16
c801d85f
KB
17#include "wx/dcscreen.h"
18#include "wx/window.h"
dbf858b5 19
071a2d78 20#include <gdk/gdk.h>
5d25c050 21#include <gdk/gdkx.h>
071a2d78 22#include <gtk/gtk.h>
83624f79 23
dbf858b5
RR
24//-----------------------------------------------------------------------------
25// global data initialization
26//-----------------------------------------------------------------------------
27
28GdkWindow *wxScreenDC::sm_overlayWindow = (GdkWindow*) NULL;
72cdf4c9
VZ
29int wxScreenDC::sm_overlayWindowX = 0;
30int wxScreenDC::sm_overlayWindowY = 0;
dbf858b5 31
c801d85f
KB
32//-----------------------------------------------------------------------------
33// wxScreenDC
34//-----------------------------------------------------------------------------
35
36IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
37
72cdf4c9 38wxScreenDC::wxScreenDC()
c801d85f 39{
4bc67cc5 40 m_ok = FALSE;
4bc67cc5 41 m_cmap = gdk_colormap_get_system();
5d25c050 42 m_window = GDK_ROOT_PARENT();
72cdf4c9 43
e1208c31
RR
44 m_isScreenDC = TRUE;
45
4bc67cc5 46 SetUpDC();
72cdf4c9 47
4bc67cc5
RR
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 );
ff7b1510 52}
c801d85f 53
72cdf4c9 54wxScreenDC::~wxScreenDC()
c801d85f 55{
5d25c050
RR
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
4bc67cc5 61 EndDrawingOnTop();
ff7b1510 62}
c801d85f 63
dbf858b5 64bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
c801d85f 65{
4bc67cc5 66 if (!window) return StartDrawingOnTop();
72cdf4c9 67
4bc67cc5
RR
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 );
72cdf4c9 75
4bc67cc5
RR
76 wxRect rect;
77 rect.x = x;
78 rect.y = y;
79 rect.width = 0;
80 rect.height = 0;
72cdf4c9 81
4bc67cc5 82 return StartDrawingOnTop( &rect );
ff7b1510 83}
c801d85f 84
16e93305 85bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
c801d85f 86{
5d25c050
RR
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 }
c801d85f 98
5d25c050 99 return TRUE;
ff7b1510 100}
c801d85f 101
72cdf4c9 102bool wxScreenDC::EndDrawingOnTop()
c801d85f 103{
4bc67cc5 104 return TRUE;
ff7b1510
RR
105}
106
376aa62a
VZ
107void wxScreenDC::DoGetSize(int *width, int *height) const
108{
109 wxDisplaySize(width, height);
110}