1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
15 //-----------------------------------------------------------------------------
17 //-----------------------------------------------------------------------------
19 class WXDLLIMPEXP_CORE wxImplDC
: public wxObject
22 wxImplDC( wxDC
*owner
);
25 wxDC
*GetOwner() { return m_owner
; }
27 virtual bool IsOk() const { return m_ok
; }
31 virtual bool CanDrawBitmap() const = 0;
32 virtual bool CanGetTextExtent() const = 0;
34 // query dimension, colour deps, resolution
36 virtual void DoGetSize(int *width
, int *height
) const = 0;
37 virtual void DoGetSizeMM(int* width
, int* height
) const = 0;
39 virtual int GetDepth() const = 0;
40 virtual wxSize
GetPPI() const = 0;
42 // Right-To-Left (RTL) modes
44 virtual void SetLayoutDirection(wxLayoutDirection
WXUNUSED(dir
)) { }
45 virtual wxLayoutDirection
GetLayoutDirection() const { return wxLayout_Default
; }
49 virtual bool StartDoc(const wxString
& WXUNUSED(message
)) { return true; }
50 virtual void EndDoc() { }
52 virtual void StartPage() { }
53 virtual void EndPage() { }
57 virtual void CalcBoundingBox(wxCoord x
, wxCoord y
);
61 if ( x
< m_minX
) m_minX
= x
;
62 if ( y
< m_minY
) m_minY
= y
;
63 if ( x
> m_maxX
) m_maxX
= x
;
64 if ( y
> m_maxY
) m_maxY
= y
;
76 void ResetBoundingBox();
78 m_isBBoxValid
= false;
80 m_minX
= m_maxX
= m_minY
= m_maxY
= 0;
83 wxCoord
MinX() const { return m_minX
; }
84 wxCoord
MaxX() const { return m_maxX
; }
85 wxCoord
MinY() const { return m_minY
; }
86 wxCoord
MaxY() const { return m_maxY
; }
88 // setters and getters
90 virtual void SetFont(const wxFont
& font
) = 0;
91 virtual const wxFont
& GetFont() const { return m_font
; }
93 virtual void SetPen(const wxPen
& pen
) = 0;
94 virtual const wxPen
& GetPen() const { return m_pen
; }
96 virtual void SetBrush(const wxBrush
& brush
) = 0;
97 virtual const wxBrush
& GetBrush() const { return m_brush
; }
99 virtual void SetBackground(const wxBrush
& brush
) = 0;
100 virtual const wxBrush
& GetBackground() const { return m_backgroundBrush
; }
102 virtual void SetBackgroundMode(int mode
) = 0;
103 virtual int GetBackgroundMode() const { return m_backgroundMode
; }
105 virtual void SetTextForeground(const wxColour
& colour
)
106 { m_textForegroundColour
= colour
; }
107 virtual const wxColour
& GetTextForeground() const { return m_textForegroundColour
; }
109 virtual void SetTextBackground(const wxColour
& colour
)
110 { m_textBackgroundColour
= colour
; }
111 virtual const wxColour
& GetTextBackground() const { return m_textBackgroundColour
; }
114 virtual void SetPalette(const wxPalette
& palette
) = 0;
115 #endif // wxUSE_PALETTE
119 virtual void SetLogicalFunction(int function
) = 0;
120 virtual int GetLogicalFunction() const { return m_logicalFunction
; }
124 virtual wxCoord
GetCharHeight() const = 0;
125 virtual wxCoord
GetCharWidth() const = 0;
126 virtual void DoGetTextExtent(const wxString
& string
,
127 wxCoord
*x
, wxCoord
*y
,
128 wxCoord
*descent
= NULL
,
129 wxCoord
*externalLeading
= NULL
,
130 const wxFont
*theFont
= NULL
) const = 0;
131 virtual void GetMultiLineTextExtent(const wxString
& string
,
134 wxCoord
*heightLine
= NULL
,
135 const wxFont
*font
= NULL
) const;
136 virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const;
140 virtual void Clear() = 0;
144 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
145 wxCoord width
, wxCoord height
) = 0;
146 virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
) = 0;
148 virtual void DoGetClippingBox(wxCoord
*x
, wxCoord
*y
,
149 wxCoord
*w
, wxCoord
*h
) const
156 *w
= m_clipX2
- m_clipX1
;
158 *h
= m_clipY2
- m_clipY1
;
161 virtual void DestroyClippingRegion() { ResetClipping(); }
164 // coordinates conversions and transforms
166 virtual wxCoord
DeviceToLogicalX(wxCoord x
) const;
167 virtual wxCoord
DeviceToLogicalY(wxCoord y
) const;
168 virtual wxCoord
DeviceToLogicalXRel(wxCoord x
) const;
169 virtual wxCoord
DeviceToLogicalYRel(wxCoord y
) const;
170 virtual wxCoord
LogicalToDeviceX(wxCoord x
) const;
171 virtual wxCoord
LogicalToDeviceY(wxCoord y
) const;
172 virtual wxCoord
LogicalToDeviceXRel(wxCoord x
) const;
173 virtual wxCoord
LogicalToDeviceYRel(wxCoord y
) const;
175 virtual void SetMapMode(int mode
);
176 virtual int GetMapMode() const { return m_mappingMode
; }
178 virtual void SetUserScale(double x
, double y
);
179 virtual void GetUserScale(double *x
, double *y
) const
181 if ( x
) *x
= m_userScaleX
;
182 if ( y
) *y
= m_userScaleY
;
185 virtual void SetLogicalScale(double x
, double y
);
186 virtual void GetLogicalScale(double *x
, double *y
)
188 if ( x
) *x
= m_logicalScaleX
;
189 if ( y
) *y
= m_logicalScaleY
;
192 virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
);
193 virtual void DoGetLogicalOrigin(wxCoord
*x
, wxCoord
*y
) const
195 if ( x
) *x
= m_logicalOriginX
;
196 if ( y
) *y
= m_logicalOriginY
;
199 virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
);
200 virtual void DoGetDeviceOrigin(wxCoord
*x
, wxCoord
*y
) const
202 if ( x
) *x
= m_deviceOriginX
;
203 if ( y
) *y
= m_deviceOriginY
;
206 virtual void SetDeviceLocalOrigin( wxCoord x
, wxCoord y
);
208 virtual void ComputeScaleAndOrigin();
210 // this needs to overidden if the axis is inverted
211 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
213 // ---------------------------------------------------------
214 // the actual drawing API
216 virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
217 int style
= wxFLOOD_SURFACE
) = 0;
219 virtual void DoGradientFillLinear(const wxRect
& rect
,
220 const wxColour
& initialColour
,
221 const wxColour
& destColour
,
222 wxDirection nDirection
= wxEAST
);
224 virtual void DoGradientFillConcentric(const wxRect
& rect
,
225 const wxColour
& initialColour
,
226 const wxColour
& destColour
,
227 const wxPoint
& circleCenter
);
229 virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const = 0;
231 virtual void DoDrawPoint(wxCoord x
, wxCoord y
) = 0;
232 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
) = 0;
234 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
235 wxCoord x2
, wxCoord y2
,
236 wxCoord xc
, wxCoord yc
) = 0;
237 virtual void DoDrawCheckMark(wxCoord x
, wxCoord y
,
238 wxCoord width
, wxCoord height
);
239 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
240 double sa
, double ea
) = 0;
242 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) = 0;
243 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
244 wxCoord width
, wxCoord height
,
246 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
,
247 wxCoord width
, wxCoord height
) = 0;
249 virtual void DoCrossHair(wxCoord x
, wxCoord y
) = 0;
251 virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
) = 0;
252 virtual void DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
253 bool useMask
= false) = 0;
255 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
) = 0;
256 virtual void DoDrawRotatedText(const wxString
& text
,
257 wxCoord x
, wxCoord y
, double angle
) = 0;
259 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
,
260 wxCoord width
, wxCoord height
,
262 wxCoord xsrc
, wxCoord ysrc
,
264 bool useMask
= false,
265 wxCoord xsrcMask
= wxDefaultCoord
,
266 wxCoord ysrcMask
= wxDefaultCoord
) = 0;
268 virtual bool DoStretchBlit(wxCoord xdest
, wxCoord ydest
,
269 wxCoord dstWidth
, wxCoord dstHeight
,
271 wxCoord xsrc
, wxCoord ysrc
,
272 wxCoord srcWidth
, wxCoord srcHeight
,
274 bool useMask
= false,
275 wxCoord xsrcMask
= wxDefaultCoord
,
276 wxCoord ysrcMask
= wxDefaultCoord
);
278 virtual wxBitmap
DoGetAsBitmap(const wxRect
*WXUNUSED(subrect
)) const
279 { return wxNullBitmap
; }
282 virtual void DoDrawLines(int n
, wxPoint points
[],
283 wxCoord xoffset
, wxCoord yoffset
) = 0;
284 virtual void DoDrawPolygon(int n
, wxPoint points
[],
285 wxCoord xoffset
, wxCoord yoffset
,
286 int fillStyle
= wxODDEVEN_RULE
) = 0;
287 virtual void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[],
288 wxCoord xoffset
, wxCoord yoffset
,
294 virtual void DoDrawSpline(wxList
*points
);
301 // unset clipping variables (after clipping region was destroyed)
306 m_clipX1
= m_clipX2
= m_clipY1
= m_clipY2
= 0;
313 bool m_isInteractive
:1;
314 bool m_isBBoxValid
:1;
316 // coordinate system variables
318 wxCoord m_logicalOriginX
, m_logicalOriginY
;
319 wxCoord m_deviceOriginX
, m_deviceOriginY
; // Usually 0,0, can be change by user
321 wxCoord m_deviceLocalOriginX
, m_deviceLocalOriginY
; // non-zero if native top-left corner
322 // is not at 0,0. This was the case under
323 // Mac's GrafPorts (coordinate system
324 // used toplevel window's origin) and
325 // e.g. for Postscript, where the native
326 // origin in the bottom left corner.
327 double m_logicalScaleX
, m_logicalScaleY
;
328 double m_userScaleX
, m_userScaleY
;
329 double m_scaleX
, m_scaleY
; // calculated from logical scale and user scale
331 int m_signX
, m_signY
; // Used by SetAxisOrientation() to invert the axes
333 // what is a mm on a screen you don't know the size of?
334 double m_mm_to_pix_x
,
337 // bounding and clipping boxes
338 wxCoord m_minX
, m_minY
, m_maxX
, m_maxY
;
339 wxCoord m_clipX1
, m_clipY1
, m_clipX2
, m_clipY2
;
341 int m_logicalFunction
;
342 int m_backgroundMode
;
347 wxBrush m_backgroundBrush
;
348 wxColour m_textForegroundColour
;
349 wxColour m_textBackgroundColour
;
354 bool m_hasCustomPalette
;
355 #endif // wxUSE_PALETTE
358 DECLARE_ABSTRACT_CLASS(wxImplDC
)
362 class wxDC
: public wxObject
365 wxDC() { m_pimpl
= NULL
; }
368 { return m_pimpl
&& m_pimpl
->IsOk(); }
370 // query capabilities
372 bool CanDrawBitmap() const
373 { return m_pimpl
->CanDrawBitmap(); }
374 bool CanGetTextExtent() const
375 { return m_pimpl
->CanGetTextExtent(); }
377 // query dimension, colour deps, resolution
379 void GetSize(int *width
, int *height
) const
380 { m_pimpl
->DoGetSize(width
, height
); }
382 wxSize
GetSize() const
385 m_pimpl
->DoGetSize(&w
, &h
);
389 void GetSizeMM(int* width
, int* height
) const
390 { m_pimpl
->DoGetSizeMM(width
, height
); }
391 wxSize
GetSizeMM() const
394 m_pimpl
->DoGetSizeMM(&w
, &h
);
399 { return m_pimpl
->GetDepth(); }
400 wxSize
GetPPI() const
401 { return m_pimpl
->GetPPI(); }
403 // Right-To-Left (RTL) modes
405 void SetLayoutDirection(wxLayoutDirection dir
)
406 { m_pimpl
->SetLayoutDirection( dir
); }
407 wxLayoutDirection
GetLayoutDirection() const
408 { return m_pimpl
->GetLayoutDirection(); }
412 bool StartDoc(const wxString
& message
)
413 { return m_pimpl
->StartDoc(message
); }
415 { m_pimpl
->EndDoc(); }
418 { m_pimpl
->StartPage(); }
420 { m_pimpl
->EndPage(); }
424 void CalcBoundingBox(wxCoord x
, wxCoord y
)
425 { m_pimpl
->CalcBoundingBox(x
,y
); }
426 void ResetBoundingBox()
427 { m_pimpl
->ResetBoundingBox(); }
430 { return m_pimpl
->MinX(); }
432 { return m_pimpl
->MaxX(); }
434 { return m_pimpl
->MinY(); }
436 { return m_pimpl
->MaxY(); }
438 // setters and getters
440 void SetFont(const wxFont
& font
)
441 { m_pimpl
->SetFont( font
); }
442 const wxFont
& GetFont() const
443 { return m_pimpl
->GetFont(); }
445 void SetPen(const wxPen
& pen
)
446 { m_pimpl
->SetPen( pen
); }
447 const wxPen
& GetPen() const
448 { return m_pimpl
->GetPen(); }
450 void SetBrush(const wxBrush
& brush
)
451 { m_pimpl
->SetBrush( brush
); }
452 const wxBrush
& GetBrush() const
453 { return m_pimpl
->GetBrush(); }
455 void SetBackground(const wxBrush
& brush
)
456 { m_pimpl
->SetBackground( brush
); }
457 const wxBrush
& GetBackground() const
458 { return m_pimpl
->GetBackground(); }
460 void SetBackgroundMode(int mode
)
461 { m_pimpl
->SetBackground( mode
); }
462 int GetBackgroundMode() const
463 { return m_pimpl
->GetBackground(); }
465 void SetTextForeground(const wxColour
& colour
)
466 { m_pimpl
->SetTextForeground(colour
); }
467 const wxColour
& GetTextForeground() const
468 { return m_pimpl
->GetTextForeground(); }
470 void SetTextBackground(const wxColour
& colour
)
471 { m_pimpl
->SetTextBackground(colour
); }
472 const wxColour
& GetTextBackground() const
473 { return m_pimpl
->GetTextBackground(); }
476 void SetPalette(const wxPalette
& palette
)
477 { m_pimpl
->SetPalette(palette
); }
478 #endif // wxUSE_PALETTE
482 void SetLogicalFunction(int function
)
483 { m_pimpl
->SetLogicalFunction(function
); }
484 int GetLogicalFunction() const
485 { return m_pimpl
->GetLogicalFunction(); }
489 wxCoord
GetCharHeight() const
490 { return m_pimpl
->GetCharHeight(); }
491 wxCoord
GetCharWidth() const
492 { return m_pimpl
->GetCharWidth(); }
494 void GetTextExtent(const wxString
& string
,
495 wxCoord
*x
, wxCoord
*y
,
496 wxCoord
*descent
= NULL
,
497 wxCoord
*externalLeading
= NULL
,
498 const wxFont
*theFont
= NULL
) const
499 { m_pimpl
->DoGetTextExtent(string
, x
, y
, descent
, externalLeading
, theFont
); }
501 wxSize
GetTextExtent(const wxString
& string
) const
504 m_pimpl
->DoGetTextExtent(string
, &w
, &h
);
508 void GetMultiLineTextExtent(const wxString
& string
,
511 wxCoord
*heightLine
= NULL
,
512 const wxFont
*font
= NULL
) const
513 { m_pimpl
->GetMultiLineTextExtent( string
, width
, height
, heightLine
, font
); }
515 wxSize
GetMultiLineTextExtent(const wxString
& string
) const
518 m_pimpl
->GetMultiLineTextExtent(string
, &w
, &h
);
522 bool GetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const
523 { return m_pimpl
->DoGetPartialTextExtents(text
, widths
); }
528 { m_pimpl
->Clear(); }
532 void SetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
533 { m_pimpl
->DoSetClippingRegion(x
, y
, width
, height
); }
534 void SetClippingRegion(const wxPoint
& pt
, const wxSize
& sz
)
535 { m_pimpl
->DoSetClippingRegion(pt
.x
, pt
.y
, sz
.x
, sz
.y
); }
536 void SetClippingRegion(const wxRect
& rect
)
537 { m_pimpl
->DoSetClippingRegion(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
538 void SetClippingRegion(const wxRegion
& region
)
539 { m_pimpl
->DoSetClippingRegionAsRegion(region
); }
541 void DestroyClippingRegion()
542 { m_pimpl
->DestroyClippingRegion(); }
544 void GetClippingBox(wxCoord
*x
, wxCoord
*y
, wxCoord
*w
, wxCoord
*h
) const
545 { m_pimpl
->DoGetClippingBox(x
, y
, w
, h
); }
546 void GetClippingBox(wxRect
& rect
) const
547 { m_pimpl
->DoGetClippingBox(&rect
.x
, &rect
.y
, &rect
.width
, &rect
.height
); }
549 // coordinates conversions and transforms
551 wxCoord
DeviceToLogicalX(wxCoord x
) const
552 { return m_pimpl
->DeviceToLogicalX(x
); }
553 wxCoord
DeviceToLogicalY(wxCoord y
) const;
554 { return m_pimpl
->DeviceToLogicalY(y
); }
555 wxCoord
DeviceToLogicalXRel(wxCoord x
) const;
556 { return m_pimpl
->DeviceToLogicalXRel(x
); }
557 wxCoord
DeviceToLogicalYRel(wxCoord y
) const;
558 { return m_pimpl
->DeviceToLogicalYRel(y
); }
559 wxCoord
LogicalToDeviceX(wxCoord x
) const;
560 { return m_pimpl
->LogicalToDeviceX(x
); }
561 wxCoord
LogicalToDeviceY(wxCoord y
) const;
562 { return m_pimpl
->LogicalToDeviceY(y
); }
563 wxCoord
LogicalToDeviceXRel(wxCoord x
) const;
564 { return m_pimpl
->LogicalToDeviceXRel(x
); }
565 wxCoord
LogicalToDeviceYRel(wxCoord y
) const;
566 { return m_pimpl
->LogicalToDeviceYRel(y
); }
568 void SetMapMode(int mode
)
569 { m_pimpl
->SetMapMode(mode
); }
570 int GetMapMode() const
571 { return m_pimpl
->GetMapMode(); }
573 void SetUserScale(double x
, double y
)
574 { m_pimpl
->SetUserScale(x
,y
); }
575 void GetUserScale(double *x
, double *y
) const
576 { m_pimpl
->GetUserScale( x
, y
); }
578 void SetLogicalScale(double x
, double y
)
579 { m_pimpl
->SetLogicalScale( x
, y
); }
580 void GetLogicalScale(double *x
, double *y
)
581 { m_pimpl
->GetLogicalScale( x
, y
); }
583 void SetLogicalOrigin(wxCoord x
, wxCoord y
)
584 { m_pimpl
->SetLogicalOrigin(x
,y
); }
585 void GetLogicalOrigin(wxCoord
*x
, wxCoord
*y
) const
586 { m_pimpl
->DoGetLogicalOrigin(x
, y
); }
587 wxPoint
GetLogicalOrigin() const
588 { wxCoord x
, y
; m_pimpl
->DoGetLogicalOrigin(&x
, &y
); return wxPoint(x
, y
); }
590 void SetDeviceOrigin(wxCoord x
, wxCoord y
)
591 { m_pimpl
->SetDeviceOrigin( x
, y
); }
592 void GetDeviceOrigin(wxCoord
*x
, wxCoord
*y
) const
593 { DoGetDeviceOrigin(x
, y
); }
594 wxPoint
GetDeviceOrigin() const
595 { wxCoord x
, y
; DoGetDeviceOrigin(&x
, &y
); return wxPoint(x
, y
); }
597 void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
)
598 { m_pimpl
->SetAxisOrientation(xLeftRight
, yBottomUp
); }
601 void SetDeviceLocalOrigin( wxCoord x
, wxCoord y
)
602 { m_pimpl
->SetDeviceLocalOrigin( x
, y
); }
605 // draw generic object
607 void DrawObject(wxDrawObject
* drawobject
)
609 drawobject
->Draw(*this);
610 CalcBoundingBox(drawobject
->MinX(),drawobject
->MinY());
611 CalcBoundingBox(drawobject
->MaxX(),drawobject
->MaxY());
614 // -----------------------------------------------
615 // the actual drawing API
617 bool FloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
618 int style
= wxFLOOD_SURFACE
)
619 { return m_pimpl
->DoFloodFill(x
, y
, col
, style
); }
620 bool FloodFill(const wxPoint
& pt
, const wxColour
& col
,
621 int style
= wxFLOOD_SURFACE
)
622 { return m_pimpl
->DoFloodFill(pt
.x
, pt
.y
, col
, style
); }
624 // fill the area specified by rect with a radial gradient, starting from
625 // initialColour in the centre of the cercle and fading to destColour.
626 void GradientFillConcentric(const wxRect
& rect
,
627 const wxColour
& initialColour
,
628 const wxColour
& destColour
)
629 { m_pimpl
->GradientFillConcentric(rect
, initialColour
, destColour
,
630 wxPoint(rect
.GetWidth() / 2,
631 rect
.GetHeight() / 2)); }
633 void GradientFillConcentric(const wxRect
& rect
,
634 const wxColour
& initialColour
,
635 const wxColour
& destColour
,
636 const wxPoint
& circleCenter
)
637 { m_pimpl
->DoGradientFillConcentric(rect
, initialColour
, destColour
, circleCenter
); }
639 // fill the area specified by rect with a linear gradient
640 void GradientFillLinear(const wxRect
& rect
,
641 const wxColour
& initialColour
,
642 const wxColour
& destColour
,
643 wxDirection nDirection
= wxEAST
)
644 { m_pimpl
->DoGradientFillLinear(rect
, initialColour
, destColour
, nDirection
); }
646 bool GetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const
647 { return m_pimpl
->DoGetPixel(x
, y
, col
); }
648 bool GetPixel(const wxPoint
& pt
, wxColour
*col
) const
649 { return m_pimpl
->DoGetPixel(pt
.x
, pt
.y
, col
); }
651 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
652 { m_pimpl
->DoDrawLine(x1
, y1
, x2
, y2
); }
653 void DrawLine(const wxPoint
& pt1
, const wxPoint
& pt2
)
654 { m_pimpl
->DoDrawLine(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
); }
656 void CrossHair(wxCoord x
, wxCoord y
)
657 { m_pimpl
->DoCrossHair(x
, y
); }
658 void CrossHair(const wxPoint
& pt
)
659 { m_pimpl
->DoCrossHair(pt
.x
, pt
.y
); }
661 void DrawArc(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
,
662 wxCoord xc
, wxCoord yc
)
663 { m_pimpl
->DoDrawArc(x1
, y1
, x2
, y2
, xc
, yc
); }
664 void DrawArc(const wxPoint
& pt1
, const wxPoint
& pt2
, const wxPoint
& centre
)
665 { m_pimpl
->DoDrawArc(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
, centre
.x
, centre
.y
); }
667 void DrawCheckMark(wxCoord x
, wxCoord y
,
668 wxCoord width
, wxCoord height
)
669 { m_pimpl
->DoDrawCheckMark(x
, y
, width
, height
); }
670 void DrawCheckMark(const wxRect
& rect
)
671 { m_pimpl
->DoDrawCheckMark(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
673 void DrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
674 double sa
, double ea
)
675 { m_pimpl
->DoDrawEllipticArc(x
, y
, w
, h
, sa
, ea
); }
676 void DrawEllipticArc(const wxPoint
& pt
, const wxSize
& sz
,
677 double sa
, double ea
)
678 { m_pimpl
->DoDrawEllipticArc(pt
.x
, pt
.y
, sz
.x
, sz
.y
, sa
, ea
); }
680 void DrawPoint(wxCoord x
, wxCoord y
)
681 { m_pimpl
->DoDrawPoint(x
, y
); }
682 void DrawPoint(const wxPoint
& pt
)
683 { m_pimpl
->DoDrawPoint(pt
.x
, pt
.y
); }
685 void DrawLines(int n
, wxPoint points
[],
686 wxCoord xoffset
= 0, wxCoord yoffset
= 0)
687 { m_pimpl
->DoDrawLines(n
, points
, xoffset
, yoffset
); }
688 void DrawLines(const wxList
*list
,
689 wxCoord xoffset
= 0, wxCoord yoffset
= 0)
690 { m_pimpl
->DrawLines( list
, xoffset
, yoffset
); }
692 void DrawPolygon(int n
, wxPoint points
[],
693 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
694 int fillStyle
= wxODDEVEN_RULE
)
695 { m_pimpl
->DoDrawPolygon(n
, points
, xoffset
, yoffset
, fillStyle
); }
697 void DrawPolygon(const wxList
*list
,
698 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
699 int fillStyle
= wxODDEVEN_RULE
)
700 { m_pimpl
->DrawPolygon( list
, xoffset
, yoffset
, fillStyle
); }
702 void DrawPolyPolygon(int n
, int count
[], wxPoint points
[],
703 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
704 int fillStyle
= wxODDEVEN_RULE
)
705 { m_pimpl
->DoDrawPolyPolygon(n
, count
, points
, xoffset
, yoffset
, fillStyle
); }
707 void DrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
708 { m_pimpl
->DoDrawRectangle(x
, y
, width
, height
); }
709 void DrawRectangle(const wxPoint
& pt
, const wxSize
& sz
)
710 { m_pimpl
->DoDrawRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
); }
711 void DrawRectangle(const wxRect
& rect
)
712 { m_pimpl
->DoDrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
714 void DrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
,
716 { m_pimpl
->DoDrawRoundedRectangle(x
, y
, width
, height
, radius
); }
717 void DrawRoundedRectangle(const wxPoint
& pt
, const wxSize
& sz
,
719 { m_pimpl
->DoDrawRoundedRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
, radius
); }
720 void DrawRoundedRectangle(const wxRect
& r
, double radius
)
721 { m_pimpl
->DoDrawRoundedRectangle(r
.x
, r
.y
, r
.width
, r
.height
, radius
); }
723 void DrawCircle(wxCoord x
, wxCoord y
, wxCoord radius
)
724 { m_pimpl
->DoDrawEllipse(x
- radius
, y
- radius
, 2*radius
, 2*radius
); }
725 void DrawCircle(const wxPoint
& pt
, wxCoord radius
)
726 { m_pimpl
->DrawCircle(pt
.x
, pt
.y
, radius
); }
728 void DrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
729 { m_pimpl
->DoDrawEllipse(x
, y
, width
, height
); }
730 void DrawEllipse(const wxPoint
& pt
, const wxSize
& sz
)
731 { m_pimpl
->DoDrawEllipse(pt
.x
, pt
.y
, sz
.x
, sz
.y
); }
732 void DrawEllipse(const wxRect
& rect
)
733 { m_pimpl
->DoDrawEllipse(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
735 void DrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
736 { m_pimpl
->DoDrawIcon(icon
, x
, y
); }
737 void DrawIcon(const wxIcon
& icon
, const wxPoint
& pt
)
738 { m_pimpl
->DoDrawIcon(icon
, pt
.x
, pt
.y
); }
740 void DrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
741 bool useMask
= false)
742 { m_pimpl
->DoDrawBitmap(bmp
, x
, y
, useMask
); }
743 void DrawBitmap(const wxBitmap
&bmp
, const wxPoint
& pt
,
744 bool useMask
= false)
745 { m_pimpl
->DoDrawBitmap(bmp
, pt
.x
, pt
.y
, useMask
); }
747 void DrawText(const wxString
& text
, wxCoord x
, wxCoord y
)
748 { m_pimpl
->DoDrawText(text
, x
, y
); }
749 void DrawText(const wxString
& text
, const wxPoint
& pt
)
750 { m_pimpl
->DoDrawText(text
, pt
.x
, pt
.y
); }
752 void DrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
)
753 { m_pimpl
->DoDrawRotatedText(text
, x
, y
, angle
); }
754 void DrawRotatedText(const wxString
& text
, const wxPoint
& pt
, double angle
)
755 { m_pimpl
->DoDrawRotatedText(text
, pt
.x
, pt
.y
, angle
); }
757 // this version puts both optional bitmap and the text into the given
758 // rectangle and aligns is as specified by alignment parameter; it also
759 // will emphasize the character with the given index if it is != -1 and
760 // return the bounding rectangle if required
761 void DrawLabel(const wxString
& text
,
762 const wxBitmap
& image
,
764 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
766 wxRect
*rectBounding
= NULL
)
767 { m_pimpl
->DrawLabel( text
, image
, rect
, alignment
, indexAccel
, rectBounding
); }
769 void DrawLabel(const wxString
& text
, const wxRect
& rect
,
770 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
772 { m_pimpl
->DrawLabel(text
, wxNullBitmap
, rect
, alignment
, indexAccel
); }
774 bool Blit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
775 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
776 int rop
= wxCOPY
, bool useMask
= false, wxCoord xsrcMask
= wxDefaultCoord
, wxCoord ysrcMask
= wxDefaultCoord
)
778 return m_pimpl
->DoBlit(xdest
, ydest
, width
, height
,
779 source
, xsrc
, ysrc
, rop
, useMask
, xsrcMask
, ysrcMask
);
781 bool Blit(const wxPoint
& destPt
, const wxSize
& sz
,
782 wxDC
*source
, const wxPoint
& srcPt
,
783 int rop
= wxCOPY
, bool useMask
= false, const wxPoint
& srcPtMask
= wxDefaultPosition
)
785 return m_pimpl
->DoBlit(destPt
.x
, destPt
.y
, sz
.x
, sz
.y
,
786 source
, srcPt
.x
, srcPt
.y
, rop
, useMask
, srcPtMask
.x
, srcPtMask
.y
);
789 bool StretchBlit(wxCoord dstX
, wxCoord dstY
,
790 wxCoord dstWidth
, wxCoord dstHeight
,
792 wxCoord srcX
, wxCoord srcY
,
793 wxCoord srcWidth
, wxCoord srcHeight
,
794 int rop
= wxCOPY
, bool useMask
= false,
795 wxCoord srcMaskX
= wxDefaultCoord
, wxCoord srcMaskY
= wxDefaultCoord
)
797 return m_pimpl
->DoStretchBlit(dstX
, dstY
, dstWidth
, dstHeight
,
798 source
, srcX
, srcY
, srcWidth
, srcHeight
, rop
, useMask
, srcMaskX
, srcMaskY
);
800 bool StretchBlit(const wxPoint
& dstPt
, const wxSize
& dstSize
,
801 wxDC
*source
, const wxPoint
& srcPt
, const wxSize
& srcSize
,
802 int rop
= wxCOPY
, bool useMask
= false, const wxPoint
& srcMaskPt
= wxDefaultPosition
)
804 return m_pimpl
->DoStretchBlit(dstPt
.x
, dstPt
.y
, dstSize
.x
, dstSize
.y
,
805 source
, srcPt
.x
, srcPt
.y
, srcSize
.x
, srcSize
.y
, rop
, useMask
, srcMaskPt
.x
, srcMaskPt
.y
);
808 wxBitmap
GetAsBitmap(const wxRect
*subrect
= (const wxRect
*) NULL
) const
810 return m_pimpl
->DoGetAsBitmap(subrect
);
814 // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
815 void DrawSpline(wxCoord x1
, wxCoord y1
,
816 wxCoord x2
, wxCoord y2
,
817 wxCoord x3
, wxCoord y3
)
818 { m_pimpl
->DrawSpline(x1
,y1
,x2
,y2
,x3
,y3
); }
819 void DrawSpline(int n
, wxPoint points
[])
820 { m_pimpl
->DrawSpline(n
,points
); }
822 void DrawSpline(wxList
*points
)
823 { m_pimpl
->DoDrawSpline(points
); }
824 #endif // wxUSE_SPLINES
831 DECLARE_ABSTRACT_CLASS(wxImplDC
)
837 //-----------------------------------------------------------------------------
839 //-----------------------------------------------------------------------------
841 class WXDLLIMPEXP_CORE wxDC
: public wxDCBase
848 void SetColourMap( const wxPalette
& palette
) { SetPalette(palette
); };
849 #endif // wxUSE_PALETTE
851 // Resolution in pixels per logical inch
852 virtual wxSize
GetPPI() const;
854 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return true; }
855 virtual void EndDoc() { }
856 virtual void StartPage() { }
857 virtual void EndPage() { }
859 virtual GdkWindow
* GetGDKWindow() const { return NULL
; }
863 wxCoord
XDEV2LOG(wxCoord x
) const { return DeviceToLogicalX(x
); }
864 wxCoord
XDEV2LOGREL(wxCoord x
) const { return DeviceToLogicalXRel(x
); }
865 wxCoord
YDEV2LOG(wxCoord y
) const { return DeviceToLogicalY(y
); }
866 wxCoord
YDEV2LOGREL(wxCoord y
) const { return DeviceToLogicalYRel(y
); }
867 wxCoord
XLOG2DEV(wxCoord x
) const { return LogicalToDeviceX(x
); }
868 wxCoord
XLOG2DEVREL(wxCoord x
) const { return LogicalToDeviceXRel(x
); }
869 wxCoord
YLOG2DEV(wxCoord y
) const { return LogicalToDeviceY(y
); }
870 wxCoord
YLOG2DEVREL(wxCoord y
) const { return LogicalToDeviceYRel(y
); }
872 // base class pure virtuals implemented here
873 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
874 virtual void DoGetSizeMM(int* width
, int* height
) const;
877 DECLARE_ABSTRACT_CLASS(wxDC
)
880 // this must be defined when wxDC::Blit() honours the DC origian and needed to
881 // allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
883 #ifndef wxHAS_WORKING_GTK_DC_BLIT
884 #define wxHAS_WORKING_GTK_DC_BLIT