1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxClientDC, wxPaintDC and wxWindowDC classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DCCLIENT_H_
13 #define _WX_DCCLIENT_H_
16 #pragma interface "dcclient.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 class WXDLLEXPORT wxWindowDC
;
26 class WXDLLEXPORT wxWindow
;
28 // Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented differently.
29 // On many platforms, however, they will be the same.
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 class WXDLLEXPORT wxWindowDC
: public wxDC
37 DECLARE_DYNAMIC_CLASS(wxWindowDC
)
42 wxWindowDC( wxWindow
*win
);
46 virtual void FloodFill( long x1
, long y1
, wxColour
* col
, int style
=wxFLOOD_SURFACE
);
47 virtual bool GetPixel( long x1
, long y1
, wxColour
*col
) const;
49 virtual void DrawLine( long x1
, long y1
, long x2
, long y2
);
50 virtual void CrossHair( long x
, long y
);
51 virtual void DrawArc( long x1
, long y1
, long x2
, long y2
, long xc
, long yc
);
52 virtual void DrawEllipticArc( long x
, long y
, long width
, long height
, double sa
, double ea
);
53 virtual void DrawPoint( long x
, long y
);
55 virtual void DrawLines( int n
, wxPoint points
[], long xoffset
= 0, long yoffset
= 0 );
56 virtual void DrawLines( wxList
*points
, long xoffset
= 0, long yoffset
= 0 );
57 virtual void DrawPolygon( int n
, wxPoint points
[], long xoffset
= 0, long yoffset
= 0,
58 int fillStyle
=wxODDEVEN_RULE
);
59 virtual void DrawPolygon( wxList
*lines
, long xoffset
= 0, long yoffset
= 0,
60 int fillStyle
=wxODDEVEN_RULE
);
62 virtual void DrawRectangle( long x
, long y
, long width
, long height
);
63 virtual void DrawRoundedRectangle( long x
, long y
, long width
, long height
, double radius
= 20.0 );
64 virtual void DrawEllipse( long x
, long y
, long width
, long height
);
66 virtual bool CanDrawBitmap(void) const;
67 virtual void DrawIcon( const wxIcon
&icon
, long x
, long y
, bool useMask
=FALSE
);
68 virtual bool Blit( long xdest
, long ydest
, long width
, long height
,
69 wxDC
*source
, long xsrc
, long ysrc
, int logical_func
= wxCOPY
, bool useMask
=FALSE
);
71 virtual void DrawText( const wxString
&text
, long x
, long y
, bool use16
= FALSE
);
72 virtual bool CanGetTextExtent(void) const;
73 virtual void GetTextExtent( const wxString
&string
, long *width
, long *height
,
74 long *descent
= NULL
, long *externalLeading
= NULL
,
75 wxFont
*theFont
= NULL
, bool use16
= FALSE
);
76 virtual long GetCharWidth(void);
77 virtual long GetCharHeight(void);
79 virtual void Clear(void);
81 virtual void SetFont( const wxFont
&font
);
82 virtual void SetPen( const wxPen
&pen
);
83 virtual void SetBrush( const wxBrush
&brush
);
84 virtual void SetBackground( const wxBrush
&brush
);
85 virtual void SetLogicalFunction( int function
);
86 virtual void SetTextForeground( const wxColour
&col
);
87 virtual void SetTextBackground( const wxColour
&col
);
88 virtual void SetBackgroundMode( int mode
);
89 virtual void SetPalette( const wxPalette
& palette
);
91 virtual void SetClippingRegion( long x
, long y
, long width
, long height
);
92 virtual void DestroyClippingRegion(void);
94 virtual void DrawOpenSpline( wxList
*points
);
97 void SetDCClipping (); // Helper function for setting clipping
102 WXDisplay
* m_display
;
104 WXRegion m_currentRegion
; // Current clipping region (incl. paint clip region)
105 WXRegion m_userRegion
; // User-defined clipping region
106 WXPixmap m_pixmap
; // Pixmap for drawing on
108 // Not sure if we'll need all of these
109 int m_backgroundPixel
;
110 wxColour m_currentColour
;
111 // int m_currentBkMode;
112 int m_currentPenWidth
;
113 int m_currentPenJoin
;
114 int m_currentPenCap
;
115 int m_currentPenDashCount
;
116 char* m_currentPenDash
;
117 wxBitmap m_currentStipple
;
120 int m_autoSetting
; // See comment in dcclient.cpp
123 class WXDLLEXPORT wxPaintDC
: public wxWindowDC
125 DECLARE_DYNAMIC_CLASS(wxPaintDC
)
128 wxPaintDC(wxWindow
* win
): wxWindowDC(win
) {}
131 class WXDLLEXPORT wxClientDC
: public wxWindowDC
133 DECLARE_DYNAMIC_CLASS(wxClientDC
)
136 wxClientDC(wxWindow
* win
): wxWindowDC(win
) {}