]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/motif/dcclient.h | |
3 | // Purpose: wxClientDCImpl, wxPaintDCImpl and wxWindowDCImpl classes | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // Copyright: (c) Julian Smart | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_DCCLIENT_H_ | |
12 | #define _WX_DCCLIENT_H_ | |
13 | ||
14 | #include "wx/motif/dc.h" | |
15 | ||
16 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
17 | ||
18 | //----------------------------------------------------------------------------- | |
19 | // wxWindowDCImpl | |
20 | //----------------------------------------------------------------------------- | |
21 | ||
22 | class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxMotifDCImpl | |
23 | { | |
24 | public: | |
25 | wxWindowDCImpl(wxDC *owner); | |
26 | wxWindowDCImpl(wxDC *owner, wxWindow *win); | |
27 | ||
28 | virtual ~wxWindowDCImpl(); | |
29 | ||
30 | // TODO this function is Motif-only for now - should it go into base class? | |
31 | void Clear(const wxRect& rect); | |
32 | ||
33 | // implement base class pure virtuals | |
34 | // ---------------------------------- | |
35 | ||
36 | virtual void Clear(); | |
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 | virtual void SetLogicalFunction( wxRasterOperationMode function ); | |
45 | ||
46 | virtual void SetTextForeground(const wxColour& colour); | |
47 | virtual void SetTextBackground(const wxColour& colour); | |
48 | ||
49 | virtual wxCoord GetCharHeight() const; | |
50 | virtual wxCoord GetCharWidth() const; | |
51 | virtual void DoGetTextExtent(const wxString& string, | |
52 | wxCoord *x, wxCoord *y, | |
53 | wxCoord *descent = NULL, | |
54 | wxCoord *externalLeading = NULL, | |
55 | const wxFont *theFont = NULL) const; | |
56 | ||
57 | virtual bool CanDrawBitmap() const; | |
58 | virtual bool CanGetTextExtent() const; | |
59 | ||
60 | virtual int GetDepth() const; | |
61 | virtual wxSize GetPPI() const; | |
62 | ||
63 | virtual void DestroyClippingRegion(); | |
64 | ||
65 | // Helper function for setting clipping | |
66 | void SetDCClipping(WXRegion region); | |
67 | ||
68 | // implementation from now on | |
69 | // -------------------------- | |
70 | ||
71 | WXGC GetGC() const { return m_gc; } | |
72 | WXGC GetBackingGC() const { return m_gcBacking; } | |
73 | WXDisplay* GetDisplay() const { return m_display; } | |
74 | bool GetAutoSetting() const { return (m_autoSetting != 0); } // See comment in dcclient.cpp | |
75 | void SetAutoSetting(bool flag) { m_autoSetting = flag; } | |
76 | ||
77 | protected: | |
78 | // note that this function will call colour.SetPixel, | |
79 | // and will do one of curCol = colour, curCol = wxWHITE, curCol = wxBLACK | |
80 | // roundToWhite has an effect for monochrome display only | |
81 | // if roundToWhite == true then the colour will be set to white unless | |
82 | // it is RGB 0x000000;if roundToWhite == true the colour wull be set to | |
83 | // black unless it id RGB 0xffffff | |
84 | WXPixel CalculatePixel(wxColour& colour, wxColour& curCol, | |
85 | bool roundToWhite) const; | |
86 | // sets the foreground pixel taking into account the | |
87 | // currently selected logical operation | |
88 | void SetForegroundPixelWithLogicalFunction(WXPixel pixel); | |
89 | ||
90 | virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, | |
91 | wxFloodFillStyle style = wxFLOOD_SURFACE); | |
92 | ||
93 | virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; | |
94 | ||
95 | virtual void DoDrawPoint(wxCoord x, wxCoord y); | |
96 | virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
97 | ||
98 | virtual void DoDrawArc(wxCoord x1, wxCoord y1, | |
99 | wxCoord x2, wxCoord y2, | |
100 | wxCoord xc, wxCoord yc); | |
101 | virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, | |
102 | double sa, double ea); | |
103 | ||
104 | virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
105 | virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, | |
106 | wxCoord width, wxCoord height, | |
107 | double radius); | |
108 | virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
109 | ||
110 | virtual void DoCrossHair(wxCoord x, wxCoord y); | |
111 | ||
112 | virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
113 | virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle); | |
114 | ||
115 | virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
116 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
117 | wxRasterOperationMode rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); | |
118 | ||
119 | virtual void DoSetClippingRegion(wxCoord x, wxCoord y, | |
120 | wxCoord width, wxCoord height); | |
121 | virtual void DoSetDeviceClippingRegion(const wxRegion& region); | |
122 | ||
123 | virtual void DoDrawLines(int n, const wxPoint points[], | |
124 | wxCoord xoffset, wxCoord yoffset); | |
125 | virtual void DoDrawPolygon(int n, const wxPoint points[], | |
126 | wxCoord xoffset, wxCoord yoffset, | |
127 | wxPolygonFillMode fillStyle = wxODDEVEN_RULE); | |
128 | ||
129 | void DoGetSize( int *width, int *height ) const; | |
130 | ||
131 | // common part of constructors | |
132 | void Init(); | |
133 | ||
134 | WXGC m_gc; | |
135 | WXGC m_gcBacking; | |
136 | WXDisplay* m_display; | |
137 | wxWindow* m_window; | |
138 | // Pixmap for drawing on | |
139 | WXPixmap m_pixmap; | |
140 | // Last clipping region set on th GC, this is the combination | |
141 | // of paint clipping region and all user-defined clipping regions | |
142 | WXRegion m_clipRegion; | |
143 | ||
144 | // Not sure if we'll need all of these | |
145 | WXPixel m_backgroundPixel; | |
146 | wxColour m_currentColour; | |
147 | int m_currentPenWidth ; | |
148 | int m_currentPenJoin ; | |
149 | int m_currentPenCap ; | |
150 | int m_currentPenDashCount ; | |
151 | wxX11Dash* m_currentPenDash ; | |
152 | wxBitmap m_currentStipple ; | |
153 | int m_currentStyle ; | |
154 | int m_currentFill ; | |
155 | int m_autoSetting ; // See comment in dcclient.cpp | |
156 | ||
157 | DECLARE_DYNAMIC_CLASS(wxWindowDCImpl) | |
158 | }; | |
159 | ||
160 | class WXDLLIMPEXP_CORE wxPaintDCImpl: public wxWindowDCImpl | |
161 | { | |
162 | public: | |
163 | wxPaintDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { } | |
164 | wxPaintDCImpl(wxDC *owner, wxWindow* win); | |
165 | ||
166 | virtual ~wxPaintDCImpl(); | |
167 | ||
168 | DECLARE_DYNAMIC_CLASS(wxPaintDCImpl) | |
169 | }; | |
170 | ||
171 | class WXDLLIMPEXP_CORE wxClientDCImpl: public wxWindowDCImpl | |
172 | { | |
173 | public: | |
174 | wxClientDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { } | |
175 | wxClientDCImpl(wxDC *owner, wxWindow* win) | |
176 | : wxWindowDCImpl(owner, win) { } | |
177 | ||
178 | DECLARE_DYNAMIC_CLASS(wxClientDCImpl) | |
179 | }; | |
180 | ||
181 | #endif // _WX_DCCLIENT_H_ |