]> git.saurik.com Git - wxWidgets.git/blob - include/wx/stubs/dc.h
some minor changes in wxLogWindow
[wxWidgets.git] / include / wx / stubs / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dc.h
3 // Purpose: wxDC class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DC_H_
13 #define _WX_DC_H_
14
15 #ifdef __GNUG__
16 #pragma interface "dc.h"
17 #endif
18
19 #include "wx/pen.h"
20 #include "wx/brush.h"
21 #include "wx/icon.h"
22 #include "wx/font.h"
23 #include "wx/gdicmn.h"
24
25 class WXDLLEXPORT wxDC: public wxObject
26 {
27 DECLARE_ABSTRACT_CLASS(wxDC)
28 public:
29 wxDC();
30 ~wxDC();
31
32 // Compatibility (obsolete)
33 inline void wxDC::BeginDrawing() {}
34 inline void wxDC::EndDrawing() {}
35
36 virtual void FloodFill(long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE) ;
37 inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
38 {
39 FloodFill(pt.x, pt.y, col, style);
40 }
41
42 virtual bool GetPixel(long x1, long y1, wxColour *col) const ;
43 inline bool GetPixel(const wxPoint& pt, wxColour *col) const
44 {
45 return GetPixel(pt.x, pt.y, col);
46 }
47
48 virtual void DrawLine(long x1, long y1, long x2, long y2);
49 inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
50 {
51 DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
52 }
53
54 virtual void CrossHair(long x, long y) ;
55 virtual void CrossHair(const wxPoint& pt)
56 {
57 CrossHair(pt.x, pt.y);
58 }
59
60 virtual void DrawArc(long x1,long y1,long x2,long y2,double xc, double yc);
61 inline void DrawArc(const wxPoint& pt1, const wxPoint& pt2, double xc, double yc)
62 {
63 DrawArc(pt1.x, pt1.y, pt2.x, pt2.y, xc, yc);
64 }
65
66 virtual void DrawEllipticArc (long x, long y, long w, long h, double sa, double ea);
67 virtual void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea)
68 {
69 DrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea);
70 }
71
72 virtual void DrawPoint(long x, long y);
73 inline void DrawPoint(const wxPoint& pt)
74 {
75 DrawPoint(pt.x, pt.y);
76 }
77
78 virtual void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0);
79
80 virtual void DrawPolygon(int n, wxPoint points[], long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE);
81
82 virtual void DrawRectangle(long x, long y, long width, long height);
83 inline void DrawRectangle(const wxPoint& pt, const wxSize& sz)
84 {
85 DrawRectangle(pt.x, pt.y, sz.x, sz.y);
86 }
87 inline void DrawRectangle(const wxRect& rect)
88 {
89 DrawRectangle(rect.x, rect.y, rect.width, rect.height);
90 }
91
92 virtual void DrawRoundedRectangle(long x, long y, long width, long height, double radius = 20.0);
93 inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0)
94 {
95 DrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius);
96 }
97 inline void DrawRoundedRectangle(const wxRect& rect, double radius = 20.0)
98 {
99 DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, radius);
100 }
101
102 virtual void DrawEllipse(long x, long y, long width, long height);
103 inline void DrawEllipse(const wxPoint& pt, const wxSize& sz)
104 {
105 DrawEllipse(pt.x, pt.y, sz.x, sz.y);
106 }
107 inline void DrawEllipse(const wxRect& rect)
108 {
109 DrawEllipse(rect.x, rect.y, rect.width, rect.height);
110 }
111
112 virtual void DrawIcon(const wxIcon& icon, long x, long y);
113 inline void DrawIcon(const wxIcon& icon, const wxPoint& pt)
114 {
115 DrawIcon(icon, pt.x, pt.y);
116 }
117
118 inline void DrawPoint(wxPoint& point) { DrawPoint(point.x, point.y); }
119 virtual void DrawLines(wxList *list, long xoffset = 0, long yoffset = 0);
120 virtual void DrawPolygon(wxList *list, long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE);
121
122 virtual void DrawText(const wxString& text, long x, long y, bool use16bit = FALSE);
123 inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE)
124 {
125 DrawText(text, pt.x, pt.y, use16bit);
126 }
127
128 virtual bool Blit(long xdest, long ydest, long width, long height,
129 wxDC *source, long xsrc, long ysrc, int rop = wxCOPY, bool useMask = FALSE);
130 inline bool Blit(const wxPoint& destPt, const wxSize& sz,
131 wxDC *source, const wxPoint& srcPt, int rop = wxCOPY, bool useMask = FALSE)
132 {
133 return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask);
134 }
135
136 #if USE_SPLINES
137 // Splines
138 // 3-point spline
139 virtual void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3);
140 // Any number of control points - a list of pointers to wxPoints
141 virtual void DrawSpline(wxList *points);
142 virtual void DrawSpline(int n, wxPoint points[]);
143 #endif
144 virtual void Clear();
145 virtual void SetFont(const wxFont& font);
146 virtual void SetPen(const wxPen& pen);
147 virtual void SetBrush(const wxBrush& brush);
148 virtual void SetLogicalFunction(int function);
149 virtual void SetBackground(const wxBrush& brush);
150 virtual void SetBackgroundMode(int mode);
151
152 virtual void SetClippingRegion(long x, long y, long width, long height);
153 inline void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
154 {
155 SetClippingRegion(pt.x, pt.y, sz.x, sz.y);
156 }
157 inline void SetClippingRegion(const wxRect& rect)
158 {
159 SetClippingRegion(rect.x, rect.y, rect.width, rect.height);
160 }
161
162 virtual void SetPalette(const wxPalette& palette);
163 virtual void DestroyClippingRegion();
164 virtual long GetCharHeight() const;
165 virtual long GetCharWidth() const;
166 virtual void GetTextExtent(const wxString& string, long *x, long *y,
167 long *descent = NULL, long *externalLeading = NULL,
168 wxFont *theFont = NULL, bool use16bit = FALSE) const;
169
170 // Size in device units
171 virtual void GetSize(int* width, int* height) const;
172 inline wxSize GetSize() const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
173
174 // Size in mm
175 virtual void GetSizeMM(long* width, long* height) const ;
176
177 virtual bool StartDoc(const wxString& message);
178 virtual void EndDoc();
179 virtual void StartPage();
180 virtual void EndPage();
181 virtual void SetMapMode(int mode);
182 virtual void SetUserScale(double x, double y);
183 virtual void SetSystemScale(double x, double y);
184 virtual void SetLogicalOrigin(long x, long y);
185 virtual void SetDeviceOrigin(long x, long y);
186 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
187
188 // This group of functions does actual conversion
189 // of the input, as you'd expect.
190
191 long DeviceToLogicalX(long x) const;
192 long DeviceToLogicalY(long y) const;
193 long DeviceToLogicalXRel(long x) const;
194 long DeviceToLogicalYRel(long y) const;
195 long LogicalToDeviceX(long x) const;
196 long LogicalToDeviceY(long y) const;
197 long LogicalToDeviceXRel(long x) const;
198 long LogicalToDeviceYRel(long y) const;
199
200 virtual bool CanDrawBitmap() const;
201 virtual bool CanGetTextExtent() const;
202
203 virtual void SetTextForeground(const wxColour& colour);
204 virtual void SetTextBackground(const wxColour& colour);
205 inline virtual bool Ok() const {return m_ok;};
206 inline virtual int GetMapMode() const {return m_mappingMode;};
207
208 inline virtual wxBrush *GetBackground() const { return (wxBrush*) &m_backgroundBrush ;}
209 inline virtual wxBrush *GetBrush() const { return (wxBrush*) &m_brush ;}
210 inline virtual wxFont *GetFont() const { return (wxFont*) &m_font ;}
211 inline virtual int GetLogicalFunction() const { return m_logicalFunction ;}
212 inline virtual wxPen *GetPen() const { return (wxPen*) &m_pen ;}
213 inline virtual wxColour&GetTextBackground() const { return (wxColour&) m_textBackgroundColour ;}
214 inline virtual wxColour&GetTextForeground() const { return (wxColour&) m_textForegroundColour ;}
215
216 virtual void SetLogicalScale(double x, double y);
217 virtual inline void GetUserScale(double* x, double *y) const { *x = m_userScaleX; *y = m_userScaleY; }
218 virtual void CalcBoundingBox(long x, long y);
219 // Get the final bounding box of the PostScript or Metafile picture.
220 virtual inline long MinX() const { return m_minX; }
221 virtual inline long MaxX() const { return m_maxX; }
222 virtual inline long MinY() const { return m_minY; }
223 virtual inline long MaxY() const { return m_maxY; }
224
225 // Sometimes we need to override optimization, e.g.
226 // if other software is drawing onto our surface and we
227 // can't be sure of who's done what.
228 virtual inline void SetOptimization(bool WXUNUSED(opt)) { }
229 virtual inline bool GetOptimization() { return FALSE; }
230
231 virtual void GetClippingBox(long *x,long *y,long *w,long *h) const ;
232 inline void GetClippingBox(wxRect& rect) const
233 {
234 long x, y, w, h;
235 GetClippingBox(&x, &y, &w, &h); rect.x = x; rect.y = y; rect.width = w; rect.height = h;
236 }
237
238 inline wxWindow *GetWindow() const { return m_canvas; }
239 inline void SetWindow(wxWindow *win) { m_canvas = win; }
240
241 protected:
242 bool m_colour;
243 bool m_ok;
244 bool m_clipping;
245 bool m_isInteractive;
246
247 // Coordinate system variables
248 long m_logicalOriginX;
249 long m_logicalOriginY;
250
251 long m_deviceOriginX;
252 long m_deviceOriginY;
253
254 double m_logicalScaleX;
255 double m_logicalScaleY;
256
257 double m_userScaleX;
258 double m_userScaleY;
259
260 int m_signX; // Used by SetAxisOrientation() to
261 int m_signY; // invert the axes
262
263 int m_mappingMode;
264
265 long m_minX; // bounding box
266 long m_minY;
267 long m_maxX;
268 long m_maxY;
269
270 int m_logicalFunction;
271 int m_backgroundMode;
272
273 wxPen m_pen;
274 wxBrush m_brush;
275 wxBrush m_backgroundBrush;
276 wxColour m_textForegroundColour;
277 wxColour m_textBackgroundColour;
278 wxFont m_font;
279 wxPalette m_palette;
280 int m_clipX1;
281 int m_clipY1;
282 int m_clipX2;
283 int m_clipY2;
284 double m_systemScaleX;
285 double m_systemScaleY;
286
287 wxWindow * m_canvas;
288 wxBitmap m_selectedBitmap;
289 wxString m_filename;
290
291 };
292
293 #endif
294 // _WX_DC_H_