]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/dcclient.h
some very minor fixes (I don't even remember what exactly)
[wxWidgets.git] / include / wx / motif / dcclient.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcclient.h
3 // Purpose: wxClientDC, wxPaintDC and wxWindowDC classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DCCLIENT_H_
13 #define _WX_DCCLIENT_H_
14
15 #ifdef __GNUG__
16 #pragma interface "dcclient.h"
17 #endif
18
19 #include "wx/dc.h"
20
21 //-----------------------------------------------------------------------------
22 // classes
23 //-----------------------------------------------------------------------------
24
25 class WXDLLEXPORT wxWindowDC;
26 class WXDLLEXPORT wxWindow;
27
28 // Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented differently.
29 // On many platforms, however, they will be the same.
30
31 //-----------------------------------------------------------------------------
32 // wxWindowDC
33 //-----------------------------------------------------------------------------
34
35 class WXDLLEXPORT wxWindowDC: public wxDC
36 {
37 DECLARE_DYNAMIC_CLASS(wxWindowDC)
38
39 public:
40
41 wxWindowDC(void);
42 wxWindowDC( wxWindow *win );
43
44 ~wxWindowDC(void);
45
46 virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE );
47 inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
48 {
49 FloodFill(pt.x, pt.y, col, style);
50 }
51
52 virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
53 inline bool GetPixel(const wxPoint& pt, wxColour *col) const
54 {
55 return GetPixel(pt.x, pt.y, col);
56 }
57
58 virtual void DrawLine( long x1, long y1, long x2, long y2 );
59 inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
60 {
61 DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
62 }
63
64 virtual void CrossHair( long x, long y );
65 inline void CrossHair(const wxPoint& pt)
66 {
67 CrossHair(pt.x, pt.y);
68 }
69
70 virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
71 inline void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
72 {
73 DrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y);
74 }
75
76 virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
77 virtual void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea)
78 {
79 DrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea);
80 }
81
82 virtual void DrawPoint( long x, long y );
83 inline void DrawPoint( wxPoint& point )
84 { DrawPoint(point.x, point.y); }
85
86 virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 );
87 virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
88 virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
89 int fillStyle=wxODDEVEN_RULE );
90 virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
91 int fillStyle=wxODDEVEN_RULE );
92
93 virtual void DrawRectangle( long x, long y, long width, long height );
94 inline void DrawRectangle(const wxPoint& pt, const wxSize& sz)
95 {
96 DrawRectangle(pt.x, pt.y, sz.x, sz.y);
97 }
98 inline void DrawRectangle(const wxRect& rect)
99 {
100 DrawRectangle(rect.x, rect.y, rect.width, rect.height);
101 }
102
103 virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
104 inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0)
105 {
106 DrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius);
107 }
108 inline void DrawRoundedRectangle(const wxRect& rect, double radius = 20.0)
109 {
110 DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, radius);
111 }
112
113 virtual void DrawEllipse( long x, long y, long width, long height );
114 inline void DrawEllipse(const wxPoint& pt, const wxSize& sz)
115 {
116 DrawEllipse(pt.x, pt.y, sz.x, sz.y);
117 }
118 inline void DrawEllipse(const wxRect& rect)
119 {
120 DrawEllipse(rect.x, rect.y, rect.width, rect.height);
121 }
122
123 virtual bool CanDrawBitmap(void) const;
124
125 virtual void DrawIcon( const wxIcon &icon, long x, long y);
126 inline void DrawIcon(const wxIcon& icon, const wxPoint& pt)
127 {
128 DrawIcon(icon, pt.x, pt.y);
129 }
130
131 virtual bool Blit( long xdest, long ydest, long width, long height,
132 wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
133 inline bool Blit(const wxPoint& destPt, const wxSize& sz,
134 wxDC *source, const wxPoint& srcPt, int rop = wxCOPY, bool useMask = FALSE)
135 {
136 return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask);
137 }
138
139 virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
140 inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE)
141 {
142 DrawText(text, pt.x, pt.y, use16bit);
143 }
144
145 virtual bool CanGetTextExtent(void) const;
146 virtual void GetTextExtent( const wxString &string, long *width, long *height,
147 long *descent = NULL, long *externalLeading = NULL,
148 wxFont *theFont = NULL, bool use16 = FALSE );
149 virtual long GetCharWidth(void);
150 virtual long GetCharHeight(void);
151
152 virtual void Clear(void);
153 virtual void Clear(const wxRect& rect);
154
155 virtual void SetFont( const wxFont &font );
156 virtual void SetPen( const wxPen &pen );
157 virtual void SetBrush( const wxBrush &brush );
158 virtual void SetBackground( const wxBrush &brush );
159 virtual void SetLogicalFunction( int function );
160 virtual void SetTextForeground( const wxColour &col );
161 virtual void SetTextBackground( const wxColour &col );
162 virtual void SetBackgroundMode( int mode );
163 virtual void SetPalette( const wxPalette& palette );
164
165 virtual void SetClippingRegion( long x, long y, long width, long height );
166 virtual void SetClippingRegion( const wxRegion& region );
167 virtual void DestroyClippingRegion(void);
168
169 virtual void DrawSpline( wxList *points );
170 virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
171 { wxDC::DrawSpline(x1, y1, x2, y2, x3, y3); }
172 virtual void DrawSpline( int n, wxPoint points[] )
173 { wxDC::DrawSpline(n, points); }
174
175 // Motif-specific
176 void SetDCClipping (); // Helper function for setting clipping
177
178 inline WXGC GetGC() const { return m_gc; }
179 inline WXGC GetBackingGC() const { return m_gcBacking; }
180 inline WXDisplay* GetDisplay() const { return m_display; }
181 inline bool GetAutoSetting() const { return m_autoSetting; }
182 inline void SetAutoSetting(bool flag) { m_autoSetting = flag; }
183
184 protected:
185 WXGC m_gc;
186 WXGC m_gcBacking;
187 WXDisplay* m_display;
188 wxWindow* m_window;
189 WXRegion m_currentRegion; // Current clipping region (incl. paint clip region)
190 WXRegion m_userRegion; // User-defined clipping region
191 WXPixmap m_pixmap; // Pixmap for drawing on
192
193 // Not sure if we'll need all of these
194 int m_backgroundPixel;
195 wxColour m_currentColour;
196 // int m_currentBkMode;
197 int m_currentPenWidth ;
198 int m_currentPenJoin ;
199 int m_currentPenCap ;
200 int m_currentPenDashCount ;
201 char* m_currentPenDash ;
202 wxBitmap m_currentStipple ;
203 int m_currentStyle ;
204 int m_currentFill ;
205 int m_autoSetting ; // See comment in dcclient.cpp
206 WXFont m_oldFont;
207 };
208
209 class WXDLLEXPORT wxPaintDC: public wxWindowDC
210 {
211 DECLARE_DYNAMIC_CLASS(wxPaintDC)
212 public:
213 wxPaintDC() {}
214 wxPaintDC(wxWindow* win);
215 ~wxPaintDC();
216 };
217
218 class WXDLLEXPORT wxClientDC: public wxWindowDC
219 {
220 DECLARE_DYNAMIC_CLASS(wxClientDC)
221 public:
222 wxClientDC() {}
223 wxClientDC(wxWindow* win): wxWindowDC(win) {}
224 };
225
226 #endif
227 // _WX_DCCLIENT_H_