]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dc.h | |
3 | // Purpose: wxDC class | |
54da4255 | 4 | // Author: AUTHOR |
0e320a79 | 5 | // Modified by: |
54da4255 | 6 | // Created: ??/??/98 |
0e320a79 | 7 | // RCS-ID: $Id$ |
54da4255 DW |
8 | // Copyright: (c) AUTHOR |
9 | // Licence: wxWindows licence | |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_DC_H_ | |
13 | #define _WX_DC_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
54da4255 | 16 | #pragma interface "dc.h" |
0e320a79 DW |
17 | #endif |
18 | ||
c3d43472 | 19 | #include "wx/window.h" |
54da4255 DW |
20 | #include "wx/pen.h" |
21 | #include "wx/brush.h" | |
22 | #include "wx/icon.h" | |
23 | #include "wx/font.h" | |
24 | #include "wx/gdicmn.h" | |
25 | ||
26 | //----------------------------------------------------------------------------- | |
27 | // constants | |
28 | //----------------------------------------------------------------------------- | |
29 | ||
30 | #ifndef MM_TEXT | |
1408104d DW |
31 | #define MM_TEXT 0 |
32 | #define MM_ISOTROPIC 1 | |
33 | #define MM_ANISOTROPIC 2 | |
34 | #define MM_LOMETRIC 3 | |
35 | #define MM_HIMETRIC 4 | |
36 | #define MM_TWIPS 5 | |
37 | #define MM_POINTS 6 | |
38 | #define MM_METRIC 7 | |
54da4255 | 39 | #endif |
0e320a79 | 40 | |
54da4255 DW |
41 | //----------------------------------------------------------------------------- |
42 | // global variables | |
43 | //----------------------------------------------------------------------------- | |
0e320a79 | 44 | |
54da4255 | 45 | extern int wxPageNumber; |
0e320a79 | 46 | |
54da4255 DW |
47 | //----------------------------------------------------------------------------- |
48 | // wxDC | |
49 | //----------------------------------------------------------------------------- | |
0e320a79 | 50 | |
1408104d | 51 | class WXDLLEXPORT wxDC: public wxDCBase |
54da4255 DW |
52 | { |
53 | DECLARE_ABSTRACT_CLASS(wxDC) | |
0e320a79 | 54 | |
54da4255 | 55 | public: |
0e320a79 | 56 | |
54da4255 DW |
57 | wxDC(void); |
58 | ~wxDC(void); | |
0e320a79 | 59 | |
1408104d DW |
60 | virtual void BeginDrawing(void) { }; |
61 | virtual void EndDrawing(void) { }; | |
0e320a79 | 62 | |
1408104d DW |
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 | |
71 | ,long* width | |
72 | ,long* height | |
73 | ,long* descent = NULL | |
74 | ,long* externalLeading = NULL | |
75 | ,wxFont* theFont = NULL | |
76 | ) const; | |
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); | |
93 | ||
94 | virtual void DoFloodFill( long x | |
95 | ,long y | |
96 | ,const wxColour& col | |
97 | ,int style = wxFLOOD_SURFACE | |
98 | ); | |
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, | |
103 | long x2, long y2, | |
104 | long xc, long yc | |
105 | ); | |
106 | virtual void DoDrawEllipticArc( long x, long y | |
107 | ,long w, long h | |
108 | ,double sa, double ea | |
109 | ); | |
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 | |
113 | ,double radius | |
114 | ); | |
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 | |
119 | ,long x, long y | |
120 | ,bool useMask = FALSE | |
121 | ); | |
122 | virtual void DoDrawText(const wxString& text, long x, long y); | |
123 | virtual bool DoBlit( long xdest, long ydest | |
124 | ,long width, long height | |
125 | ,wxDC *source | |
126 | ,long xsrc, long ysrc | |
127 | ,int rop = wxCOPY, bool useMask = FALSE | |
128 | ); | |
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 | |
133 | ); | |
134 | virtual void DoDrawPolygon( int n, wxPoint points[] | |
135 | ,long xoffset, long yoffset | |
136 | ,int fillStyle = wxODDEVEN_RULE | |
137 | ); | |
138 | virtual void DoSetClippingRegionAsRegion(const wxRegion& region); | |
139 | virtual void DoSetClippingRegion( long x, long y | |
140 | ,long width, long height | |
141 | ); | |
142 | #if wxUSE_SPLINES | |
143 | virtual void DoDrawSpline(wxList *points); | |
144 | #endif | |
54da4255 | 145 | |
1408104d DW |
146 | //----------------------------------------------------------------------------- |
147 | // Other virtuals from wxDCBase that are overridden here | |
148 | //----------------------------------------------------------------------------- | |
54da4255 | 149 | |
54da4255 | 150 | virtual void SetLogicalScale( double x, double y ); |
1408104d DW |
151 | |
152 | //----------------------------------------------------------------------------- | |
153 | // Our own new stuff | |
154 | //----------------------------------------------------------------------------- | |
54da4255 DW |
155 | virtual void SetInternalDeviceOrigin( long x, long y ); |
156 | virtual void GetInternalDeviceOrigin( long *x, long *y ); | |
157 | ||
1408104d | 158 | private: |
54da4255 | 159 | |
1408104d DW |
160 | #if WXWIN_COMPATIBILITY |
161 | // function hiding warning supression | |
162 | virtual void GetTextExtent( const wxString& string | |
163 | ,long* width | |
164 | ,long* height | |
165 | ,long* descent = NULL | |
166 | ,long* externalLeading = NULL | |
167 | ,wxFont* theFont = NULL | |
168 | ,bool use16 = FALSE | |
169 | ) const | |
170 | { wxDCBase::GetTextExtent(string, width, height, descent, externalLeading, theFont, use16); }; | |
171 | #endif | |
54da4255 | 172 | |
1408104d DW |
173 | protected: |
174 | ||
175 | // ------------------------------------------------------------------------ | |
176 | // Some additional data we need | |
177 | // ------------------------------------------------------------------------ | |
178 | ||
179 | // Owner canvas and selected in bitmap (if bitmap is GDI object selected) | |
180 | wxWindow* m_owner; | |
181 | wxBitmap* m_bitmap; | |
182 | ||
183 | // our HDC and its usage count: we only free it when the usage count drops | |
184 | // to 0 | |
185 | WXHDC m_hDC; | |
186 | int m_hDCCount; | |
187 | ||
188 | // Store all old GDI objects when do a SelectObject, so we can select them | |
189 | // back in (this unselecting user's objects) so we can safely delete the | |
190 | // DC. | |
191 | WXHBITMAP m_oldBitmap; | |
192 | WXHPEN m_oldPen; | |
193 | WXHBRUSH m_oldBrush; | |
194 | WXHFONT m_oldFont; | |
195 | WXHPALETTE m_oldPalette; | |
0e320a79 DW |
196 | }; |
197 | ||
198 | #endif | |
199 | // _WX_DC_H_ |