]>
Commit | Line | Data |
---|---|---|
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 | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_DCCLIENT_H_ | |
13 | #define _WX_DCCLIENT_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "dcclient.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/dc.h" | |
20 | #include "wx/region.h" | |
21 | ||
22 | // ----------------------------------------------------------------------------- | |
23 | // fwd declarations | |
24 | // ----------------------------------------------------------------------------- | |
25 | ||
26 | class wxWindow; | |
27 | ||
28 | class wxWindowDC; | |
29 | class wxPaintDC; | |
30 | class wxClientDC; | |
31 | ||
32 | //----------------------------------------------------------------------------- | |
33 | // wxWindowDC | |
34 | //----------------------------------------------------------------------------- | |
35 | ||
36 | class wxWindowDC : public wxDC | |
37 | { | |
38 | public: | |
39 | wxWindowDC(); | |
40 | wxWindowDC( wxWindow *win ); | |
41 | ||
42 | ~wxWindowDC(); | |
43 | ||
44 | virtual bool CanDrawBitmap() const { return TRUE; } | |
45 | virtual bool CanGetTextExtent() const { return TRUE; } | |
46 | ||
47 | protected: | |
48 | virtual void DoGetSize(int *width, int *height) const; | |
49 | virtual void DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE ); | |
50 | virtual bool DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const; | |
51 | ||
52 | virtual void DoDrawPoint(wxCoord x, wxCoord y); | |
53 | virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
54 | ||
55 | virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); | |
56 | virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, | |
57 | bool useMask = FALSE ); | |
58 | ||
59 | virtual void DoDrawArc(wxCoord x1, wxCoord y1, | |
60 | wxCoord x2, wxCoord y2, | |
61 | wxCoord xc, wxCoord yc); | |
62 | virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, | |
63 | double sa, double ea); | |
64 | ||
65 | virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
66 | virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, | |
67 | wxCoord width, wxCoord height, | |
68 | double radius); | |
69 | virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
70 | ||
71 | virtual void DoCrossHair(wxCoord x, wxCoord y); | |
72 | ||
73 | virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
74 | virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle); | |
75 | ||
76 | virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
77 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
78 | int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); | |
79 | ||
80 | virtual void DoSetClippingRegionAsRegion(const wxRegion& region); | |
81 | virtual void DoSetClippingRegion(wxCoord x, wxCoord y, | |
82 | wxCoord width, wxCoord height); | |
83 | ||
84 | virtual void DoDrawLines(int n, wxPoint points[], | |
85 | wxCoord xoffset, wxCoord yoffset); | |
86 | virtual void DoDrawPolygon(int n, wxPoint points[], | |
87 | wxCoord xoffset, wxCoord yoffset, | |
88 | int fillStyle = wxODDEVEN_RULE); | |
89 | ||
90 | ||
91 | public: | |
92 | virtual void Clear(); | |
93 | ||
94 | virtual void SetFont(const wxFont& font); | |
95 | virtual void SetPen(const wxPen& pen); | |
96 | virtual void SetBrush(const wxBrush& brush); | |
97 | virtual void SetBackground(const wxBrush& brush); | |
98 | virtual void SetBackgroundMode(int mode); | |
99 | virtual void SetPalette(const wxPalette& palette); | |
100 | virtual void SetLogicalFunction( int function ); | |
101 | ||
102 | virtual void SetTextForeground(const wxColour& colour); | |
103 | virtual void SetTextBackground(const wxColour& colour); | |
104 | ||
105 | virtual wxCoord GetCharHeight() const; | |
106 | virtual wxCoord GetCharWidth() const; | |
107 | virtual void DoGetTextExtent(const wxString& string, | |
108 | wxCoord *x, wxCoord *y, | |
109 | wxCoord *descent = NULL, | |
110 | wxCoord *externalLeading = NULL, | |
111 | wxFont *theFont = NULL) const; | |
112 | ||
113 | virtual int GetDepth() const; | |
114 | virtual wxSize GetPPI() const; | |
115 | ||
116 | virtual void DestroyClippingRegion(); | |
117 | ||
118 | protected: | |
119 | // implementation | |
120 | // -------------- | |
121 | ||
122 | WXDisplay *m_display; | |
123 | WXWindow m_window; | |
124 | WXGC m_penGC; | |
125 | WXGC m_brushGC; | |
126 | WXGC m_textGC; | |
127 | WXGC m_bgGC; | |
128 | WXColormap m_cmap; | |
129 | bool m_isMemDC; | |
130 | bool m_isScreenDC; | |
131 | wxWindow *m_owner; | |
132 | wxRegion m_currentClippingRegion; | |
133 | wxRegion m_paintClippingRegion; | |
134 | ||
135 | void SetUpDC(); | |
136 | void Destroy(); | |
137 | void ComputeScaleAndOrigin(); | |
138 | ||
139 | private: | |
140 | DECLARE_DYNAMIC_CLASS(wxWindowDC) | |
141 | }; | |
142 | ||
143 | //----------------------------------------------------------------------------- | |
144 | // wxClientDC | |
145 | //----------------------------------------------------------------------------- | |
146 | ||
147 | class wxClientDC : public wxWindowDC | |
148 | { | |
149 | public: | |
150 | wxClientDC() { } | |
151 | wxClientDC( wxWindow *win ); | |
152 | ||
153 | protected: | |
154 | virtual void DoGetSize(int *width, int *height) const; | |
155 | ||
156 | private: | |
157 | DECLARE_DYNAMIC_CLASS(wxClientDC) | |
158 | }; | |
159 | ||
160 | //----------------------------------------------------------------------------- | |
161 | // wxPaintDC | |
162 | //----------------------------------------------------------------------------- | |
163 | ||
164 | class wxPaintDC : public wxClientDC | |
165 | { | |
166 | public: | |
167 | wxPaintDC() { } | |
168 | wxPaintDC( wxWindow *win ); | |
169 | ||
170 | private: | |
171 | DECLARE_DYNAMIC_CLASS(wxPaintDC) | |
172 | }; | |
173 | ||
174 | #endif | |
175 | // _WX_DCCLIENT_H_ |