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