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