]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dcclient.h
added support for 2 extra mouse buttons (patch 1757630)
[wxWidgets.git] / include / wx / gtk / dcclient.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcclient.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKDCCLIENTH__
11 #define __GTKDCCLIENTH__
12
13 #include "wx/dc.h"
14 #include "wx/region.h"
15
16 class WXDLLIMPEXP_FWD_CORE wxWindow;
17
18 //-----------------------------------------------------------------------------
19 // wxWindowDC
20 //-----------------------------------------------------------------------------
21
22 #if wxUSE_NEW_DC
23 class WXDLLIMPEXP_CORE wxGTKWindowImplDC : public wxGTKImplDC
24 #else
25 #define wxGTKWindowImplDC wxWindowDC
26 class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
27 #endif
28 {
29 public:
30 wxGTKWindowImplDC();
31 wxGTKWindowImplDC( wxWindow *win );
32
33 virtual ~wxGTKWindowImplDC();
34
35 virtual bool CanDrawBitmap() const { return true; }
36 virtual bool CanGetTextExtent() const { return true; }
37
38 protected:
39 virtual void DoGetSize(int *width, int *height) const;
40 virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE );
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,
48 double sa, double ea );
49 virtual void DoDrawPoint( wxCoord x, wxCoord y );
50
51 virtual void DoDrawLines(int n, wxPoint points[],
52 wxCoord xoffset, wxCoord yoffset);
53 virtual void DoDrawPolygon(int n, wxPoint points[],
54 wxCoord xoffset, wxCoord yoffset,
55 int fillStyle = wxODDEVEN_RULE);
56
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 );
60
61 virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
62 virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
63 bool useMask = false );
64
65 virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
66 wxDC *source, wxCoord xsrc, wxCoord ysrc,
67 int logical_func = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 );
68
69 virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y );
70 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
71 double angle);
72 virtual void DoGetTextExtent( const wxString &string,
73 wxCoord *width, wxCoord *height,
74 wxCoord *descent = (wxCoord *) NULL,
75 wxCoord *externalLeading = (wxCoord *) NULL,
76 const wxFont *theFont = (wxFont *) NULL) const;
77 virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
78 virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
79 virtual void DoSetClippingRegionAsRegion( const wxRegion &region );
80
81
82 public:
83 virtual wxCoord GetCharWidth() const;
84 virtual wxCoord GetCharHeight() const;
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
98 virtual void DestroyClippingRegion();
99
100 // Resolution in pixels per logical inch
101 virtual wxSize GetPPI() const;
102 virtual int GetDepth() const;
103
104 // overrriden here for RTL
105 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
106 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
107
108 // protected:
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;
119 bool m_isScreenDC;
120 wxWindow *m_owner;
121 wxRegion m_currentClippingRegion;
122 wxRegion m_paintClippingRegion;
123
124 // PangoContext stuff for GTK 2.0
125 PangoContext *m_context;
126 PangoLayout *m_layout;
127 PangoFontDescription *m_fontdesc;
128
129 void SetUpDC();
130 void Destroy();
131
132 virtual void ComputeScaleAndOrigin();
133
134 virtual GdkWindow *GetGDKWindow() const { return m_window; }
135
136 private:
137 DECLARE_DYNAMIC_CLASS(wxGTKWindowImplDC)
138 };
139
140 //-----------------------------------------------------------------------------
141 // wxClientDC
142 //-----------------------------------------------------------------------------
143
144 #if wxUSE_NEW_DC
145 class WXDLLIMPEXP_CORE wxGTKClientImplDC : public wxGTKWindowImplDC
146 #else
147 #define wxGTKClientImplDC wxClientDC
148 class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
149 #endif
150 {
151 public:
152 wxGTKClientImplDC() { }
153 wxGTKClientImplDC( wxWindow *win );
154
155 protected:
156 virtual void DoGetSize(int *width, int *height) const;
157
158 private:
159 DECLARE_DYNAMIC_CLASS(wxGTKClientImplDC)
160 };
161
162 //-----------------------------------------------------------------------------
163 // wxPaintDC
164 //-----------------------------------------------------------------------------
165
166 #if wxUSE_NEW_DC
167 class WXDLLIMPEXP_CORE wxGTKPaintImplDC : public wxGTKClientImplDC
168 #else
169 #define wxGTKPaintImplDC wxPaintDC
170 class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
171 #endif
172 {
173 public:
174 wxGTKPaintImplDC() { }
175 wxGTKPaintImplDC( wxWindow *win );
176
177 private:
178 DECLARE_DYNAMIC_CLASS(wxGTKPaintImplDC)
179 };
180
181 #endif // __GTKDCCLIENTH__