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 #include "wx/region.h"
18 // -----------------------------------------------------------------------------
20 // -----------------------------------------------------------------------------
22 class WXDLLIMPEXP_CORE wxWindow
;
24 class WXDLLIMPEXP_CORE wxWindowDC
;
25 class WXDLLIMPEXP_CORE wxPaintDC
;
26 class WXDLLIMPEXP_CORE wxClientDC
;
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
32 class WXDLLIMPEXP_CORE wxWindowDC
: public wxDC
35 wxWindowDC() { Init(); }
36 wxWindowDC( wxWindow
*win
);
38 virtual ~wxWindowDC();
40 virtual bool CanDrawBitmap() const { return true; }
41 virtual bool CanGetTextExtent() const { return true; }
44 virtual void DoGetSize(int *width
, int *height
) const;
45 virtual bool DoFloodFill( wxCoord x
, wxCoord y
, const wxColour
& col
, int style
= wxFLOOD_SURFACE
);
46 virtual bool DoGetPixel( wxCoord x
, wxCoord y
, wxColour
*col
) const;
48 virtual void DoDrawPoint(wxCoord x
, wxCoord y
);
49 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
51 virtual void DoDrawIcon( const wxIcon
&icon
, wxCoord x
, wxCoord y
);
52 virtual void DoDrawBitmap( const wxBitmap
&bitmap
, wxCoord x
, wxCoord y
,
53 bool useMask
= false );
55 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
56 wxCoord x2
, wxCoord y2
,
57 wxCoord xc
, wxCoord yc
);
58 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
59 double sa
, double ea
);
61 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
62 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
63 wxCoord width
, wxCoord height
,
65 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
67 virtual void DoCrossHair(wxCoord x
, wxCoord y
);
69 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
70 virtual void DoDrawRotatedText(const wxString
&text
, wxCoord x
, wxCoord y
, double angle
);
72 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
73 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
74 int rop
= wxCOPY
, bool useMask
= false, wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1);
76 virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
);
77 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
78 wxCoord width
, wxCoord height
);
80 virtual void DoDrawLines(int n
, wxPoint points
[],
81 wxCoord xoffset
, wxCoord yoffset
);
82 virtual void DoDrawPolygon(int n
, wxPoint points
[],
83 wxCoord xoffset
, wxCoord yoffset
,
84 int fillStyle
= wxODDEVEN_RULE
);
90 virtual void SetFont(const wxFont
& font
);
91 virtual void SetPen(const wxPen
& pen
);
92 virtual void SetBrush(const wxBrush
& brush
);
93 virtual void SetBackground(const wxBrush
& brush
);
94 virtual void SetBackgroundMode(int mode
);
95 virtual void SetPalette(const wxPalette
& palette
);
96 virtual void SetLogicalFunction( int function
);
98 virtual void SetTextForeground(const wxColour
& colour
);
99 virtual void SetTextBackground(const wxColour
& colour
);
101 virtual wxCoord
GetCharHeight() const;
102 virtual wxCoord
GetCharWidth() const;
104 virtual int GetDepth() const;
105 virtual wxSize
GetPPI() const;
107 virtual void DestroyClippingRegion();
108 WXWindow
GetWindow() const { return m_window
; }
110 virtual void ComputeScaleAndOrigin();
115 virtual void DoGetTextExtent(const wxString
& string
,
116 wxCoord
*x
, wxCoord
*y
,
117 wxCoord
*descent
= NULL
,
118 wxCoord
*externalLeading
= NULL
,
119 const wxFont
*theFont
= NULL
) const;
123 WXDisplay
*m_display
;
133 wxRegion m_currentClippingRegion
;
134 wxRegion m_paintClippingRegion
;
137 PangoContext
*m_context
;
138 PangoFontDescription
*m_fontdesc
;
145 DECLARE_DYNAMIC_CLASS(wxWindowDC
)
148 //-----------------------------------------------------------------------------
150 //-----------------------------------------------------------------------------
152 class WXDLLIMPEXP_CORE wxClientDC
: public wxWindowDC
156 wxClientDC( wxWindow
*win
);
159 virtual void DoGetSize(int *width
, int *height
) const;
162 DECLARE_DYNAMIC_CLASS(wxClientDC
)
165 //-----------------------------------------------------------------------------
167 //-----------------------------------------------------------------------------
169 class WXDLLIMPEXP_CORE wxPaintDC
: public wxClientDC
173 wxPaintDC( wxWindow
*win
);
176 DECLARE_DYNAMIC_CLASS(wxPaintDC
)