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/dcclient.h"
17 #include "wx/x11/dc.h"
18 #include "wx/region.h"
20 // -----------------------------------------------------------------------------
22 // -----------------------------------------------------------------------------
24 class WXDLLIMPEXP_FWD_CORE wxWindow
;
26 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
30 class WXDLLIMPEXP_CORE wxWindowDCImpl
: public wxX11DCImpl
33 wxWindowDCImpl( wxDC
*owner
);
34 wxWindowDCImpl( wxDC
*owner
, wxWindow
*win
);
36 virtual ~wxWindowDCImpl();
38 virtual bool CanDrawBitmap() const { return true; }
39 virtual bool CanGetTextExtent() const { return true; }
42 virtual void DoGetSize(int *width
, int *height
) const;
43 virtual bool DoFloodFill( wxCoord x
, wxCoord y
, const wxColour
& col
,
44 wxFloodFillStyle style
= wxFLOOD_SURFACE
);
45 virtual bool DoGetPixel( wxCoord x
, wxCoord y
, wxColour
*col
) const;
47 virtual void DoDrawPoint(wxCoord x
, wxCoord y
);
48 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
50 virtual void DoDrawIcon( const wxIcon
&icon
, wxCoord x
, wxCoord y
);
51 virtual void DoDrawBitmap( const wxBitmap
&bitmap
, wxCoord x
, wxCoord y
,
52 bool useMask
= false );
54 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
55 wxCoord x2
, wxCoord y2
,
56 wxCoord xc
, wxCoord yc
);
57 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
58 double sa
, double ea
);
60 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
61 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
62 wxCoord width
, wxCoord height
,
64 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
66 virtual void DoCrossHair(wxCoord x
, wxCoord y
);
68 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
69 virtual void DoDrawRotatedText(const wxString
&text
, wxCoord x
, wxCoord y
, double angle
);
71 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
72 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
73 wxRasterOperationMode rop
= wxCOPY
, bool useMask
= false,
74 wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1);
76 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
77 wxCoord width
, wxCoord height
);
78 virtual void DoSetDeviceClippingRegion(const wxRegion
& region
);
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 wxPolygonFillMode 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( wxRasterOperationMode 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
GetX11Window() const { return m_x11window
; }
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
;
124 WXWindow m_x11window
;
132 wxRegion m_currentClippingRegion
;
133 wxRegion m_paintClippingRegion
;
136 PangoContext
*m_context
;
137 PangoFontDescription
*m_fontdesc
;
144 DECLARE_CLASS(wxWindowDCImpl
)
147 //-----------------------------------------------------------------------------
149 //-----------------------------------------------------------------------------
151 class WXDLLIMPEXP_CORE wxClientDCImpl
: public wxWindowDCImpl
154 wxClientDCImpl( wxDC
*owner
) : wxWindowDCImpl( owner
) { }
155 wxClientDCImpl( wxDC
*owner
, wxWindow
*win
);
158 virtual void DoGetSize(int *width
, int *height
) const;
161 DECLARE_CLASS(wxClientDCImpl
)
164 //-----------------------------------------------------------------------------
166 //-----------------------------------------------------------------------------
168 class WXDLLIMPEXP_CORE wxPaintDCImpl
: public wxClientDCImpl
171 wxPaintDCImpl( wxDC
*owner
) : wxClientDCImpl( owner
) { }
172 wxPaintDCImpl( wxDC
*owner
, wxWindow
*win
);
175 DECLARE_CLASS(wxPaintDCImpl
)