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