1998-09-18 06:19:10 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-07-25 10:31:55 -04:00
|
|
|
// Name: wx/motif/dcclient.h
|
2007-12-14 19:06:08 -05:00
|
|
|
// Purpose: wxClientDCImpl, wxPaintDCImpl and wxWindowDCImpl classes
|
1998-09-18 06:19:10 -04:00
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 17/09/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-09-18 06:19:10 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_DCCLIENT_H_
|
|
|
|
#define _WX_DCCLIENT_H_
|
|
|
|
|
2007-12-14 19:06:08 -05:00
|
|
|
#include "wx/motif/dc.h"
|
1998-09-18 06:19:10 -04:00
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
1998-09-18 06:19:10 -04:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2007-12-14 19:06:08 -05:00
|
|
|
// wxWindowDCImpl
|
1998-09-18 06:19:10 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxMotifDCImpl
|
1998-09-18 06:19:10 -04:00
|
|
|
{
|
1999-06-08 15:10:37 -04:00
|
|
|
public:
|
2007-12-14 19:06:08 -05:00
|
|
|
wxWindowDCImpl(wxDC *owner);
|
|
|
|
wxWindowDCImpl(wxDC *owner, wxWindow *win);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
2007-12-14 19:06:08 -05:00
|
|
|
virtual ~wxWindowDCImpl();
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
// TODO this function is Motif-only for now - should it go into base class?
|
|
|
|
void Clear(const wxRect& rect);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
// implement base class pure virtuals
|
|
|
|
// ----------------------------------
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
virtual void Clear();
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
virtual void SetFont(const wxFont& font);
|
|
|
|
virtual void SetPen(const wxPen& pen);
|
|
|
|
virtual void SetBrush(const wxBrush& brush);
|
|
|
|
virtual void SetBackground(const wxBrush& brush);
|
|
|
|
virtual void SetBackgroundMode(int mode);
|
|
|
|
virtual void SetPalette(const wxPalette& palette);
|
2009-01-08 09:21:53 -05:00
|
|
|
virtual void SetLogicalFunction( wxRasterOperationMode function );
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
virtual void SetTextForeground(const wxColour& colour);
|
|
|
|
virtual void SetTextBackground(const wxColour& colour);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual wxCoord GetCharHeight() const;
|
|
|
|
virtual wxCoord GetCharWidth() const;
|
|
|
|
virtual void DoGetTextExtent(const wxString& string,
|
2002-02-05 11:34:33 -05:00
|
|
|
wxCoord *x, wxCoord *y,
|
|
|
|
wxCoord *descent = NULL,
|
|
|
|
wxCoord *externalLeading = NULL,
|
2007-04-24 21:49:47 -04:00
|
|
|
const wxFont *theFont = NULL) const;
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
virtual bool CanDrawBitmap() const;
|
|
|
|
virtual bool CanGetTextExtent() const;
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
virtual int GetDepth() const;
|
|
|
|
virtual wxSize GetPPI() const;
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
virtual void DestroyClippingRegion();
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
// Helper function for setting clipping
|
2003-05-24 15:41:05 -04:00
|
|
|
void SetDCClipping(WXRegion region);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
// implementation from now on
|
|
|
|
// --------------------------
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
WXGC GetGC() const { return m_gc; }
|
|
|
|
WXGC GetBackingGC() const { return m_gcBacking; }
|
|
|
|
WXDisplay* GetDisplay() const { return m_display; }
|
2005-10-03 12:39:45 -04:00
|
|
|
bool GetAutoSetting() const { return (m_autoSetting != 0); } // See comment in dcclient.cpp
|
1999-06-08 15:10:37 -04:00
|
|
|
void SetAutoSetting(bool flag) { m_autoSetting = flag; }
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1998-09-20 16:59:30 -04:00
|
|
|
protected:
|
2002-07-29 16:31:22 -04:00
|
|
|
// note that this function will call colour.SetPixel,
|
|
|
|
// and will do one of curCol = colour, curCol = wxWHITE, curCol = wxBLACK
|
|
|
|
// roundToWhite has an effect for monochrome display only
|
2005-02-06 12:38:33 -05:00
|
|
|
// if roundToWhite == true then the colour will be set to white unless
|
|
|
|
// it is RGB 0x000000;if roundToWhite == true the colour wull be set to
|
2002-07-29 16:31:22 -04:00
|
|
|
// black unless it id RGB 0xffffff
|
2006-10-05 15:34:25 -04:00
|
|
|
WXPixel CalculatePixel(wxColour& colour, wxColour& curCol,
|
|
|
|
bool roundToWhite) const;
|
2002-07-29 16:31:22 -04:00
|
|
|
// sets the foreground pixel taking into account the
|
|
|
|
// currently selected logical operation
|
2006-10-05 15:34:25 -04:00
|
|
|
void SetForegroundPixelWithLogicalFunction(WXPixel pixel);
|
2002-07-29 16:31:22 -04:00
|
|
|
|
2002-04-17 07:48:11 -04:00
|
|
|
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
|
2009-01-08 09:21:53 -05:00
|
|
|
wxFloodFillStyle style = wxFLOOD_SURFACE);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual void DoDrawPoint(wxCoord x, wxCoord y);
|
|
|
|
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
|
2002-02-05 11:34:33 -05:00
|
|
|
wxCoord x2, wxCoord y2,
|
|
|
|
wxCoord xc, wxCoord yc);
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
2002-02-05 11:34:33 -05:00
|
|
|
double sa, double ea);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
|
|
|
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
|
2002-02-05 11:34:33 -05:00
|
|
|
wxCoord width, wxCoord height,
|
|
|
|
double radius);
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual void DoCrossHair(wxCoord x, wxCoord y);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
|
1999-12-08 03:28:22 -05:00
|
|
|
virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
2002-02-05 11:34:33 -05:00
|
|
|
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
2009-01-08 09:21:53 -05:00
|
|
|
wxRasterOperationMode rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-10-18 23:26:24 -04:00
|
|
|
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
|
2002-02-05 11:34:33 -05:00
|
|
|
wxCoord width, wxCoord height);
|
2008-06-07 21:45:56 -04:00
|
|
|
virtual void DoSetDeviceClippingRegion(const wxRegion& region);
|
2005-09-25 16:39:23 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
virtual void DoDrawLines(int n, wxPoint points[],
|
2002-02-05 11:34:33 -05:00
|
|
|
wxCoord xoffset, wxCoord yoffset);
|
1999-06-08 15:10:37 -04:00
|
|
|
virtual void DoDrawPolygon(int n, wxPoint points[],
|
2002-02-05 11:34:33 -05:00
|
|
|
wxCoord xoffset, wxCoord yoffset,
|
2009-01-08 09:21:53 -05:00
|
|
|
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
|
2003-05-17 16:14:07 -04:00
|
|
|
|
|
|
|
void DoGetSize( int *width, int *height ) const;
|
|
|
|
|
|
|
|
// common part of constructors
|
|
|
|
void Init();
|
|
|
|
|
1998-09-20 16:59:30 -04:00
|
|
|
WXGC m_gc;
|
|
|
|
WXGC m_gcBacking;
|
|
|
|
WXDisplay* m_display;
|
|
|
|
wxWindow* m_window;
|
2003-05-24 15:41:05 -04:00
|
|
|
// Pixmap for drawing on
|
|
|
|
WXPixmap m_pixmap;
|
|
|
|
// Last clipping region set on th GC, this is the combination
|
|
|
|
// of paint clipping region and all user-defined clipping regions
|
|
|
|
WXRegion m_clipRegion;
|
|
|
|
|
1998-09-20 16:59:30 -04:00
|
|
|
// Not sure if we'll need all of these
|
2006-10-05 15:34:25 -04:00
|
|
|
WXPixel m_backgroundPixel;
|
1998-09-20 16:59:30 -04:00
|
|
|
wxColour m_currentColour;
|
|
|
|
int m_currentPenWidth ;
|
|
|
|
int m_currentPenJoin ;
|
|
|
|
int m_currentPenCap ;
|
|
|
|
int m_currentPenDashCount ;
|
2003-02-20 13:20:47 -05:00
|
|
|
wxX11Dash* m_currentPenDash ;
|
1998-09-20 16:59:30 -04:00
|
|
|
wxBitmap m_currentStipple ;
|
|
|
|
int m_currentStyle ;
|
|
|
|
int m_currentFill ;
|
1998-09-22 17:15:56 -04:00
|
|
|
int m_autoSetting ; // See comment in dcclient.cpp
|
2007-12-14 19:06:08 -05:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxWindowDCImpl)
|
1998-09-22 17:15:56 -04:00
|
|
|
};
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxPaintDCImpl: public wxWindowDCImpl
|
1998-09-22 17:15:56 -04:00
|
|
|
{
|
|
|
|
public:
|
2007-12-14 19:06:08 -05:00
|
|
|
wxPaintDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { }
|
|
|
|
wxPaintDCImpl(wxDC *owner, wxWindow* win);
|
|
|
|
|
|
|
|
virtual ~wxPaintDCImpl();
|
2005-09-25 16:39:23 -04:00
|
|
|
|
2007-12-14 19:06:08 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPaintDCImpl)
|
1998-09-22 17:15:56 -04:00
|
|
|
};
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxClientDCImpl: public wxWindowDCImpl
|
1998-09-22 17:15:56 -04:00
|
|
|
{
|
|
|
|
public:
|
2007-12-14 19:06:08 -05:00
|
|
|
wxClientDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { }
|
|
|
|
wxClientDCImpl(wxDC *owner, wxWindow* win)
|
|
|
|
: wxWindowDCImpl(owner, win) { }
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxClientDCImpl)
|
1998-09-18 06:19:10 -04:00
|
|
|
};
|
|
|
|
|
2005-09-25 16:39:23 -04:00
|
|
|
#endif // _WX_DCCLIENT_H_
|