1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_GTKDCCLIENT_H_
11 #define _WX_GTKDCCLIENT_H_
13 #include "wx/gtk/dc.h"
14 #include "wx/dcclient.h"
15 #include "wx/region.h"
17 class WXDLLIMPEXP_FWD_CORE wxWindow
;
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 class WXDLLIMPEXP_CORE wxWindowDCImpl
: public wxGTKDCImpl
26 wxWindowDCImpl( wxDC
*owner
);
27 wxWindowDCImpl( wxDC
*owner
, wxWindow
*win
);
29 virtual ~wxWindowDCImpl();
31 #if wxUSE_GRAPHICS_CONTEXT
32 virtual wxGraphicsContext
* CreateGraphicsContext();
35 virtual bool CanDrawBitmap() const { return true; }
36 virtual bool CanGetTextExtent() const { return true; }
38 virtual void DoGetSize(int *width
, int *height
) const;
39 virtual bool DoFloodFill( wxCoord x
, wxCoord y
, const wxColour
& col
, int style
=wxFLOOD_SURFACE
);
40 virtual bool DoGetPixel( wxCoord x1
, wxCoord y1
, wxColour
*col
) const;
42 virtual void DoDrawLine( wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
43 virtual void DoCrossHair( wxCoord x
, wxCoord y
);
44 virtual void DoDrawArc( wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
,
45 wxCoord xc
, wxCoord yc
);
46 virtual void DoDrawEllipticArc( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
,
47 double sa
, double ea
);
48 virtual void DoDrawPoint( wxCoord x
, wxCoord y
);
50 virtual void DoDrawLines(int n
, wxPoint points
[],
51 wxCoord xoffset
, wxCoord yoffset
);
52 virtual void DoDrawPolygon(int n
, wxPoint points
[],
53 wxCoord xoffset
, wxCoord yoffset
,
54 int fillStyle
= wxODDEVEN_RULE
);
56 virtual void DoDrawRectangle( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
57 virtual void DoDrawRoundedRectangle( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20.0 );
58 virtual void DoDrawEllipse( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
60 virtual void DoDrawIcon( const wxIcon
&icon
, wxCoord x
, wxCoord y
);
61 virtual void DoDrawBitmap( const wxBitmap
&bitmap
, wxCoord x
, wxCoord y
,
62 bool useMask
= false );
64 virtual bool DoBlit( wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
65 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
66 int logical_func
= wxCOPY
, bool useMask
= false, wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1 );
68 virtual void DoDrawText( const wxString
&text
, wxCoord x
, wxCoord y
);
69 virtual void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
71 virtual void DoGetTextExtent( const wxString
&string
,
72 wxCoord
*width
, wxCoord
*height
,
73 wxCoord
*descent
= (wxCoord
*) NULL
,
74 wxCoord
*externalLeading
= (wxCoord
*) NULL
,
75 const wxFont
*theFont
= (wxFont
*) NULL
) const;
76 virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const;
77 virtual void DoSetClippingRegion( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
78 virtual void DoSetClippingRegionAsRegion( const wxRegion
®ion
);
80 virtual wxCoord
GetCharWidth() const;
81 virtual wxCoord
GetCharHeight() const;
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
);
89 virtual void SetLogicalFunction( int function
);
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
);
95 virtual void DestroyClippingRegion();
97 // Resolution in pixels per logical inch
98 virtual wxSize
GetPPI() const;
99 virtual int GetDepth() const;
101 // overrriden here for RTL
102 virtual void SetDeviceOrigin( wxCoord x
, wxCoord y
);
103 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
109 GdkWindow
*m_gdkwindow
;
116 wxRegion m_currentClippingRegion
;
117 wxRegion m_paintClippingRegion
;
119 // PangoContext stuff for GTK 2.0
120 PangoContext
*m_context
;
121 PangoLayout
*m_layout
;
122 PangoFontDescription
*m_fontdesc
;
124 void SetUpDC( bool ismem
= false );
127 virtual void ComputeScaleAndOrigin();
129 virtual GdkWindow
*GetGDKWindow() const { return m_gdkwindow
; }
132 void DrawingSetup(GdkGC
*& gc
, bool& originChanged
);
134 DECLARE_ABSTRACT_CLASS(wxWindowDCImpl
)
137 //-----------------------------------------------------------------------------
139 //-----------------------------------------------------------------------------
141 class WXDLLIMPEXP_CORE wxClientDCImpl
: public wxWindowDCImpl
144 wxClientDCImpl( wxDC
*owner
);
145 wxClientDCImpl( wxDC
*owner
, wxWindow
*win
);
147 virtual void DoGetSize(int *width
, int *height
) const;
149 DECLARE_ABSTRACT_CLASS(wxClientDCImpl
)
152 //-----------------------------------------------------------------------------
154 //-----------------------------------------------------------------------------
156 class WXDLLIMPEXP_CORE wxPaintDCImpl
: public wxClientDCImpl
159 wxPaintDCImpl( wxDC
*owner
);
160 wxPaintDCImpl( wxDC
*owner
, wxWindow
*win
);
162 DECLARE_ABSTRACT_CLASS(wxPaintDCImpl
)
165 #endif // _WX_GTKDCCLIENT_H_