1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dcclient.h
|
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-26 10:56:58 +00:00
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
1998-12-09 17:30:17 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __GTKDCCLIENTH__
|
|
|
|
#define __GTKDCCLIENTH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/dc.h"
|
|
|
|
#include "wx/window.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-01 12:55:09 +00:00
|
|
|
class wxWindowDC;
|
1998-05-20 14:01:55 +00:00
|
|
|
class wxPaintDC;
|
1998-12-01 12:55:09 +00:00
|
|
|
class wxClientDC;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
1998-12-01 12:55:09 +00:00
|
|
|
// wxWindowDC
|
1998-05-20 14:01:55 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1999-05-13 23:02:35 +00:00
|
|
|
class wxWindowDC : public wxDC
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
1998-12-01 12:55:09 +00:00
|
|
|
public:
|
1999-05-13 23:02:35 +00:00
|
|
|
wxWindowDC();
|
|
|
|
wxWindowDC( wxWindow *win );
|
|
|
|
|
2001-06-27 12:17:39 +00:00
|
|
|
virtual ~wxWindowDC();
|
1999-05-13 23:02:35 +00:00
|
|
|
|
|
|
|
virtual bool CanDrawBitmap() const { return TRUE; }
|
|
|
|
virtual bool CanGetTextExtent() const { return TRUE; }
|
|
|
|
|
2000-10-30 16:43:37 +00:00
|
|
|
protected:
|
|
|
|
virtual void DoGetSize(int *width, int *height) const;
|
2002-04-17 11:48:11 +00:00
|
|
|
virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE );
|
1999-10-18 15:14:52 +00:00
|
|
|
virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const;
|
|
|
|
|
|
|
|
virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 );
|
|
|
|
virtual void DoCrossHair( wxCoord x, wxCoord y );
|
|
|
|
virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
|
|
|
|
wxCoord xc, wxCoord yc );
|
|
|
|
virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height,
|
1999-05-13 23:02:35 +00:00
|
|
|
double sa, double ea );
|
1999-10-18 15:14:52 +00:00
|
|
|
virtual void DoDrawPoint( wxCoord x, wxCoord y );
|
1999-05-13 23:02:35 +00:00
|
|
|
|
|
|
|
virtual void DoDrawLines(int n, wxPoint points[],
|
1999-10-18 15:14:52 +00:00
|
|
|
wxCoord xoffset, wxCoord yoffset);
|
1999-05-13 23:02:35 +00:00
|
|
|
virtual void DoDrawPolygon(int n, wxPoint points[],
|
1999-10-18 15:14:52 +00:00
|
|
|
wxCoord xoffset, wxCoord yoffset,
|
1999-05-13 23:02:35 +00:00
|
|
|
int fillStyle = wxODDEVEN_RULE);
|
|
|
|
|
1999-10-18 15:14:52 +00:00
|
|
|
virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
|
|
|
virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 );
|
|
|
|
virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
1999-05-13 23:02:35 +00:00
|
|
|
|
1999-10-18 15:14:52 +00:00
|
|
|
virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
|
|
|
|
virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
|
1999-05-13 23:02:35 +00:00
|
|
|
bool useMask = FALSE );
|
|
|
|
|
1999-10-18 15:14:52 +00:00
|
|
|
virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|
|
|
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
2001-07-11 10:07:06 +00:00
|
|
|
int logical_func = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 );
|
1999-05-13 23:02:35 +00:00
|
|
|
|
1999-10-18 15:14:52 +00:00
|
|
|
virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y );
|
1999-12-06 09:35:27 +00:00
|
|
|
virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
|
|
|
|
double angle);
|
1999-10-18 15:14:52 +00:00
|
|
|
virtual void DoGetTextExtent( const wxString &string,
|
|
|
|
wxCoord *width, wxCoord *height,
|
|
|
|
wxCoord *descent = (wxCoord *) NULL,
|
|
|
|
wxCoord *externalLeading = (wxCoord *) NULL,
|
1999-05-13 23:02:35 +00:00
|
|
|
wxFont *theFont = (wxFont *) NULL) const;
|
2000-10-30 16:43:37 +00:00
|
|
|
|
|
|
|
public:
|
1999-10-18 15:14:52 +00:00
|
|
|
virtual wxCoord GetCharWidth() const;
|
|
|
|
virtual wxCoord GetCharHeight() const;
|
1999-05-13 23:02:35 +00:00
|
|
|
|
|
|
|
virtual void Clear();
|
|
|
|
|
|
|
|
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 SetLogicalFunction( int function );
|
|
|
|
virtual void SetTextForeground( const wxColour &col );
|
|
|
|
virtual void SetTextBackground( const wxColour &col );
|
|
|
|
virtual void SetBackgroundMode( int mode );
|
|
|
|
virtual void SetPalette( const wxPalette& palette );
|
|
|
|
|
1999-10-18 15:14:52 +00:00
|
|
|
virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
1999-05-13 23:02:35 +00:00
|
|
|
virtual void DestroyClippingRegion();
|
|
|
|
virtual void DoSetClippingRegionAsRegion( const wxRegion ®ion );
|
|
|
|
|
|
|
|
// Resolution in pixels per logical inch
|
|
|
|
virtual wxSize GetPPI() const;
|
|
|
|
virtual int GetDepth() const;
|
|
|
|
|
|
|
|
// implementation
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
GdkWindow *m_window;
|
|
|
|
GdkGC *m_penGC;
|
|
|
|
GdkGC *m_brushGC;
|
|
|
|
GdkGC *m_textGC;
|
|
|
|
GdkGC *m_bgGC;
|
|
|
|
GdkColormap *m_cmap;
|
|
|
|
bool m_isMemDC;
|
2000-03-04 16:23:26 +00:00
|
|
|
bool m_isScreenDC;
|
1999-05-13 23:02:35 +00:00
|
|
|
wxWindow *m_owner;
|
2000-02-21 14:16:32 +00:00
|
|
|
wxRegion m_currentClippingRegion;
|
|
|
|
wxRegion m_paintClippingRegion;
|
2000-07-19 10:44:14 +00:00
|
|
|
#ifdef __WXGTK20__
|
|
|
|
PangoContext *m_context;
|
|
|
|
PangoFontDescription *m_fontdesc;
|
|
|
|
#endif
|
1999-05-13 23:02:35 +00:00
|
|
|
|
|
|
|
void SetUpDC();
|
|
|
|
void Destroy();
|
1999-05-26 20:40:04 +00:00
|
|
|
void ComputeScaleAndOrigin();
|
|
|
|
|
1999-05-13 23:02:35 +00:00
|
|
|
GdkWindow *GetWindow() { return m_window; }
|
2000-02-17 12:53:36 +00:00
|
|
|
|
1999-11-22 19:44:25 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxWindowDC)
|
1998-12-01 12:55:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-10-30 16:43:37 +00:00
|
|
|
// wxClientDC
|
1998-12-01 12:55:09 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2000-10-30 16:43:37 +00:00
|
|
|
class wxClientDC : public wxWindowDC
|
1998-12-01 12:55:09 +00:00
|
|
|
{
|
|
|
|
public:
|
2001-06-27 12:17:39 +00:00
|
|
|
wxClientDC() { }
|
2000-10-30 16:43:37 +00:00
|
|
|
wxClientDC( wxWindow *win );
|
2000-02-17 12:53:36 +00:00
|
|
|
|
2000-10-31 15:13:54 +00:00
|
|
|
protected:
|
|
|
|
virtual void DoGetSize(int *width, int *height) const;
|
|
|
|
|
1999-11-22 19:44:25 +00:00
|
|
|
private:
|
2000-10-30 16:43:37 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxClientDC)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
1998-12-01 12:55:09 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
2000-10-30 16:43:37 +00:00
|
|
|
// wxPaintDC
|
1998-12-01 12:55:09 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2000-10-30 16:43:37 +00:00
|
|
|
class wxPaintDC : public wxClientDC
|
1998-12-01 12:55:09 +00:00
|
|
|
{
|
|
|
|
public:
|
2000-10-30 16:43:37 +00:00
|
|
|
wxPaintDC() { }
|
|
|
|
wxPaintDC( wxWindow *win );
|
2000-02-17 12:53:36 +00:00
|
|
|
|
1999-11-22 19:44:25 +00:00
|
|
|
private:
|
2000-10-30 16:43:37 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPaintDC)
|
1998-12-01 12:55:09 +00:00
|
|
|
};
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif // __GTKDCCLIENTH__
|