]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dcclient.h | |
3 | // Purpose: wxClientDC, wxPaintDC and wxWindowDC classes | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
af0bb3b1 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_DCCLIENT_H_ | |
13 | #define _WX_DCCLIENT_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
af0bb3b1 | 16 | #pragma interface "dcclient.h" |
9b6dbb09 JS |
17 | #endif |
18 | ||
19 | #include "wx/dc.h" | |
20 | ||
af0bb3b1 VZ |
21 | // ----------------------------------------------------------------------------- |
22 | // fwd declarations | |
23 | // ----------------------------------------------------------------------------- | |
9b6dbb09 | 24 | |
dfc54541 | 25 | class WXDLLEXPORT wxWindowDC; |
9b6dbb09 JS |
26 | class WXDLLEXPORT wxWindow; |
27 | ||
af0bb3b1 VZ |
28 | // Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented |
29 | // differently. On many platforms, however, they will be the same. | |
9b6dbb09 | 30 | |
9b6dbb09 | 31 | //----------------------------------------------------------------------------- |
dfc54541 | 32 | // wxWindowDC |
9b6dbb09 JS |
33 | //----------------------------------------------------------------------------- |
34 | ||
af0bb3b1 | 35 | class WXDLLEXPORT wxWindowDC : public wxDC |
9b6dbb09 | 36 | { |
af0bb3b1 | 37 | DECLARE_DYNAMIC_CLASS(wxWindowDC) |
9b6dbb09 | 38 | |
af0bb3b1 VZ |
39 | public: |
40 | wxWindowDC(); | |
dfc54541 | 41 | wxWindowDC( wxWindow *win ); |
af0bb3b1 VZ |
42 | |
43 | ~wxWindowDC(); | |
44 | ||
45 | // TODO this function is Motif-only for now - should it go into base class? | |
46 | void Clear(const wxRect& rect); | |
47 | ||
48 | // implement base class pure virtuals | |
49 | // ---------------------------------- | |
50 | ||
51 | virtual void Clear(); | |
52 | ||
53 | virtual void SetFont(const wxFont& font); | |
54 | virtual void SetPen(const wxPen& pen); | |
55 | virtual void SetBrush(const wxBrush& brush); | |
56 | virtual void SetBackground(const wxBrush& brush); | |
57 | virtual void SetBackgroundMode(int mode); | |
58 | virtual void SetPalette(const wxPalette& palette); | |
9b6dbb09 | 59 | virtual void SetLogicalFunction( int function ); |
af0bb3b1 VZ |
60 | |
61 | virtual void SetTextForeground(const wxColour& colour); | |
62 | virtual void SetTextBackground(const wxColour& colour); | |
63 | ||
64 | virtual long GetCharHeight() const; | |
65 | virtual long GetCharWidth() const; | |
66 | virtual void GetTextExtent(const wxString& string, | |
67 | long *x, long *y, | |
68 | long *descent = NULL, | |
69 | long *externalLeading = NULL, | |
70 | wxFont *theFont = NULL) const; | |
71 | ||
72 | virtual bool CanDrawBitmap() const; | |
73 | virtual bool CanGetTextExtent() const; | |
74 | ||
75 | virtual int GetDepth() const; | |
76 | virtual wxSize GetPPI() const; | |
77 | ||
78 | virtual void DestroyClippingRegion(); | |
79 | ||
80 | // Helper function for setting clipping | |
81 | void SetDCClipping(); | |
82 | ||
83 | // implementation from now on | |
84 | // -------------------------- | |
85 | ||
86 | WXGC GetGC() const { return m_gc; } | |
87 | WXGC GetBackingGC() const { return m_gcBacking; } | |
88 | WXDisplay* GetDisplay() const { return m_display; } | |
89 | bool GetAutoSetting() const { return m_autoSetting; } | |
90 | void SetAutoSetting(bool flag) { m_autoSetting = flag; } | |
47bc1060 | 91 | |
dfc54541 | 92 | protected: |
af0bb3b1 VZ |
93 | virtual void DoFloodFill(long x, long y, const wxColour& col, |
94 | int style = wxFLOOD_SURFACE); | |
95 | ||
96 | virtual bool DoGetPixel(long x, long y, wxColour *col) const; | |
97 | ||
98 | virtual void DoDrawPoint(long x, long y); | |
99 | virtual void DoDrawLine(long x1, long y1, long x2, long y2); | |
100 | ||
101 | virtual void DoDrawArc(long x1, long y1, | |
102 | long x2, long y2, | |
103 | long xc, long yc); | |
104 | virtual void DoDrawEllipticArc(long x, long y, long w, long h, | |
105 | double sa, double ea); | |
106 | ||
107 | virtual void DoDrawRectangle(long x, long y, long width, long height); | |
108 | virtual void DoDrawRoundedRectangle(long x, long y, | |
109 | long width, long height, | |
110 | double radius); | |
111 | virtual void DoDrawEllipse(long x, long y, long width, long height); | |
112 | ||
113 | virtual void DoCrossHair(long x, long y); | |
114 | ||
115 | virtual void DoDrawText(const wxString& text, long x, long y); | |
116 | ||
117 | virtual bool DoBlit(long xdest, long ydest, long width, long height, | |
118 | wxDC *source, long xsrc, long ysrc, | |
119 | int rop = wxCOPY, bool useMask = FALSE); | |
120 | ||
121 | virtual void DoSetClippingRegionAsRegion(const wxRegion& region); | |
122 | virtual void DoSetClippingRegion(long x, long y, | |
123 | long width, long height); | |
124 | ||
af0bb3b1 VZ |
125 | virtual void DoDrawLines(int n, wxPoint points[], |
126 | long xoffset, long yoffset); | |
127 | virtual void DoDrawPolygon(int n, wxPoint points[], | |
128 | long xoffset, long yoffset, | |
129 | int fillStyle = wxODDEVEN_RULE); | |
130 | ||
131 | #if wxUSE_SPLINES | |
132 | virtual void DoDrawSpline(wxList *points); | |
133 | #endif // wxUSE_SPLINES | |
134 | ||
dfc54541 JS |
135 | WXGC m_gc; |
136 | WXGC m_gcBacking; | |
137 | WXDisplay* m_display; | |
138 | wxWindow* m_window; | |
16c1f7f3 JS |
139 | WXRegion m_currentRegion; // Current clipping region (incl. paint clip region) |
140 | WXRegion m_userRegion; // User-defined clipping region | |
141 | WXPixmap m_pixmap; // Pixmap for drawing on | |
dfc54541 JS |
142 | |
143 | // Not sure if we'll need all of these | |
144 | int m_backgroundPixel; | |
145 | wxColour m_currentColour; | |
af0bb3b1 | 146 | // int m_currentBkMode; |
dfc54541 JS |
147 | int m_currentPenWidth ; |
148 | int m_currentPenJoin ; | |
149 | int m_currentPenCap ; | |
150 | int m_currentPenDashCount ; | |
151 | char* m_currentPenDash ; | |
152 | wxBitmap m_currentStipple ; | |
153 | int m_currentStyle ; | |
154 | int m_currentFill ; | |
16c1f7f3 | 155 | int m_autoSetting ; // See comment in dcclient.cpp |
e97f20a0 | 156 | WXFont m_oldFont; |
16c1f7f3 JS |
157 | }; |
158 | ||
159 | class WXDLLEXPORT wxPaintDC: public wxWindowDC | |
160 | { | |
af0bb3b1 VZ |
161 | DECLARE_DYNAMIC_CLASS(wxPaintDC) |
162 | ||
16c1f7f3 | 163 | public: |
af0bb3b1 VZ |
164 | wxPaintDC() { } |
165 | wxPaintDC(wxWindow* win); | |
166 | ||
167 | ~wxPaintDC(); | |
16c1f7f3 JS |
168 | }; |
169 | ||
170 | class WXDLLEXPORT wxClientDC: public wxWindowDC | |
171 | { | |
af0bb3b1 VZ |
172 | DECLARE_DYNAMIC_CLASS(wxClientDC) |
173 | ||
16c1f7f3 | 174 | public: |
af0bb3b1 VZ |
175 | wxClientDC() { } |
176 | wxClientDC(wxWindow* win) : wxWindowDC(win) { } | |
9b6dbb09 JS |
177 | }; |
178 | ||
179 | #endif | |
180 | // _WX_DCCLIENT_H_ |