]> git.saurik.com Git - wxWidgets.git/blame - src/x11/dcscreen.cpp
more GTK-ish toolbar drawing
[wxWidgets.git] / src / x11 / dcscreen.cpp
CommitLineData
83df96d6
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: dcscreen.cpp
3// Purpose: wxScreenDC class
3cd0b8c5 4// Author: Julian Smart, Robert Roebling
83df96d6
JS
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
3cd0b8c5 8// Copyright: (c) Julian Smart, Robert Roebling
83df96d6
JS
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "dcscreen.h"
14#endif
15
16#include "wx/window.h"
17#include "wx/frame.h"
18#include "wx/dcscreen.h"
19#include "wx/utils.h"
20
bc797f4c 21#include "wx/x11/private.h"
83df96d6 22
3cd0b8c5
RR
23//-----------------------------------------------------------------------------
24// global data initialization
25//-----------------------------------------------------------------------------
83df96d6 26
3cd0b8c5 27WXWindow *wxScreenDC::sm_overlayWindow = (WXWindow*) NULL;
83df96d6
JS
28int wxScreenDC::sm_overlayWindowX = 0;
29int wxScreenDC::sm_overlayWindowY = 0;
30
3cd0b8c5
RR
31//-----------------------------------------------------------------------------
32// wxScreenDC
33//-----------------------------------------------------------------------------
34
35IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
36
83df96d6
JS
37wxScreenDC::wxScreenDC()
38{
3cd0b8c5 39 m_ok = FALSE;
83df96d6 40
3cd0b8c5 41 m_display = (WXDisplay *) wxGlobalDisplay();
83df96d6 42
3cd0b8c5
RR
43 int screen = DefaultScreen( (Display*) m_display );
44 m_cmap = (WXColormap) DefaultColormap( (Display*) m_display, screen );
83df96d6 45
3cd0b8c5
RR
46 m_window = (WXWindow) RootWindow( (Display*) m_display, screen );
47
48 m_isScreenDC = TRUE;
49
50 SetUpDC();
51
52 XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, IncludeInferiors );
53 XSetSubwindowMode( (Display*) m_display, (GC) m_brushGC, IncludeInferiors );
54 XSetSubwindowMode( (Display*) m_display, (GC) m_textGC, IncludeInferiors );
55 XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, IncludeInferiors );
83df96d6
JS
56}
57
58wxScreenDC::~wxScreenDC()
59{
3cd0b8c5
RR
60 XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren );
61 XSetSubwindowMode( (Display*) m_display, (GC) m_brushGC, ClipByChildren );
62 XSetSubwindowMode( (Display*) m_display, (GC) m_textGC, ClipByChildren );
63 XSetSubwindowMode( (Display*) m_display, (GC) m_bgGC, ClipByChildren );
64
83df96d6
JS
65 EndDrawingOnTop();
66}
67
3cd0b8c5 68bool wxScreenDC::StartDrawingOnTop( wxWindow *window )
83df96d6 69{
3cd0b8c5
RR
70 if (!window) return StartDrawingOnTop();
71
72 int x = 0;
73 int y = 0;
74 window->GetPosition( &x, &y );
75 int w = 0;
76 int h = 0;
77 window->GetSize( &w, &h );
78 window->ClientToScreen( &x, &y );
79
83df96d6 80 wxRect rect;
3cd0b8c5
RR
81 rect.x = x;
82 rect.y = y;
83 rect.width = 0;
84 rect.height = 0;
85
86 return StartDrawingOnTop( &rect );
83df96d6
JS
87}
88
3cd0b8c5 89bool wxScreenDC::StartDrawingOnTop( wxRect *rect )
83df96d6 90{
83df96d6
JS
91 int x = 0;
92 int y = 0;
3cd0b8c5
RR
93#if 0
94 int width = gdk_screen_width();
95 int height = gdk_screen_height();
96#else
97 int width = 1024;
98 int height = 768;
99#endif
83df96d6
JS
100 if (rect)
101 {
3cd0b8c5
RR
102 x = rect->x;
103 y = rect->y;
104 width = rect->width;
105 height = rect->height;
83df96d6 106 }
3cd0b8c5
RR
107
108 return TRUE;
83df96d6
JS
109}
110
111bool wxScreenDC::EndDrawingOnTop()
112{
3cd0b8c5
RR
113 return TRUE;
114}
115
116void wxScreenDC::DoGetSize(int *width, int *height) const
117{
118 wxDisplaySize(width, height);
83df96d6 119}