]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/dc.h
ok, putting it back... not everybody has autoheader
[wxWidgets.git] / include / wx / msw / dc.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: dc.h
3// Purpose: wxDC class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
a23fd0e1 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_DC_H_
13#define _WX_DC_H_
2bda0e17
KB
14
15#ifdef __GNUG__
a23fd0e1 16 #pragma interface "dc.h"
2bda0e17
KB
17#endif
18
a23fd0e1 19class WXDLLEXPORT wxDC : public wxDCBase
2bda0e17 20{
a23fd0e1
VZ
21 DECLARE_DYNAMIC_CLASS(wxDC)
22
2bda0e17 23public:
a23fd0e1
VZ
24 wxDC();
25 ~wxDC();
26
27 // implement base class pure virtuals
28 // ----------------------------------
29
30 virtual void Clear();
31
32 virtual bool StartDoc(const wxString& message);
33 virtual void EndDoc();
34
35 virtual void StartPage();
36 virtual void EndPage();
37
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);
44
45 virtual void DestroyClippingRegion();
46
47 virtual long GetCharHeight() const;
48 virtual long GetCharWidth() const;
49 virtual void GetTextExtent(const wxString& string,
50 long *x, long *y,
51 long *descent = NULL,
52 long *externalLeading = NULL,
53 wxFont *theFont = NULL) const;
54
55 virtual bool CanDrawBitmap() const;
56 virtual bool CanGetTextExtent() const;
57 virtual int GetDepth() const;
58 virtual wxSize GetPPI() const;
59
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);
68
69 // implementation from now on
70 // --------------------------
71
72 virtual void SetRop(WXHDC cdc);
73 virtual void DoClipping(WXHDC cdc);
74 virtual void SelectOldObjects(WXHDC dc);
75
76 wxWindow *GetWindow() const { return m_canvas; }
77 void SetWindow(wxWindow *win) { m_canvas = win; }
78
79 WXHDC GetHDC() const { return m_hDC; }
80 void SetHDC(WXHDC dc, bool bOwnsDC = FALSE)
81 {
82 m_hDC = dc;
83 m_bOwnsDC = bOwnsDC;
84 }
2bda0e17 85
a23fd0e1
VZ
86protected:
87 virtual void DoFloodFill(long x, long y, const wxColour& col,
88 int style = wxFLOOD_SURFACE);
89
90 virtual bool DoGetPixel(long x, long y, wxColour *col) const;
91
92 virtual void DoDrawPoint(long x, long y);
93 virtual void DoDrawLine(long x1, long y1, long x2, long y2);
94
95 virtual void DoDrawArc(long x1, long y1,
96 long x2, long y2,
97 long xc, long yc);
98 virtual void DoDrawEllipticArc(long x, long y, long w, long h,
99 double sa, double ea);
100
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,
104 double radius);
105 virtual void DoDrawEllipse(long x, long y, long width, long height);
106
107 virtual void DoCrossHair(long x, long y);
108
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);
112
113 virtual void DoDrawText(const wxString& text, long x, long y);
114
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);
118
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)
126 {
127 GetClippingBox(x, y, width, height);
128 }
129
130 virtual void DoGetSize(int *width, int *height) const;
131 virtual void DoGetSizeMM(int* width, int* height) const;
132
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);
6a6c0a8b 138
47d67540 139#if wxUSE_SPLINES
a23fd0e1
VZ
140 virtual void DoDrawSpline(wxList *points);
141#endif // wxUSE_SPLINES
142
143 // MSW-specific member variables
144 int m_windowExtX;
145 int m_windowExtY;
146
147 // the window associated with this DC (may be NULL)
148 wxWindow *m_canvas;
149
150 wxBitmap m_selectedBitmap;
151
152 // TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
153 bool m_bOwnsDC:1;
154
155 // our HDC and its usage count: we only free it when the usage count drops
156 // to 0
157 WXHDC m_hDC;
158 int m_hDCCount;
159
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
162 // DC.
163 WXHBITMAP m_oldBitmap;
164 WXHPEN m_oldPen;
165 WXHBRUSH m_oldBrush;
166 WXHFONT m_oldFont;
167 WXHPALETTE m_oldPalette;
2bda0e17
KB
168};
169
2bda0e17 170#endif
bbcdf8bc 171 // _WX_DC_H_