]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dcgraph.h
Split wxWebHistoryItem headers out into separate files for each backend. This will...
[wxWidgets.git] / include / wx / dcgraph.h
CommitLineData
8acd14d1 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/dcgraph.h
8acd14d1
SC
3// Purpose: graphics context device bridge header
4// Author: Stefan Csomor
5// Modified by:
6// Created:
7// Copyright: (c) Stefan Csomor
8// RCS-ID: $Id$
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GRAPHICS_DC_H_
13#define _WX_GRAPHICS_DC_H_
14
15#if wxUSE_GRAPHICS_CONTEXT
16
11a0827d 17#include "wx/dc.h"
8acd14d1 18#include "wx/geometry.h"
2b73854d 19#include "wx/graphics.h"
8acd14d1 20
b5dbe15d 21class WXDLLIMPEXP_FWD_CORE wxWindowDC;
8acd14d1 22
8acd14d1 23
53a2db12 24class WXDLLIMPEXP_CORE wxGCDC: public wxDC
8acd14d1 25{
888dde65
RR
26public:
27 wxGCDC( const wxWindowDC& dc );
28 wxGCDC( const wxMemoryDC& dc );
220d37c8 29#if wxUSE_PRINTING_ARCHITECTURE
b25c34aa 30 wxGCDC( const wxPrinterDC& dc );
2d770c4f
VZ
31#endif
32#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
33 wxGCDC( const wxEnhMetaFileDC& dc );
220d37c8 34#endif
888dde65 35 wxGCDC();
4dd36d1d 36 virtual ~wxGCDC();
03647350 37
6c0e710f 38 wxGraphicsContext* GetGraphicsContext() const;
888dde65 39 void SetGraphicsContext( wxGraphicsContext* ctx );
03647350 40
942d5e2d
VZ
41#ifdef __WXMSW__
42 // override wxDC virtual functions to provide access to HDC associated with
43 // this Graphics object (implemented in src/msw/graphics.cpp)
44 virtual WXHDC AcquireHDC();
45 virtual void ReleaseHDC(WXHDC hdc);
46#endif // __WXMSW__
47
48private:
8acd14d1 49 DECLARE_DYNAMIC_CLASS(wxGCDC)
c0c133e1 50 wxDECLARE_NO_COPY_CLASS(wxGCDC);
888dde65 51};
8acd14d1 52
888dde65 53
53a2db12 54class WXDLLIMPEXP_CORE wxGCDCImpl: public wxDCImpl
888dde65 55{
8acd14d1 56public:
888dde65
RR
57 wxGCDCImpl( wxDC *owner, const wxWindowDC& dc );
58 wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc );
220d37c8 59#if wxUSE_PRINTING_ARCHITECTURE
b25c34aa 60 wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc );
2d770c4f
VZ
61#endif
62#if defined(__WXMSW__) && wxUSE_ENH_METAFILE
63 wxGCDCImpl( wxDC *owner, const wxEnhMetaFileDC& dc );
220d37c8 64#endif
888dde65 65 wxGCDCImpl( wxDC *owner );
03647350 66
888dde65 67 virtual ~wxGCDCImpl();
8acd14d1
SC
68
69 void Init();
70
71
72 // implement base class pure virtuals
73 // ----------------------------------
74
75 virtual void Clear();
76
cc18b1c7
SC
77 virtual bool StartDoc( const wxString& message );
78 virtual void EndDoc();
79
80 virtual void StartPage();
81 virtual void EndPage();
03647350 82
cc18b1c7
SC
83 // flushing the content of this dc immediately onto screen
84 virtual void Flush();
8acd14d1
SC
85
86 virtual void SetFont(const wxFont& font);
87 virtual void SetPen(const wxPen& pen);
88 virtual void SetBrush(const wxBrush& brush);
89 virtual void SetBackground(const wxBrush& brush);
90 virtual void SetBackgroundMode(int mode);
91 virtual void SetPalette(const wxPalette& palette);
92
93 virtual void DestroyClippingRegion();
94
95 virtual wxCoord GetCharHeight() const;
96 virtual wxCoord GetCharWidth() const;
97
98 virtual bool CanDrawBitmap() const;
99 virtual bool CanGetTextExtent() const;
100 virtual int GetDepth() const;
101 virtual wxSize GetPPI() const;
102
89efaf2b 103 virtual void SetMapMode(wxMappingMode mode);
8acd14d1 104
89efaf2b 105 virtual void SetLogicalFunction(wxRasterOperationMode function);
8acd14d1
SC
106
107 virtual void SetTextForeground(const wxColour& colour);
108 virtual void SetTextBackground(const wxColour& colour);
109
110 virtual void ComputeScaleAndOrigin();
111
6c0e710f 112 wxGraphicsContext* GetGraphicsContext() const { return m_graphicContext; }
b687dd2f 113 virtual void SetGraphicsContext( wxGraphicsContext* ctx );
03647350 114
8acd14d1
SC
115 // the true implementations
116 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
89efaf2b 117 wxFloodFillStyle style = wxFLOOD_SURFACE);
8acd14d1
SC
118
119 virtual void DoGradientFillLinear(const wxRect& rect,
120 const wxColour& initialColour,
121 const wxColour& destColour,
122 wxDirection nDirection = wxEAST);
123
124 virtual void DoGradientFillConcentric(const wxRect& rect,
125 const wxColour& initialColour,
126 const wxColour& destColour,
127 const wxPoint& circleCenter);
128
129 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
130
131 virtual void DoDrawPoint(wxCoord x, wxCoord y);
132
133#if wxUSE_SPLINES
b0d7707b 134 virtual void DoDrawSpline(const wxPointList *points);
8acd14d1
SC
135#endif
136
137 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
138
139 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
140 wxCoord x2, wxCoord y2,
141 wxCoord xc, wxCoord yc);
142
143 virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
144 wxCoord width, wxCoord height);
145
146 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
147 double sa, double ea);
148
149 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
150 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
151 wxCoord width, wxCoord height,
152 double radius);
153 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
154
155 virtual void DoCrossHair(wxCoord x, wxCoord y);
156
157 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
158 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
159 bool useMask = false);
160
161 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
162 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
163 double angle);
164
165 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
89efaf2b 166 wxDC *source, wxCoord xsrc, wxCoord ysrc,
03647350 167 wxRasterOperationMode rop = wxCOPY, bool useMask = false,
89efaf2b 168 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
8acd14d1 169
e3b81044
VZ
170 virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
171 wxCoord dstWidth, wxCoord dstHeight,
172 wxDC *source,
173 wxCoord xsrc, wxCoord ysrc,
174 wxCoord srcWidth, wxCoord srcHeight,
89efaf2b 175 wxRasterOperationMode = wxCOPY, bool useMask = false,
e3b81044
VZ
176 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
177
8acd14d1
SC
178 virtual void DoGetSize(int *,int *) const;
179 virtual void DoGetSizeMM(int* width, int* height) const;
180
181 virtual void DoDrawLines(int n, wxPoint points[],
182 wxCoord xoffset, wxCoord yoffset);
183 virtual void DoDrawPolygon(int n, wxPoint points[],
89efaf2b
FM
184 wxCoord xoffset, wxCoord yoffset,
185 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
8acd14d1 186 virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
89efaf2b
FM
187 wxCoord xoffset, wxCoord yoffset,
188 wxPolygonFillMode fillStyle);
8acd14d1 189
fdaad94e 190 virtual void DoSetDeviceClippingRegion(const wxRegion& region);
8acd14d1
SC
191 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
192 wxCoord width, wxCoord height);
193
194 virtual void DoGetTextExtent(const wxString& string,
195 wxCoord *x, wxCoord *y,
196 wxCoord *descent = NULL,
197 wxCoord *externalLeading = NULL,
c94f845b 198 const wxFont *theFont = NULL) const;
8acd14d1
SC
199
200 virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
201
53d4bdbc
VZ
202#ifdef __WXMSW__
203 virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const;
204#endif // __WXMSW__
205
8acd14d1
SC
206protected:
207 // scaling variables
4280b879 208 bool m_logicalFunctionSupported;
8acd14d1 209 double m_mm_to_pix_x, m_mm_to_pix_y;
2b73854d
SC
210 wxGraphicsMatrix m_matrixOriginal;
211 wxGraphicsMatrix m_matrixCurrent;
b687dd2f
PC
212
213 double m_formerScaleX, m_formerScaleY;
8acd14d1
SC
214
215 wxGraphicsContext* m_graphicContext;
03647350 216
888dde65 217 DECLARE_CLASS(wxGCDCImpl)
c0c133e1 218 wxDECLARE_NO_COPY_CLASS(wxGCDCImpl);
8acd14d1
SC
219};
220
512cfcc3 221#endif // wxUSE_GRAPHICS_CONTEXT
8acd14d1 222#endif // _WX_GRAPHICS_DC_H_