]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/gtk/dcclient.h |
c801d85f KB |
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 | 13 | #include "wx/gtk/dc.h" |
c801d85f KB |
14 | |
15 | //----------------------------------------------------------------------------- | |
888dde65 | 16 | // wxWindowDCImpl |
c801d85f KB |
17 | //----------------------------------------------------------------------------- |
18 | ||
888dde65 | 19 | class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxGTKDCImpl |
c801d85f | 20 | { |
ec758a20 | 21 | public: |
888dde65 RR |
22 | wxWindowDCImpl( wxDC *owner ); |
23 | wxWindowDCImpl( wxDC *owner, wxWindow *win ); | |
ab171e95 | 24 | |
888dde65 | 25 | virtual ~wxWindowDCImpl(); |
b0e0d661 | 26 | |
b1263dcf WS |
27 | virtual bool CanDrawBitmap() const { return true; } |
28 | virtual bool CanGetTextExtent() const { return true; } | |
b0e0d661 | 29 | |
376aa62a | 30 | virtual void DoGetSize(int *width, int *height) const; |
03647350 | 31 | virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, |
89efaf2b | 32 | wxFloodFillStyle style=wxFLOOD_SURFACE ); |
72cdf4c9 VZ |
33 | virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const; |
34 | ||
35 | virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ); | |
36 | virtual void DoCrossHair( wxCoord x, wxCoord y ); | |
37 | virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, | |
38 | wxCoord xc, wxCoord yc ); | |
39 | virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, | |
b0e0d661 | 40 | double sa, double ea ); |
72cdf4c9 | 41 | virtual void DoDrawPoint( wxCoord x, wxCoord y ); |
b0e0d661 VZ |
42 | |
43 | virtual void DoDrawLines(int n, wxPoint points[], | |
72cdf4c9 | 44 | wxCoord xoffset, wxCoord yoffset); |
b0e0d661 | 45 | virtual void DoDrawPolygon(int n, wxPoint points[], |
72cdf4c9 | 46 | wxCoord xoffset, wxCoord yoffset, |
89efaf2b | 47 | wxPolygonFillMode fillStyle = wxODDEVEN_RULE); |
b0e0d661 | 48 | |
72cdf4c9 VZ |
49 | virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); |
50 | virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 ); | |
51 | virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); | |
b0e0d661 | 52 | |
72cdf4c9 VZ |
53 | virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); |
54 | virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, | |
b1263dcf | 55 | bool useMask = false ); |
b0e0d661 | 56 | |
03647350 | 57 | virtual bool DoBlit( wxCoord xdest, wxCoord ydest, |
89efaf2b | 58 | wxCoord width, wxCoord height, |
72cdf4c9 | 59 | wxDC *source, wxCoord xsrc, wxCoord ysrc, |
03647350 VZ |
60 | wxRasterOperationMode logical_func = wxCOPY, |
61 | bool useMask = false, | |
89efaf2b | 62 | 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, | |
d3b9f782 VZ |
69 | wxCoord *descent = NULL, |
70 | wxCoord *externalLeading = NULL, | |
71 | const wxFont *theFont = 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 ); | |
89efaf2b | 85 | virtual void SetLogicalFunction( wxRasterOperationMode function ); |
b0e0d661 VZ |
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); | |
02cecc4d | 129 | GdkPixmap* MonoToColor(GdkPixmap* monoPixmap, int x, int y, int w, int h) const; |
98d8a7ec | 130 | |
888dde65 | 131 | DECLARE_ABSTRACT_CLASS(wxWindowDCImpl) |
ec758a20 RR |
132 | }; |
133 | ||
134 | //----------------------------------------------------------------------------- | |
888dde65 | 135 | // wxClientDCImpl |
ec758a20 RR |
136 | //----------------------------------------------------------------------------- |
137 | ||
888dde65 | 138 | class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl |
ec758a20 | 139 | { |
ec758a20 | 140 | public: |
888dde65 RR |
141 | wxClientDCImpl( wxDC *owner ); |
142 | wxClientDCImpl( wxDC *owner, wxWindow *win ); | |
cd9da200 | 143 | |
7b30ac82 VZ |
144 | virtual void DoGetSize(int *width, int *height) const; |
145 | ||
888dde65 | 146 | DECLARE_ABSTRACT_CLASS(wxClientDCImpl) |
c801d85f KB |
147 | }; |
148 | ||
ec758a20 | 149 | //----------------------------------------------------------------------------- |
888dde65 | 150 | // wxPaintDCImpl |
ec758a20 RR |
151 | //----------------------------------------------------------------------------- |
152 | ||
888dde65 | 153 | class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl |
ec758a20 | 154 | { |
ec758a20 | 155 | public: |
888dde65 RR |
156 | wxPaintDCImpl( wxDC *owner ); |
157 | wxPaintDCImpl( wxDC *owner, wxWindow *win ); | |
cd9da200 | 158 | |
888dde65 | 159 | DECLARE_ABSTRACT_CLASS(wxPaintDCImpl) |
ec758a20 RR |
160 | }; |
161 | ||
512cfcc3 | 162 | #endif // _WX_GTKDCCLIENT_H_ |