]>
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; |
89efaf2b FM |
35 | virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, |
36 | wxFloodFillStyle style=wxFLOOD_SURFACE ); | |
72cdf4c9 VZ |
37 | virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const; |
38 | ||
39 | virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ); | |
40 | virtual void DoCrossHair( wxCoord x, wxCoord y ); | |
41 | virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, | |
42 | wxCoord xc, wxCoord yc ); | |
43 | virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, | |
b0e0d661 | 44 | double sa, double ea ); |
72cdf4c9 | 45 | virtual void DoDrawPoint( wxCoord x, wxCoord y ); |
b0e0d661 VZ |
46 | |
47 | virtual void DoDrawLines(int n, wxPoint points[], | |
72cdf4c9 | 48 | wxCoord xoffset, wxCoord yoffset); |
b0e0d661 | 49 | virtual void DoDrawPolygon(int n, wxPoint points[], |
72cdf4c9 | 50 | wxCoord xoffset, wxCoord yoffset, |
89efaf2b | 51 | wxPolygonFillMode fillStyle = wxODDEVEN_RULE); |
b0e0d661 | 52 | |
72cdf4c9 VZ |
53 | virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); |
54 | virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 ); | |
55 | virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); | |
b0e0d661 | 56 | |
72cdf4c9 VZ |
57 | virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); |
58 | virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, | |
b1263dcf | 59 | bool useMask = false ); |
b0e0d661 | 60 | |
89efaf2b FM |
61 | virtual bool DoBlit( wxCoord xdest, wxCoord ydest, |
62 | wxCoord width, wxCoord height, | |
72cdf4c9 | 63 | wxDC *source, wxCoord xsrc, wxCoord ysrc, |
89efaf2b FM |
64 | wxRasterOperationMode logical_func = wxCOPY, |
65 | bool useMask = false, | |
66 | wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ); | |
b0e0d661 | 67 | |
72cdf4c9 | 68 | virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ); |
95724b1a VZ |
69 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, |
70 | double angle); | |
72cdf4c9 VZ |
71 | virtual void DoGetTextExtent( const wxString &string, |
72 | wxCoord *width, wxCoord *height, | |
73 | wxCoord *descent = (wxCoord *) NULL, | |
74 | wxCoord *externalLeading = (wxCoord *) NULL, | |
c94f845b | 75 | const wxFont *theFont = (wxFont *) NULL) const; |
1f91072f | 76 | virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; |
6f02a879 | 77 | virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); |
fdaad94e | 78 | virtual void DoSetDeviceClippingRegion( const wxRegion ®ion ); |
376aa62a | 79 | |
72cdf4c9 VZ |
80 | virtual wxCoord GetCharWidth() const; |
81 | virtual wxCoord GetCharHeight() const; | |
b0e0d661 VZ |
82 | |
83 | virtual void Clear(); | |
84 | ||
85 | virtual void SetFont( const wxFont &font ); | |
86 | virtual void SetPen( const wxPen &pen ); | |
87 | virtual void SetBrush( const wxBrush &brush ); | |
88 | virtual void SetBackground( const wxBrush &brush ); | |
89efaf2b | 89 | virtual void SetLogicalFunction( wxRasterOperationMode function ); |
b0e0d661 VZ |
90 | virtual void SetTextForeground( const wxColour &col ); |
91 | virtual void SetTextBackground( const wxColour &col ); | |
92 | virtual void SetBackgroundMode( int mode ); | |
93 | virtual void SetPalette( const wxPalette& palette ); | |
94 | ||
b0e0d661 | 95 | virtual void DestroyClippingRegion(); |
b0e0d661 | 96 | |
b0e0d661 VZ |
97 | // Resolution in pixels per logical inch |
98 | virtual wxSize GetPPI() const; | |
99 | virtual int GetDepth() const; | |
100 | ||
847dfdb4 RR |
101 | // overrriden here for RTL |
102 | virtual void SetDeviceOrigin( wxCoord x, wxCoord y ); | |
103 | virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); | |
104 | ||
f6f1f4ad | 105 | // protected: |
b0e0d661 VZ |
106 | // implementation |
107 | // -------------- | |
108 | ||
888dde65 | 109 | GdkWindow *m_gdkwindow; |
b0e0d661 VZ |
110 | GdkGC *m_penGC; |
111 | GdkGC *m_brushGC; | |
112 | GdkGC *m_textGC; | |
113 | GdkGC *m_bgGC; | |
114 | GdkColormap *m_cmap; | |
e1208c31 | 115 | bool m_isScreenDC; |
3d2d8da1 RR |
116 | wxRegion m_currentClippingRegion; |
117 | wxRegion m_paintClippingRegion; | |
b1263dcf | 118 | |
2b5f62a0 | 119 | // PangoContext stuff for GTK 2.0 |
8943b403 | 120 | PangoContext *m_context; |
138618ac | 121 | PangoLayout *m_layout; |
8943b403 | 122 | PangoFontDescription *m_fontdesc; |
b0e0d661 | 123 | |
ab171e95 | 124 | void SetUpDC( bool ismem = false ); |
b0e0d661 | 125 | void Destroy(); |
98d8a7ec | 126 | |
b1263dcf | 127 | virtual void ComputeScaleAndOrigin(); |
238d735d | 128 | |
888dde65 | 129 | virtual GdkWindow *GetGDKWindow() const { return m_gdkwindow; } |
cd9da200 | 130 | |
ea3a345f PC |
131 | private: |
132 | void DrawingSetup(GdkGC*& gc, bool& originChanged); | |
02cecc4d | 133 | GdkPixmap* MonoToColor(GdkPixmap* monoPixmap, int x, int y, int w, int h) const; |
98d8a7ec | 134 | |
888dde65 | 135 | DECLARE_ABSTRACT_CLASS(wxWindowDCImpl) |
ec758a20 RR |
136 | }; |
137 | ||
138 | //----------------------------------------------------------------------------- | |
888dde65 | 139 | // wxClientDCImpl |
ec758a20 RR |
140 | //----------------------------------------------------------------------------- |
141 | ||
888dde65 | 142 | class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl |
ec758a20 | 143 | { |
ec758a20 | 144 | public: |
888dde65 RR |
145 | wxClientDCImpl( wxDC *owner ); |
146 | wxClientDCImpl( wxDC *owner, wxWindow *win ); | |
cd9da200 | 147 | |
7b30ac82 VZ |
148 | virtual void DoGetSize(int *width, int *height) const; |
149 | ||
888dde65 | 150 | DECLARE_ABSTRACT_CLASS(wxClientDCImpl) |
c801d85f KB |
151 | }; |
152 | ||
ec758a20 | 153 | //----------------------------------------------------------------------------- |
888dde65 | 154 | // wxPaintDCImpl |
ec758a20 RR |
155 | //----------------------------------------------------------------------------- |
156 | ||
888dde65 | 157 | class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl |
ec758a20 | 158 | { |
ec758a20 | 159 | public: |
888dde65 RR |
160 | wxPaintDCImpl( wxDC *owner ); |
161 | wxPaintDCImpl( wxDC *owner, wxWindow *win ); | |
cd9da200 | 162 | |
888dde65 | 163 | DECLARE_ABSTRACT_CLASS(wxPaintDCImpl) |
ec758a20 RR |
164 | }; |
165 | ||
512cfcc3 | 166 | #endif // _WX_GTKDCCLIENT_H_ |