]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/dcgraph.h
translate "Copy URL" string in the popup menu (feature request 1803958) (should have...
[wxWidgets.git] / include / wx / dcgraph.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/graphdc.h
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
17#include "wx/dc.h"
18#include "wx/geometry.h"
19#include "wx/graphics.h"
20
21class WXDLLIMPEXP_FWD_CORE wxWindowDC;
22
23
24class WXDLLEXPORT wxGCDC: public wxDC
25{
26public:
27 wxGCDC( const wxWindowDC& dc );
28 wxGCDC( const wxMemoryDC& dc );
29 wxGCDC();
30 virtual ~wxGCDC();
31
32 wxGraphicsContext* GetGraphicsContext();
33 void SetGraphicsContext( wxGraphicsContext* ctx );
34
35 DECLARE_DYNAMIC_CLASS(wxGCDC)
36 DECLARE_NO_COPY_CLASS(wxGCDC)
37};
38
39
40class WXDLLEXPORT wxGCDCImpl: public wxDCImpl
41{
42public:
43 wxGCDCImpl( wxDC *owner, const wxWindowDC& dc );
44 wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc );
45 wxGCDCImpl( wxDC *owner );
46
47 virtual ~wxGCDCImpl();
48
49 void Init();
50
51
52 // implement base class pure virtuals
53 // ----------------------------------
54
55 virtual void Clear();
56
57 virtual bool StartDoc( const wxString& message );
58 virtual void EndDoc();
59
60 virtual void StartPage();
61 virtual void EndPage();
62
63 // flushing the content of this dc immediately onto screen
64 virtual void Flush();
65
66 virtual void SetFont(const wxFont& font);
67 virtual void SetPen(const wxPen& pen);
68 virtual void SetBrush(const wxBrush& brush);
69 virtual void SetBackground(const wxBrush& brush);
70 virtual void SetBackgroundMode(int mode);
71 virtual void SetPalette(const wxPalette& palette);
72
73 virtual void DestroyClippingRegion();
74
75 virtual wxCoord GetCharHeight() const;
76 virtual wxCoord GetCharWidth() const;
77
78 virtual bool CanDrawBitmap() const;
79 virtual bool CanGetTextExtent() const;
80 virtual int GetDepth() const;
81 virtual wxSize GetPPI() const;
82
83 virtual void SetMapMode(int mode);
84
85 virtual void SetLogicalFunction(int function);
86
87 virtual void SetTextForeground(const wxColour& colour);
88 virtual void SetTextBackground(const wxColour& colour);
89
90 virtual void ComputeScaleAndOrigin();
91
92 wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; }
93 virtual void SetGraphicsContext( wxGraphicsContext* ctx );
94
95 // the true implementations
96 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
97 int style = wxFLOOD_SURFACE);
98
99 virtual void DoGradientFillLinear(const wxRect& rect,
100 const wxColour& initialColour,
101 const wxColour& destColour,
102 wxDirection nDirection = wxEAST);
103
104 virtual void DoGradientFillConcentric(const wxRect& rect,
105 const wxColour& initialColour,
106 const wxColour& destColour,
107 const wxPoint& circleCenter);
108
109 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
110
111 virtual void DoDrawPoint(wxCoord x, wxCoord y);
112
113#if wxUSE_SPLINES
114 virtual void DoDrawSpline(const wxPointList *points);
115#endif
116
117 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
118
119 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
120 wxCoord x2, wxCoord y2,
121 wxCoord xc, wxCoord yc);
122
123 virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
124 wxCoord width, wxCoord height);
125
126 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
127 double sa, double ea);
128
129 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
130 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
131 wxCoord width, wxCoord height,
132 double radius);
133 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
134
135 virtual void DoCrossHair(wxCoord x, wxCoord y);
136
137 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
138 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
139 bool useMask = false);
140
141 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
142 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
143 double angle);
144
145 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
146 wxDC *source, wxCoord xsrc, wxCoord ysrc,
147 int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
148
149 virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
150 wxCoord dstWidth, wxCoord dstHeight,
151 wxDC *source,
152 wxCoord xsrc, wxCoord ysrc,
153 wxCoord srcWidth, wxCoord srcHeight,
154 int rop = wxCOPY, bool useMask = false,
155 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
156
157 virtual void DoGetSize(int *,int *) const;
158 virtual void DoGetSizeMM(int* width, int* height) const;
159
160 virtual void DoDrawLines(int n, wxPoint points[],
161 wxCoord xoffset, wxCoord yoffset);
162 virtual void DoDrawPolygon(int n, wxPoint points[],
163 wxCoord xoffset, wxCoord yoffset,
164 int fillStyle = wxODDEVEN_RULE);
165 virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
166 wxCoord xoffset, wxCoord yoffset,
167 int fillStyle);
168
169 virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
170 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
171 wxCoord width, wxCoord height);
172
173 virtual void DoGetTextExtent(const wxString& string,
174 wxCoord *x, wxCoord *y,
175 wxCoord *descent = NULL,
176 wxCoord *externalLeading = NULL,
177 const wxFont *theFont = NULL) const;
178
179 virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
180
181protected:
182 // scaling variables
183 bool m_logicalFunctionSupported;
184 double m_mm_to_pix_x, m_mm_to_pix_y;
185 wxGraphicsMatrix m_matrixOriginal;
186 wxGraphicsMatrix m_matrixCurrent;
187
188 double m_formerScaleX, m_formerScaleY;
189
190 wxGraphicsContext* m_graphicContext;
191
192 DECLARE_CLASS(wxGCDCImpl)
193 DECLARE_NO_COPY_CLASS(wxGCDCImpl)
194};
195
196#endif // wxUSE_GRAPHICS_CONTEXT
197#endif // _WX_GRAPHICS_DC_H_