1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "dc.h"
19 #include "wx/window.h"
24 #include "wx/gdicmn.h"
26 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
32 #define MM_ISOTROPIC 1
33 #define MM_ANISOTROPIC 2
41 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
45 extern int wxPageNumber
;
47 //-----------------------------------------------------------------------------
49 //-----------------------------------------------------------------------------
51 class WXDLLEXPORT wxDC
: public wxDCBase
53 DECLARE_ABSTRACT_CLASS(wxDC
)
60 virtual void BeginDrawing(void) { };
61 virtual void EndDrawing(void) { };
63 //-----------------------------------------------------------------------------
64 // Pure virtuals from wxDCBase that need defining
65 //-----------------------------------------------------------------------------
66 virtual bool CanDrawBitmap(void) const { return TRUE
; };
67 virtual bool CanGetTextExtent(void) const { return TRUE
; };
68 virtual int GetDepth(void) const;
69 virtual wxSize
GetPPI(void) const;
70 virtual void GetTextExtent( const wxString
& string
74 ,long* externalLeading
= NULL
75 ,wxFont
* theFont
= NULL
77 virtual long GetCharWidth(void) const;
78 virtual long GetCharHeight(void) const;
79 virtual void Clear(void);
80 virtual void SetFont(const wxFont
& font
);
81 virtual void SetPen(const wxPen
& pen
);
82 virtual void SetBrush(const wxBrush
& brush
);
83 virtual void SetBackground(const wxBrush
& brush
);
84 virtual void SetLogicalFunction(int function
);
85 virtual void SetBackgroundMode(int mode
);
86 virtual void SetPalette(const wxPalette
& palette
);
87 virtual void SetMapMode(int mode
);
88 virtual void DestroyClippingRegion(void);
89 virtual void SetUserScale(double x
, double y
);
90 virtual void SetLogicalOrigin(long x
, long y
);
91 virtual void SetDeviceOrigin(long x
, long y
);
92 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
94 virtual void DoFloodFill( long x
97 ,int style
= wxFLOOD_SURFACE
99 virtual bool DoGetPixel(long x
, long y
, wxColour
*col
) const;
100 virtual void DoDrawPoint(long x
, long y
);
101 virtual void DoDrawLine(long x1
, long y1
, long x2
, long y2
);
102 virtual void DoDrawArc(long x1
, long y1
,
106 virtual void DoDrawEllipticArc( long x
, long y
108 ,double sa
, double ea
110 virtual void DoDrawRectangle(long x
, long y
, long width
, long height
);
111 virtual void DoDrawRoundedRectangle( long x
, long y
112 ,long width
, long height
115 virtual void DoDrawEllipse(long x
, long y
, long width
, long height
);
116 virtual void DoCrossHair(long x
, long y
);
117 virtual void DoDrawIcon(const wxIcon
& icon
, long x
, long y
);
118 virtual void DoDrawBitmap( const wxBitmap
&bmp
120 ,bool useMask
= FALSE
122 virtual void DoDrawText(const wxString
& text
, long x
, long y
);
123 virtual bool DoBlit( long xdest
, long ydest
124 ,long width
, long height
126 ,long xsrc
, long ysrc
127 ,int rop
= wxCOPY
, bool useMask
= FALSE
129 virtual void DoGetSize(int *width
, int *height
) const;
130 virtual void DoGetSizeMM(int* width
, int* height
) const;
131 virtual void DoDrawLines( int n
, wxPoint points
[]
132 ,long xoffset
, long yoffset
134 virtual void DoDrawPolygon( int n
, wxPoint points
[]
135 ,long xoffset
, long yoffset
136 ,int fillStyle
= wxODDEVEN_RULE
138 virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
);
139 virtual void DoSetClippingRegion( long x
, long y
140 ,long width
, long height
143 virtual void DoDrawSpline(wxList
*points
);
146 // OS2-specific member variables
150 //-----------------------------------------------------------------------------
151 // Other virtuals from wxDCBase that are overridden here
152 //-----------------------------------------------------------------------------
154 virtual void SetLogicalScale( double x
, double y
);
156 //-----------------------------------------------------------------------------
158 //-----------------------------------------------------------------------------
159 virtual void SetInternalDeviceOrigin( long x
, long y
);
160 virtual void GetInternalDeviceOrigin( long *x
, long *y
);
162 virtual void SetRop(WXHDC cdc
);
163 virtual void DoClipping(WXHDC cdc
);
164 virtual void SelectOldObjects(WXHDC dc
);
166 wxWindow
*GetWindow() const { return m_canvas
; }
167 void SetWindow(wxWindow
*win
) { m_canvas
= win
; }
169 WXHDC
GetHDC() const { return m_hDC
; }
170 void SetHDC(WXHDC dc
, bool bOwnsDC
= FALSE
)
178 #if WXWIN_COMPATIBILITY
179 // function hiding warning supression
180 virtual void GetTextExtent( const wxString
& string
183 ,long* descent
= NULL
184 ,long* externalLeading
= NULL
185 ,wxFont
* theFont
= NULL
188 { wxDCBase::GetTextExtent(string
, width
, height
, descent
, externalLeading
, theFont
, use16
); };
193 // ------------------------------------------------------------------------
194 // Some additional data we need
195 // ------------------------------------------------------------------------
197 // Owner canvas and selected in bitmap (if bitmap is GDI object selected)
199 wxBitmap m_selectedBitmap
;
201 // our HDC and its usage count: we only free it when the usage count drops
207 // Store all old GDI objects when do a SelectObject, so we can select them
208 // back in (this unselecting user's objects) so we can safely delete the
210 WXHBITMAP m_oldBitmap
;
214 WXHPALETTE m_oldPalette
;