X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1248b41f9f71110347659db8c54c75786eba23c6..654c223bc7c5457e407ff7d127a8129c821b07e4:/src/motif/dcscreen.cpp?ds=sidebyside diff --git a/src/motif/dcscreen.cpp b/src/motif/dcscreen.cpp index 71f3c01e54..31101b5dc8 100644 --- a/src/motif/dcscreen.cpp +++ b/src/motif/dcscreen.cpp @@ -1,25 +1,23 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dcscreen.cpp -// Purpose: wxScreenDC class +// Name: src/motif/dcscreen.cpp +// Purpose: wxScreenDCImpl class // Author: Julian Smart // Modified by: // Created: 17/09/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "dcscreen.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#include "wx/window.h" -#include "wx/frame.h" -#include "wx/dcscreen.h" -#include "wx/utils.h" +#ifndef WX_PRECOMP + #include "wx/utils.h" + #include "wx/window.h" + #include "wx/frame.h" + #include "wx/dcscreen.h" +#endif #ifdef __VMS__ #pragma message disable nosimpint @@ -30,19 +28,21 @@ #endif #include "wx/motif/private.h" +#include "wx/motif/dcscreen.h" -IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) +IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl) -WXWindow wxScreenDC::sm_overlayWindow = 0; -int wxScreenDC::sm_overlayWindowX = 0; -int wxScreenDC::sm_overlayWindowY = 0; +WXWindow wxScreenDCImpl::sm_overlayWindow = 0; +int wxScreenDCImpl::sm_overlayWindowX = 0; +int wxScreenDCImpl::sm_overlayWindowY = 0; // Create a DC representing the whole screen -wxScreenDC::wxScreenDC() +wxScreenDCImpl::wxScreenDCImpl(wxScreenDC *owner) + : wxWindowDCImpl(owner) { m_display = wxGetDisplay(); Display* display = (Display*) m_display; - + if (sm_overlayWindow) { m_pixmap = sm_overlayWindow; @@ -51,7 +51,7 @@ wxScreenDC::wxScreenDC() } else m_pixmap = (WXPixmap) RootWindow(display, DefaultScreen(display)); - + XGCValues gcvalues; gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.background = WhitePixel (display, DefaultScreen (display)); @@ -61,17 +61,17 @@ wxScreenDC::wxScreenDC() m_gc = XCreateGC (display, RootWindow (display, DefaultScreen (display)), GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); - - m_backgroundPixel = (int) gcvalues.background; - m_ok = TRUE; + + m_backgroundPixel = gcvalues.background; + m_ok = true; } -wxScreenDC::~wxScreenDC() +wxScreenDCImpl::~wxScreenDCImpl() { EndDrawingOnTop(); } -bool wxScreenDC::StartDrawingOnTop(wxWindow* window) +bool wxScreenDCImpl::StartDrawingOnTop(wxWindow* window) { wxRect rect; int x, y, width, height; @@ -81,23 +81,23 @@ bool wxScreenDC::StartDrawingOnTop(wxWindow* window) window->GetSize(& width, & height); rect.x = x; rect.y = y; rect.width = width; rect.height = height; - + return StartDrawingOnTop(& rect); } -bool wxScreenDC::StartDrawingOnTop(wxRect* rect) +bool wxScreenDCImpl::StartDrawingOnTop(wxRect* rect) { if (sm_overlayWindow) - return FALSE; - + return false; + Display *dpy = (Display*) wxGetDisplay(); Pixmap screenPixmap = RootWindow(dpy, DefaultScreen(dpy)); - + int x = 0; int y = 0; int width, height; wxDisplaySize(&width, &height); - + if (rect) { x = rect->x; y = rect->y; @@ -105,33 +105,33 @@ bool wxScreenDC::StartDrawingOnTop(wxRect* rect) } sm_overlayWindowX = x; sm_overlayWindowY = y; - + XSetWindowAttributes attributes; attributes.override_redirect = True; unsigned long valueMask = CWOverrideRedirect; - + sm_overlayWindow = (WXWindow) XCreateWindow(dpy, screenPixmap, x, y, width, height, 0, wxDisplayDepth(), InputOutput, DefaultVisual(dpy, 0), valueMask, & attributes); - + if (sm_overlayWindow) { XMapWindow(dpy, (Window) sm_overlayWindow); - return TRUE; + return true; } else - return FALSE; + return false; } -bool wxScreenDC::EndDrawingOnTop() +bool wxScreenDCImpl::EndDrawingOnTop() { if (sm_overlayWindow) { XDestroyWindow((Display*) wxGetDisplay(), (Window) sm_overlayWindow); sm_overlayWindow = 0; - return TRUE; + return true; } else - return FALSE; + return false; }