]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dcclient.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
dbf858b5 RR |
5 | // Id: $Id$ |
6 | // Copyright: (c) 1998 Robert Roebling | |
65571936 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
512cfcc3 PC |
10 | #ifndef _WX_GTKDCCLIENT_H_ |
11 | #define _WX_GTKDCCLIENT_H_ | |
c801d85f | 12 | |
888dde65 RR |
13 | #include "wx/gtk/dc.h" |
14 | #include "wx/dcclient.h" | |
772b3767 | 15 | #include "wx/region.h" |
c801d85f | 16 | |
b5dbe15d | 17 | class WXDLLIMPEXP_FWD_CORE wxWindow; |
c801d85f KB |
18 | |
19 | //----------------------------------------------------------------------------- | |
888dde65 | 20 | // wxWindowDCImpl |
c801d85f KB |
21 | //----------------------------------------------------------------------------- |
22 | ||
888dde65 | 23 | class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxGTKDCImpl |
c801d85f | 24 | { |
ec758a20 | 25 | public: |
888dde65 RR |
26 | wxWindowDCImpl( wxDC *owner ); |
27 | wxWindowDCImpl( wxDC *owner, wxWindow *win ); | |
ab171e95 | 28 | |
888dde65 | 29 | virtual ~wxWindowDCImpl(); |
b0e0d661 | 30 | |
b1263dcf WS |
31 | virtual bool CanDrawBitmap() const { return true; } |
32 | virtual bool CanGetTextExtent() const { return true; } | |
b0e0d661 | 33 | |
376aa62a | 34 | virtual void DoGetSize(int *width, int *height) const; |
387ebd3e | 35 | virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE ); |
72cdf4c9 VZ |
36 | virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const; |
37 | ||
38 | virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ); | |
39 | virtual void DoCrossHair( wxCoord x, wxCoord y ); | |
40 | virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, | |
41 | wxCoord xc, wxCoord yc ); | |
42 | virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, | |
b0e0d661 | 43 | double sa, double ea ); |
72cdf4c9 | 44 | virtual void DoDrawPoint( wxCoord x, wxCoord y ); |
b0e0d661 VZ |
45 | |
46 | virtual void DoDrawLines(int n, wxPoint points[], | |
72cdf4c9 | 47 | wxCoord xoffset, wxCoord yoffset); |
b0e0d661 | 48 | virtual void DoDrawPolygon(int n, wxPoint points[], |
72cdf4c9 | 49 | wxCoord xoffset, wxCoord yoffset, |
b0e0d661 VZ |
50 | int fillStyle = wxODDEVEN_RULE); |
51 | ||
72cdf4c9 VZ |
52 | virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); |
53 | virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 ); | |
54 | virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); | |
b0e0d661 | 55 | |
72cdf4c9 VZ |
56 | virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); |
57 | virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, | |
b1263dcf | 58 | bool useMask = false ); |
b0e0d661 | 59 | |
72cdf4c9 VZ |
60 | virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, |
61 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
b1263dcf | 62 | int logical_func = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ); |
b0e0d661 | 63 | |
72cdf4c9 | 64 | virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ); |
95724b1a VZ |
65 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, |
66 | double angle); | |
72cdf4c9 VZ |
67 | virtual void DoGetTextExtent( const wxString &string, |
68 | wxCoord *width, wxCoord *height, | |
69 | wxCoord *descent = (wxCoord *) NULL, | |
70 | wxCoord *externalLeading = (wxCoord *) NULL, | |
c94f845b | 71 | const wxFont *theFont = (wxFont *) NULL) const; |
1f91072f | 72 | virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; |
6f02a879 | 73 | virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); |
fdaad94e | 74 | virtual void DoSetDeviceClippingRegion( const wxRegion ®ion ); |
376aa62a | 75 | |
72cdf4c9 VZ |
76 | virtual wxCoord GetCharWidth() const; |
77 | virtual wxCoord GetCharHeight() const; | |
b0e0d661 VZ |
78 | |
79 | virtual void Clear(); | |
80 | ||
81 | virtual void SetFont( const wxFont &font ); | |
82 | virtual void SetPen( const wxPen &pen ); | |
83 | virtual void SetBrush( const wxBrush &brush ); | |
84 | virtual void SetBackground( const wxBrush &brush ); | |
85 | virtual void SetLogicalFunction( int function ); | |
86 | virtual void SetTextForeground( const wxColour &col ); | |
87 | virtual void SetTextBackground( const wxColour &col ); | |
88 | virtual void SetBackgroundMode( int mode ); | |
89 | virtual void SetPalette( const wxPalette& palette ); | |
90 | ||
b0e0d661 | 91 | virtual void DestroyClippingRegion(); |
b0e0d661 | 92 | |
b0e0d661 VZ |
93 | // Resolution in pixels per logical inch |
94 | virtual wxSize GetPPI() const; | |
95 | virtual int GetDepth() const; | |
96 | ||
847dfdb4 RR |
97 | // overrriden here for RTL |
98 | virtual void SetDeviceOrigin( wxCoord x, wxCoord y ); | |
99 | virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); | |
100 | ||
f6f1f4ad | 101 | // protected: |
b0e0d661 VZ |
102 | // implementation |
103 | // -------------- | |
104 | ||
888dde65 | 105 | GdkWindow *m_gdkwindow; |
b0e0d661 VZ |
106 | GdkGC *m_penGC; |
107 | GdkGC *m_brushGC; | |
108 | GdkGC *m_textGC; | |
109 | GdkGC *m_bgGC; | |
110 | GdkColormap *m_cmap; | |
e1208c31 | 111 | bool m_isScreenDC; |
3d2d8da1 RR |
112 | wxRegion m_currentClippingRegion; |
113 | wxRegion m_paintClippingRegion; | |
b1263dcf | 114 | |
2b5f62a0 | 115 | // PangoContext stuff for GTK 2.0 |
8943b403 | 116 | PangoContext *m_context; |
138618ac | 117 | PangoLayout *m_layout; |
8943b403 | 118 | PangoFontDescription *m_fontdesc; |
b0e0d661 | 119 | |
ab171e95 | 120 | void SetUpDC( bool ismem = false ); |
b0e0d661 | 121 | void Destroy(); |
98d8a7ec | 122 | |
b1263dcf | 123 | virtual void ComputeScaleAndOrigin(); |
238d735d | 124 | |
888dde65 | 125 | virtual GdkWindow *GetGDKWindow() const { return m_gdkwindow; } |
cd9da200 | 126 | |
ea3a345f PC |
127 | private: |
128 | void DrawingSetup(GdkGC*& gc, bool& originChanged); | |
129 | ||
98d8a7ec VZ |
130 | // return true if the rectangle specified by the parameters is entirely |
131 | // outside of the current clipping region | |
132 | bool IsOutsideOfClippingRegion(int x, int y, int w, int h); | |
133 | ||
134 | // remove the current clipping mask and set the clipping region | |
135 | void RemoveClipMask(GdkGC *gc); | |
136 | ||
137 | // return the mask equal to the intersection of the original one with the | |
138 | // clipping region | |
139 | GdkBitmap *GetClippedMask(GdkBitmap *mask, int w, int h, | |
140 | int x, int y, | |
141 | int xsrcMask, int ysrcMask); | |
142 | ||
143 | void DoDrawMonoBitmap(const wxBitmap& bitmap, | |
144 | int bmp_w, int bmp_h, | |
145 | int xsrc, int ysrc, | |
146 | int xdest, int ydest, | |
147 | int width, int height); | |
148 | ||
888dde65 | 149 | DECLARE_ABSTRACT_CLASS(wxWindowDCImpl) |
ec758a20 RR |
150 | }; |
151 | ||
152 | //----------------------------------------------------------------------------- | |
888dde65 | 153 | // wxClientDCImpl |
ec758a20 RR |
154 | //----------------------------------------------------------------------------- |
155 | ||
888dde65 | 156 | class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl |
ec758a20 | 157 | { |
ec758a20 | 158 | public: |
888dde65 RR |
159 | wxClientDCImpl( wxDC *owner ); |
160 | wxClientDCImpl( wxDC *owner, wxWindow *win ); | |
cd9da200 | 161 | |
7b30ac82 VZ |
162 | virtual void DoGetSize(int *width, int *height) const; |
163 | ||
888dde65 | 164 | DECLARE_ABSTRACT_CLASS(wxClientDCImpl) |
c801d85f KB |
165 | }; |
166 | ||
ec758a20 | 167 | //----------------------------------------------------------------------------- |
888dde65 | 168 | // wxPaintDCImpl |
ec758a20 RR |
169 | //----------------------------------------------------------------------------- |
170 | ||
888dde65 | 171 | class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl |
ec758a20 | 172 | { |
ec758a20 | 173 | public: |
888dde65 RR |
174 | wxPaintDCImpl( wxDC *owner ); |
175 | wxPaintDCImpl( wxDC *owner, wxWindow *win ); | |
cd9da200 | 176 | |
888dde65 | 177 | DECLARE_ABSTRACT_CLASS(wxPaintDCImpl) |
ec758a20 RR |
178 | }; |
179 | ||
512cfcc3 | 180 | #endif // _WX_GTKDCCLIENT_H_ |