]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dcclient.h
allow setting empty tooltip in SetIcon() (patch 1750994)
[wxWidgets.git] / include / wx / gtk / dcclient.h
CommitLineData
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
c801d85f
KB
10#ifndef __GTKDCCLIENTH__
11#define __GTKDCCLIENTH__
12
c801d85f 13#include "wx/dc.h"
772b3767 14#include "wx/region.h"
c801d85f 15
b5dbe15d 16class WXDLLIMPEXP_FWD_CORE wxWindow;
c801d85f
KB
17
18//-----------------------------------------------------------------------------
ec758a20 19// wxWindowDC
c801d85f
KB
20//-----------------------------------------------------------------------------
21
2970ae54
RR
22#if wxUSE_NEW_DC
23class WXDLLIMPEXP_CORE wxGTKWindowImplDC : public wxGTKImplDC
24#else
25#define wxGTKWindowImplDC wxWindowDC
20123d49 26class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
2970ae54 27#endif
c801d85f 28{
ec758a20 29public:
2970ae54
RR
30 wxGTKWindowImplDC();
31 wxGTKWindowImplDC( wxWindow *win );
b0e0d661 32
2970ae54 33 virtual ~wxGTKWindowImplDC();
b0e0d661 34
b1263dcf
WS
35 virtual bool CanDrawBitmap() const { return true; }
36 virtual bool CanGetTextExtent() const { return true; }
b0e0d661 37
376aa62a
VZ
38protected:
39 virtual void DoGetSize(int *width, int *height) const;
387ebd3e 40 virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE );
72cdf4c9
VZ
41 virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const;
42
43 virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 );
44 virtual void DoCrossHair( wxCoord x, wxCoord y );
45 virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
46 wxCoord xc, wxCoord yc );
47 virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height,
b0e0d661 48 double sa, double ea );
72cdf4c9 49 virtual void DoDrawPoint( wxCoord x, wxCoord y );
b0e0d661
VZ
50
51 virtual void DoDrawLines(int n, wxPoint points[],
72cdf4c9 52 wxCoord xoffset, wxCoord yoffset);
b0e0d661 53 virtual void DoDrawPolygon(int n, wxPoint points[],
72cdf4c9 54 wxCoord xoffset, wxCoord yoffset,
b0e0d661
VZ
55 int fillStyle = wxODDEVEN_RULE);
56
72cdf4c9
VZ
57 virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
58 virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 );
59 virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
b0e0d661 60
72cdf4c9
VZ
61 virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
62 virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
b1263dcf 63 bool useMask = false );
b0e0d661 64
72cdf4c9
VZ
65 virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
66 wxDC *source, wxCoord xsrc, wxCoord ysrc,
b1263dcf 67 int logical_func = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 );
b0e0d661 68
72cdf4c9 69 virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y );
95724b1a
VZ
70 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
71 double angle);
72cdf4c9
VZ
72 virtual void DoGetTextExtent( const wxString &string,
73 wxCoord *width, wxCoord *height,
74 wxCoord *descent = (wxCoord *) NULL,
75 wxCoord *externalLeading = (wxCoord *) NULL,
c94f845b 76 const wxFont *theFont = (wxFont *) NULL) const;
1f91072f 77 virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
6f02a879
VZ
78 virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
79 virtual void DoSetClippingRegionAsRegion( const wxRegion &region );
376aa62a 80
847dfdb4 81
376aa62a 82public:
72cdf4c9
VZ
83 virtual wxCoord GetCharWidth() const;
84 virtual wxCoord GetCharHeight() const;
b0e0d661
VZ
85
86 virtual void Clear();
87
88 virtual void SetFont( const wxFont &font );
89 virtual void SetPen( const wxPen &pen );
90 virtual void SetBrush( const wxBrush &brush );
91 virtual void SetBackground( const wxBrush &brush );
92 virtual void SetLogicalFunction( int function );
93 virtual void SetTextForeground( const wxColour &col );
94 virtual void SetTextBackground( const wxColour &col );
95 virtual void SetBackgroundMode( int mode );
96 virtual void SetPalette( const wxPalette& palette );
97
b0e0d661 98 virtual void DestroyClippingRegion();
b0e0d661 99
b0e0d661
VZ
100 // Resolution in pixels per logical inch
101 virtual wxSize GetPPI() const;
102 virtual int GetDepth() const;
103
847dfdb4
RR
104 // overrriden here for RTL
105 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
106 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
107
f6f1f4ad 108// protected:
b0e0d661
VZ
109 // implementation
110 // --------------
111
112 GdkWindow *m_window;
113 GdkGC *m_penGC;
114 GdkGC *m_brushGC;
115 GdkGC *m_textGC;
116 GdkGC *m_bgGC;
117 GdkColormap *m_cmap;
118 bool m_isMemDC;
e1208c31 119 bool m_isScreenDC;
b0e0d661 120 wxWindow *m_owner;
3d2d8da1
RR
121 wxRegion m_currentClippingRegion;
122 wxRegion m_paintClippingRegion;
b1263dcf 123
2b5f62a0 124 // PangoContext stuff for GTK 2.0
8943b403 125 PangoContext *m_context;
138618ac 126 PangoLayout *m_layout;
8943b403 127 PangoFontDescription *m_fontdesc;
b0e0d661
VZ
128
129 void SetUpDC();
130 void Destroy();
f6f1f4ad 131
b1263dcf 132 virtual void ComputeScaleAndOrigin();
238d735d 133
eda276b0 134 virtual GdkWindow *GetGDKWindow() const { return m_window; }
cd9da200 135
20e05ffb 136private:
2970ae54 137 DECLARE_DYNAMIC_CLASS(wxGTKWindowImplDC)
ec758a20
RR
138};
139
140//-----------------------------------------------------------------------------
376aa62a 141// wxClientDC
ec758a20
RR
142//-----------------------------------------------------------------------------
143
2970ae54
RR
144#if wxUSE_NEW_DC
145class WXDLLIMPEXP_CORE wxGTKClientImplDC : public wxGTKWindowImplDC
146#else
147#define wxGTKClientImplDC wxClientDC
20123d49 148class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
2970ae54 149#endif
ec758a20 150{
ec758a20 151public:
2970ae54
RR
152 wxGTKClientImplDC() { }
153 wxGTKClientImplDC( wxWindow *win );
cd9da200 154
7b30ac82
VZ
155protected:
156 virtual void DoGetSize(int *width, int *height) const;
157
20e05ffb 158private:
2970ae54 159 DECLARE_DYNAMIC_CLASS(wxGTKClientImplDC)
c801d85f
KB
160};
161
ec758a20 162//-----------------------------------------------------------------------------
376aa62a 163// wxPaintDC
ec758a20
RR
164//-----------------------------------------------------------------------------
165
2970ae54
RR
166#if wxUSE_NEW_DC
167class WXDLLIMPEXP_CORE wxGTKPaintImplDC : public wxGTKClientImplDC
168#else
169#define wxGTKPaintImplDC wxPaintDC
20123d49 170class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
2970ae54 171#endif
ec758a20 172{
ec758a20 173public:
2970ae54
RR
174 wxGTKPaintImplDC() { }
175 wxGTKPaintImplDC( wxWindow *win );
cd9da200 176
20e05ffb 177private:
2970ae54 178 DECLARE_DYNAMIC_CLASS(wxGTKPaintImplDC)
ec758a20
RR
179};
180
c801d85f 181#endif // __GTKDCCLIENTH__