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