1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/dcclient.h
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef _WX_GTKDCCLIENT_H_
10 #define _WX_GTKDCCLIENT_H_
12 #include "wx/gtk/dc.h"
14 //-----------------------------------------------------------------------------
16 //-----------------------------------------------------------------------------
18 class WXDLLIMPEXP_CORE wxWindowDCImpl
: public wxGTKDCImpl
21 wxWindowDCImpl( wxDC
*owner
);
22 wxWindowDCImpl( wxDC
*owner
, wxWindow
*win
);
24 virtual ~wxWindowDCImpl();
26 virtual bool CanDrawBitmap() const { return true; }
27 virtual bool CanGetTextExtent() const { return true; }
29 virtual void DoGetSize(int *width
, int *height
) const;
30 virtual bool DoFloodFill( wxCoord x
, wxCoord y
, const wxColour
& col
,
31 wxFloodFillStyle style
=wxFLOOD_SURFACE
);
32 virtual bool DoGetPixel( wxCoord x1
, wxCoord y1
, wxColour
*col
) const;
34 virtual void DoDrawLine( wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
35 virtual void DoCrossHair( wxCoord x
, wxCoord y
);
36 virtual void DoDrawArc( wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
,
37 wxCoord xc
, wxCoord yc
);
38 virtual void DoDrawEllipticArc( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
,
39 double sa
, double ea
);
40 virtual void DoDrawPoint( wxCoord x
, wxCoord y
);
42 virtual void DoDrawLines(int n
, const wxPoint points
[],
43 wxCoord xoffset
, wxCoord yoffset
);
44 virtual void DoDrawPolygon(int n
, const wxPoint points
[],
45 wxCoord xoffset
, wxCoord yoffset
,
46 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
);
48 virtual void DoDrawRectangle( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
49 virtual void DoDrawRoundedRectangle( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
= 20.0 );
50 virtual void DoDrawEllipse( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
52 virtual void DoDrawIcon( const wxIcon
&icon
, wxCoord x
, wxCoord y
);
53 virtual void DoDrawBitmap( const wxBitmap
&bitmap
, wxCoord x
, wxCoord y
,
54 bool useMask
= false );
56 virtual bool DoBlit( wxCoord xdest
, wxCoord ydest
,
57 wxCoord width
, wxCoord height
,
58 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
59 wxRasterOperationMode logical_func
= wxCOPY
,
61 wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1 );
63 virtual void DoDrawText( const wxString
&text
, wxCoord x
, wxCoord y
);
64 virtual void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
66 virtual void DoGetTextExtent( const wxString
&string
,
67 wxCoord
*width
, wxCoord
*height
,
68 wxCoord
*descent
= NULL
,
69 wxCoord
*externalLeading
= NULL
,
70 const wxFont
*theFont
= NULL
) const;
71 virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const;
72 virtual void DoSetClippingRegion( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
73 virtual void DoSetDeviceClippingRegion( const wxRegion
®ion
);
75 virtual wxCoord
GetCharWidth() const;
76 virtual wxCoord
GetCharHeight() const;
80 virtual void SetFont( const wxFont
&font
);
81 virtual void SetPen( const wxPen
&pen
);
82 virtual void SetBrush( const wxBrush
&brush
);
83 virtual void SetBackground( const wxBrush
&brush
);
84 virtual void SetLogicalFunction( wxRasterOperationMode function
);
85 virtual void SetTextForeground( const wxColour
&col
);
86 virtual void SetTextBackground( const wxColour
&col
);
87 virtual void SetBackgroundMode( int mode
);
88 virtual void SetPalette( const wxPalette
& palette
);
90 virtual void DestroyClippingRegion();
92 // Resolution in pixels per logical inch
93 virtual wxSize
GetPPI() const;
94 virtual int GetDepth() const;
96 // overrriden here for RTL
97 virtual void SetDeviceOrigin( wxCoord x
, wxCoord y
);
98 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
104 GdkWindow
*m_gdkwindow
;
111 wxRegion m_currentClippingRegion
;
112 wxRegion m_paintClippingRegion
;
114 // PangoContext stuff for GTK 2.0
115 PangoContext
*m_context
;
116 PangoLayout
*m_layout
;
117 PangoFontDescription
*m_fontdesc
;
119 void SetUpDC( bool ismem
= false );
122 virtual void ComputeScaleAndOrigin();
124 virtual GdkWindow
*GetGDKWindow() const { return m_gdkwindow
; }
127 void DrawingSetup(GdkGC
*& gc
, bool& originChanged
);
128 GdkPixmap
* MonoToColor(GdkPixmap
* monoPixmap
, int x
, int y
, int w
, int h
) const;
130 DECLARE_ABSTRACT_CLASS(wxWindowDCImpl
)
133 //-----------------------------------------------------------------------------
135 //-----------------------------------------------------------------------------
137 class WXDLLIMPEXP_CORE wxClientDCImpl
: public wxWindowDCImpl
140 wxClientDCImpl( wxDC
*owner
);
141 wxClientDCImpl( wxDC
*owner
, wxWindow
*win
);
143 virtual void DoGetSize(int *width
, int *height
) const;
145 DECLARE_ABSTRACT_CLASS(wxClientDCImpl
)
148 //-----------------------------------------------------------------------------
150 //-----------------------------------------------------------------------------
152 class WXDLLIMPEXP_CORE wxPaintDCImpl
: public wxClientDCImpl
155 wxPaintDCImpl( wxDC
*owner
);
156 wxPaintDCImpl( wxDC
*owner
, wxWindow
*win
);
158 DECLARE_ABSTRACT_CLASS(wxPaintDCImpl
)
161 #endif // _WX_GTKDCCLIENT_H_