1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/dcclient.h
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"
15 //-----------------------------------------------------------------------------
17 //-----------------------------------------------------------------------------
19 class WXDLLIMPEXP_CORE wxWindowDCImpl
: public wxGTKDCImpl
22 wxWindowDCImpl( wxDC
*owner
);
23 wxWindowDCImpl( wxDC
*owner
, wxWindow
*win
);
25 virtual ~wxWindowDCImpl();
27 virtual bool CanDrawBitmap() const { return true; }
28 virtual bool CanGetTextExtent() const { return true; }
30 virtual void DoGetSize(int *width
, int *height
) const;
31 virtual bool DoFloodFill( wxCoord x
, wxCoord y
, const wxColour
& col
,
32 wxFloodFillStyle style
=wxFLOOD_SURFACE
);
33 virtual bool DoGetPixel( wxCoord x1
, wxCoord y1
, wxColour
*col
) const;
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
,
40 double sa
, double ea
);
41 virtual void DoDrawPoint( wxCoord x
, wxCoord y
);
43 virtual void DoDrawLines(int n
, const wxPoint points
[],
44 wxCoord xoffset
, wxCoord yoffset
);
45 virtual void DoDrawPolygon(int n
, const wxPoint points
[],
46 wxCoord xoffset
, wxCoord yoffset
,
47 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
);
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
);
53 virtual void DoDrawIcon( const wxIcon
&icon
, wxCoord x
, wxCoord y
);
54 virtual void DoDrawBitmap( const wxBitmap
&bitmap
, wxCoord x
, wxCoord y
,
55 bool useMask
= false );
57 virtual bool DoBlit( wxCoord xdest
, wxCoord ydest
,
58 wxCoord width
, wxCoord height
,
59 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
60 wxRasterOperationMode logical_func
= wxCOPY
,
62 wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1 );
64 virtual void DoDrawText( const wxString
&text
, wxCoord x
, wxCoord y
);
65 virtual void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
67 virtual void DoGetTextExtent( const wxString
&string
,
68 wxCoord
*width
, wxCoord
*height
,
69 wxCoord
*descent
= NULL
,
70 wxCoord
*externalLeading
= NULL
,
71 const wxFont
*theFont
= NULL
) const;
72 virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const;
73 virtual void DoSetClippingRegion( wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
74 virtual void DoSetDeviceClippingRegion( const wxRegion
®ion
);
76 virtual wxCoord
GetCharWidth() const;
77 virtual wxCoord
GetCharHeight() const;
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( wxRasterOperationMode 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
);
91 virtual void DestroyClippingRegion();
93 // Resolution in pixels per logical inch
94 virtual wxSize
GetPPI() const;
95 virtual int GetDepth() const;
97 // overrriden here for RTL
98 virtual void SetDeviceOrigin( wxCoord x
, wxCoord y
);
99 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
105 GdkWindow
*m_gdkwindow
;
112 wxRegion m_currentClippingRegion
;
113 wxRegion m_paintClippingRegion
;
115 // PangoContext stuff for GTK 2.0
116 PangoContext
*m_context
;
117 PangoLayout
*m_layout
;
118 PangoFontDescription
*m_fontdesc
;
120 void SetUpDC( bool ismem
= false );
123 virtual void ComputeScaleAndOrigin();
125 virtual GdkWindow
*GetGDKWindow() const { return m_gdkwindow
; }
128 void DrawingSetup(GdkGC
*& gc
, bool& originChanged
);
129 GdkPixmap
* MonoToColor(GdkPixmap
* monoPixmap
, int x
, int y
, int w
, int h
) const;
131 DECLARE_ABSTRACT_CLASS(wxWindowDCImpl
)
134 //-----------------------------------------------------------------------------
136 //-----------------------------------------------------------------------------
138 class WXDLLIMPEXP_CORE wxClientDCImpl
: public wxWindowDCImpl
141 wxClientDCImpl( wxDC
*owner
);
142 wxClientDCImpl( wxDC
*owner
, wxWindow
*win
);
144 virtual void DoGetSize(int *width
, int *height
) const;
146 DECLARE_ABSTRACT_CLASS(wxClientDCImpl
)
149 //-----------------------------------------------------------------------------
151 //-----------------------------------------------------------------------------
153 class WXDLLIMPEXP_CORE wxPaintDCImpl
: public wxClientDCImpl
156 wxPaintDCImpl( wxDC
*owner
);
157 wxPaintDCImpl( wxDC
*owner
, wxWindow
*win
);
159 DECLARE_ABSTRACT_CLASS(wxPaintDCImpl
)
162 #endif // _WX_GTKDCCLIENT_H_