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