]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/dcclient.h
1. wxMSW seems to work (please test and send your bug reports!)
[wxWidgets.git] / include / wx / motif / dcclient.h
CommitLineData
9b6dbb09
JS
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
dfc54541 25class WXDLLEXPORT wxWindowDC;
9b6dbb09
JS
26class WXDLLEXPORT wxWindow;
27
28// Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented differently.
29// On many platforms, however, they will be the same.
30
9b6dbb09 31//-----------------------------------------------------------------------------
dfc54541 32// wxWindowDC
9b6dbb09
JS
33//-----------------------------------------------------------------------------
34
dfc54541 35class WXDLLEXPORT wxWindowDC: public wxDC
9b6dbb09 36{
dfc54541 37 DECLARE_DYNAMIC_CLASS(wxWindowDC)
9b6dbb09
JS
38
39 public:
40
dfc54541
JS
41 wxWindowDC(void);
42 wxWindowDC( wxWindow *win );
9b6dbb09 43
dfc54541 44 ~wxWindowDC(void);
9b6dbb09 45
a367b9b3 46 virtual void FloodFill( long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE );
c330a2cf
JS
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
9b6dbb09 52 virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
c330a2cf
JS
53 inline bool GetPixel(const wxPoint& pt, wxColour *col) const
54 {
55 return GetPixel(pt.x, pt.y, col);
56 }
9b6dbb09
JS
57
58 virtual void DrawLine( long x1, long y1, long x2, long y2 );
c330a2cf
JS
59 inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
60 {
61 DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
62 }
63
9b6dbb09 64 virtual void CrossHair( long x, long y );
c330a2cf
JS
65 inline void CrossHair(const wxPoint& pt)
66 {
67 CrossHair(pt.x, pt.y);
68 }
69
9b6dbb09 70 virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
c330a2cf
JS
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
9b6dbb09 76 virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
c330a2cf
JS
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
9b6dbb09 82 virtual void DrawPoint( long x, long y );
c330a2cf
JS
83 inline void DrawPoint( wxPoint& point )
84 { DrawPoint(point.x, point.y); }
9b6dbb09
JS
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 );
c330a2cf
JS
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
9b6dbb09 103 virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
c330a2cf
JS
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
9b6dbb09 113 virtual void DrawEllipse( long x, long y, long width, long height );
c330a2cf
JS
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 }
9b6dbb09
JS
122
123 virtual bool CanDrawBitmap(void) const;
c330a2cf 124
793f619f 125 virtual void DrawIcon( const wxIcon &icon, long x, long y);
c330a2cf
JS
126 inline void DrawIcon(const wxIcon& icon, const wxPoint& pt)
127 {
128 DrawIcon(icon, pt.x, pt.y);
129 }
130
9b6dbb09
JS
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 );
c330a2cf
JS
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 }
9b6dbb09
JS
138
139 virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
c330a2cf
JS
140 inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE)
141 {
142 DrawText(text, pt.x, pt.y, use16bit);
143 }
144
9b6dbb09
JS
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);
a367b9b3 153 virtual void Clear(const wxRect& rect);
9b6dbb09
JS
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 );
a724d789 166 virtual void SetClippingRegion( const wxRegion& region );
9b6dbb09
JS
167 virtual void DestroyClippingRegion(void);
168
dfad0599 169 virtual void DrawSpline( wxList *points );
c330a2cf
JS
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); }
dfc54541 174
7bcb11d3
JS
175 // Resolution in pixels per logical inch
176 wxSize GetPPI(void) const;
177
16c1f7f3
JS
178 // Motif-specific
179 void SetDCClipping (); // Helper function for setting clipping
180
47bc1060 181 inline WXGC GetGC() const { return m_gc; }
a91b47e8 182 inline WXGC GetBackingGC() const { return m_gcBacking; }
a4294b78 183 inline WXDisplay* GetDisplay() const { return m_display; }
47bc1060
JS
184 inline bool GetAutoSetting() const { return m_autoSetting; }
185 inline void SetAutoSetting(bool flag) { m_autoSetting = flag; }
186
dfc54541
JS
187protected:
188 WXGC m_gc;
189 WXGC m_gcBacking;
190 WXDisplay* m_display;
191 wxWindow* m_window;
16c1f7f3
JS
192 WXRegion m_currentRegion; // Current clipping region (incl. paint clip region)
193 WXRegion m_userRegion; // User-defined clipping region
194 WXPixmap m_pixmap; // Pixmap for drawing on
dfc54541
JS
195
196 // Not sure if we'll need all of these
197 int m_backgroundPixel;
198 wxColour m_currentColour;
16c1f7f3 199// int m_currentBkMode;
dfc54541
JS
200 int m_currentPenWidth ;
201 int m_currentPenJoin ;
202 int m_currentPenCap ;
203 int m_currentPenDashCount ;
204 char* m_currentPenDash ;
205 wxBitmap m_currentStipple ;
206 int m_currentStyle ;
207 int m_currentFill ;
16c1f7f3 208 int m_autoSetting ; // See comment in dcclient.cpp
e97f20a0 209 WXFont m_oldFont;
16c1f7f3
JS
210};
211
212class WXDLLEXPORT wxPaintDC: public wxWindowDC
213{
214 DECLARE_DYNAMIC_CLASS(wxPaintDC)
215public:
216 wxPaintDC() {}
55acd85e
JS
217 wxPaintDC(wxWindow* win);
218 ~wxPaintDC();
16c1f7f3
JS
219};
220
221class WXDLLEXPORT wxClientDC: public wxWindowDC
222{
223 DECLARE_DYNAMIC_CLASS(wxClientDC)
224public:
225 wxClientDC() {}
226 wxClientDC(wxWindow* win): wxWindowDC(win) {}
9b6dbb09
JS
227};
228
229#endif
230 // _WX_DCCLIENT_H_