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