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