1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "dc.h"
19 class WXDLLEXPORT wxDC
: public wxDCBase
21 DECLARE_DYNAMIC_CLASS(wxDC
)
27 // implement base class pure virtuals
28 // ----------------------------------
32 virtual bool StartDoc(const wxString
& message
);
33 virtual void EndDoc();
35 virtual void StartPage();
36 virtual void EndPage();
38 virtual void SetFont(const wxFont
& font
);
39 virtual void SetPen(const wxPen
& pen
);
40 virtual void SetBrush(const wxBrush
& brush
);
41 virtual void SetBackground(const wxBrush
& brush
);
42 virtual void SetBackgroundMode(int mode
);
43 virtual void SetPalette(const wxPalette
& palette
);
45 virtual void DestroyClippingRegion();
47 virtual long GetCharHeight() const;
48 virtual long GetCharWidth() const;
49 virtual void GetTextExtent(const wxString
& string
,
52 long *externalLeading
= NULL
,
53 wxFont
*theFont
= NULL
) const;
55 virtual bool CanDrawBitmap() const;
56 virtual bool CanGetTextExtent() const;
57 virtual int GetDepth() const;
58 virtual wxSize
GetPPI() const;
60 virtual void SetMapMode(int mode
);
61 virtual void SetUserScale(double x
, double y
);
62 virtual void SetSystemScale(double x
, double y
);
63 virtual void SetLogicalScale(double x
, double y
);
64 virtual void SetLogicalOrigin(long x
, long y
);
65 virtual void SetDeviceOrigin(long x
, long y
);
66 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
67 virtual void SetLogicalFunction(int function
);
69 // implementation from now on
70 // --------------------------
72 virtual void SetRop(WXHDC cdc
);
73 virtual void DoClipping(WXHDC cdc
);
74 virtual void SelectOldObjects(WXHDC dc
);
76 wxWindow
*GetWindow() const { return m_canvas
; }
77 void SetWindow(wxWindow
*win
) { m_canvas
= win
; }
79 WXHDC
GetHDC() const { return m_hDC
; }
80 void SetHDC(WXHDC dc
, bool bOwnsDC
= FALSE
)
87 virtual void DoFloodFill(long x
, long y
, const wxColour
& col
,
88 int style
= wxFLOOD_SURFACE
);
90 virtual bool DoGetPixel(long x
, long y
, wxColour
*col
) const;
92 virtual void DoDrawPoint(long x
, long y
);
93 virtual void DoDrawLine(long x1
, long y1
, long x2
, long y2
);
95 virtual void DoDrawArc(long x1
, long y1
,
98 virtual void DoDrawEllipticArc(long x
, long y
, long w
, long h
,
99 double sa
, double ea
);
101 virtual void DoDrawRectangle(long x
, long y
, long width
, long height
);
102 virtual void DoDrawRoundedRectangle(long x
, long y
,
103 long width
, long height
,
105 virtual void DoDrawEllipse(long x
, long y
, long width
, long height
);
107 virtual void DoCrossHair(long x
, long y
);
109 virtual void DoDrawIcon(const wxIcon
& icon
, long x
, long y
);
110 virtual void DoDrawBitmap(const wxBitmap
&bmp
, long x
, long y
,
111 bool useMask
= FALSE
);
113 virtual void DoDrawText(const wxString
& text
, long x
, long y
);
115 virtual bool DoBlit(long xdest
, long ydest
, long width
, long height
,
116 wxDC
*source
, long xsrc
, long ysrc
,
117 int rop
= wxCOPY
, bool useMask
= FALSE
);
119 // this is gnarly - we can't even call this function DoSetClippingRegion()
120 // because of virtual function hiding
121 virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
);
122 virtual void DoSetClippingRegion(long x
, long y
,
123 long width
, long height
);
124 virtual void DoGetClippingRegion(long *x
, long *y
,
125 long *width
, long *height
)
127 GetClippingBox(x
, y
, width
, height
);
130 virtual void DoGetSize(int *width
, int *height
) const;
131 virtual void DoGetSizeMM(int* width
, int* height
) const;
133 virtual void DoDrawLines(int n
, wxPoint points
[],
134 long xoffset
, long yoffset
);
135 virtual void DoDrawPolygon(int n
, wxPoint points
[],
136 long xoffset
, long yoffset
,
137 int fillStyle
= wxODDEVEN_RULE
);
140 virtual void DoDrawSpline(wxList
*points
);
141 #endif // wxUSE_SPLINES
143 // MSW-specific member variables
147 // the window associated with this DC (may be NULL)
150 wxBitmap m_selectedBitmap
;
152 // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
155 // our HDC and its usage count: we only free it when the usage count drops
160 // Store all old GDI objects when do a SelectObject, so we can select them
161 // back in (this unselecting user's objects) so we can safely delete the
163 WXHBITMAP m_oldBitmap
;
167 WXHPALETTE m_oldPalette
;