]>
Commit | Line | Data |
---|---|---|
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 | 25 | class WXDLLEXPORT wxWindowDC; |
9b6dbb09 JS |
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 | ||
9b6dbb09 | 31 | //----------------------------------------------------------------------------- |
dfc54541 | 32 | // wxWindowDC |
9b6dbb09 JS |
33 | //----------------------------------------------------------------------------- |
34 | ||
dfc54541 | 35 | class 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 ); |
9b6dbb09 JS |
47 | virtual bool GetPixel( long x1, long y1, wxColour *col ) const; |
48 | ||
49 | virtual void DrawLine( long x1, long y1, long x2, long y2 ); | |
50 | virtual void CrossHair( long x, long y ); | |
51 | virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc ); | |
52 | virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ); | |
53 | virtual void DrawPoint( long x, long y ); | |
54 | ||
55 | virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ); | |
56 | virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); | |
57 | virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, | |
58 | int fillStyle=wxODDEVEN_RULE ); | |
59 | virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, | |
60 | int fillStyle=wxODDEVEN_RULE ); | |
61 | ||
62 | virtual void DrawRectangle( long x, long y, long width, long height ); | |
63 | virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ); | |
64 | virtual void DrawEllipse( long x, long y, long width, long height ); | |
65 | ||
66 | virtual bool CanDrawBitmap(void) const; | |
793f619f | 67 | virtual void DrawIcon( const wxIcon &icon, long x, long y); |
9b6dbb09 JS |
68 | virtual bool Blit( long xdest, long ydest, long width, long height, |
69 | wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE ); | |
70 | ||
71 | virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ); | |
72 | virtual bool CanGetTextExtent(void) const; | |
73 | virtual void GetTextExtent( const wxString &string, long *width, long *height, | |
74 | long *descent = NULL, long *externalLeading = NULL, | |
75 | wxFont *theFont = NULL, bool use16 = FALSE ); | |
76 | virtual long GetCharWidth(void); | |
77 | virtual long GetCharHeight(void); | |
78 | ||
79 | virtual void Clear(void); | |
a367b9b3 | 80 | virtual void Clear(const wxRect& rect); |
9b6dbb09 JS |
81 | |
82 | virtual void SetFont( const wxFont &font ); | |
83 | virtual void SetPen( const wxPen &pen ); | |
84 | virtual void SetBrush( const wxBrush &brush ); | |
85 | virtual void SetBackground( const wxBrush &brush ); | |
86 | virtual void SetLogicalFunction( int function ); | |
87 | virtual void SetTextForeground( const wxColour &col ); | |
88 | virtual void SetTextBackground( const wxColour &col ); | |
89 | virtual void SetBackgroundMode( int mode ); | |
90 | virtual void SetPalette( const wxPalette& palette ); | |
91 | ||
92 | virtual void SetClippingRegion( long x, long y, long width, long height ); | |
a724d789 | 93 | virtual void SetClippingRegion( const wxRegion& region ); |
9b6dbb09 JS |
94 | virtual void DestroyClippingRegion(void); |
95 | ||
dfad0599 | 96 | virtual void DrawSpline( wxList *points ); |
dfc54541 | 97 | |
16c1f7f3 JS |
98 | // Motif-specific |
99 | void SetDCClipping (); // Helper function for setting clipping | |
100 | ||
47bc1060 | 101 | inline WXGC GetGC() const { return m_gc; } |
a4294b78 | 102 | inline WXDisplay* GetDisplay() const { return m_display; } |
47bc1060 JS |
103 | inline bool GetAutoSetting() const { return m_autoSetting; } |
104 | inline void SetAutoSetting(bool flag) { m_autoSetting = flag; } | |
105 | ||
dfc54541 JS |
106 | protected: |
107 | WXGC m_gc; | |
108 | WXGC m_gcBacking; | |
109 | WXDisplay* m_display; | |
110 | wxWindow* m_window; | |
16c1f7f3 JS |
111 | WXRegion m_currentRegion; // Current clipping region (incl. paint clip region) |
112 | WXRegion m_userRegion; // User-defined clipping region | |
113 | WXPixmap m_pixmap; // Pixmap for drawing on | |
dfc54541 JS |
114 | |
115 | // Not sure if we'll need all of these | |
116 | int m_backgroundPixel; | |
117 | wxColour m_currentColour; | |
16c1f7f3 | 118 | // int m_currentBkMode; |
dfc54541 JS |
119 | int m_currentPenWidth ; |
120 | int m_currentPenJoin ; | |
121 | int m_currentPenCap ; | |
122 | int m_currentPenDashCount ; | |
123 | char* m_currentPenDash ; | |
124 | wxBitmap m_currentStipple ; | |
125 | int m_currentStyle ; | |
126 | int m_currentFill ; | |
16c1f7f3 | 127 | int m_autoSetting ; // See comment in dcclient.cpp |
e97f20a0 | 128 | WXFont m_oldFont; |
16c1f7f3 JS |
129 | }; |
130 | ||
131 | class WXDLLEXPORT wxPaintDC: public wxWindowDC | |
132 | { | |
133 | DECLARE_DYNAMIC_CLASS(wxPaintDC) | |
134 | public: | |
135 | wxPaintDC() {} | |
55acd85e JS |
136 | wxPaintDC(wxWindow* win); |
137 | ~wxPaintDC(); | |
16c1f7f3 JS |
138 | }; |
139 | ||
140 | class WXDLLEXPORT wxClientDC: public wxWindowDC | |
141 | { | |
142 | DECLARE_DYNAMIC_CLASS(wxClientDC) | |
143 | public: | |
144 | wxClientDC() {} | |
145 | wxClientDC(wxWindow* win): wxWindowDC(win) {} | |
9b6dbb09 JS |
146 | }; |
147 | ||
148 | #endif | |
149 | // _WX_DCCLIENT_H_ |