1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxClientDC, wxPaintDC and wxWindowDC classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DCCLIENT_H_
13 #define _WX_DCCLIENT_H_
16 #pragma interface "dcclient.h"
21 // -----------------------------------------------------------------------------
23 // -----------------------------------------------------------------------------
25 class WXDLLEXPORT wxWindowDC
;
26 class WXDLLEXPORT wxWindow
;
28 // Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented
29 // differently. On many platforms, however, they will be the same.
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 class WXDLLEXPORT wxWindowDC
: public wxDC
37 DECLARE_DYNAMIC_CLASS(wxWindowDC
)
41 wxWindowDC( wxWindow
*win
);
45 // TODO this function is Motif-only for now - should it go into base class?
46 void Clear(const wxRect
& rect
);
48 // implement base class pure virtuals
49 // ----------------------------------
53 virtual void SetFont(const wxFont
& font
);
54 virtual void SetPen(const wxPen
& pen
);
55 virtual void SetBrush(const wxBrush
& brush
);
56 virtual void SetBackground(const wxBrush
& brush
);
57 virtual void SetBackgroundMode(int mode
);
58 virtual void SetPalette(const wxPalette
& palette
);
59 virtual void SetLogicalFunction( int function
);
61 virtual void SetTextForeground(const wxColour
& colour
);
62 virtual void SetTextBackground(const wxColour
& colour
);
64 virtual long GetCharHeight() const;
65 virtual long GetCharWidth() const;
66 virtual void GetTextExtent(const wxString
& string
,
69 long *externalLeading
= NULL
,
70 wxFont
*theFont
= NULL
) const;
72 virtual bool CanDrawBitmap() const;
73 virtual bool CanGetTextExtent() const;
75 virtual int GetDepth() const;
76 virtual wxSize
GetPPI() const;
78 virtual void DestroyClippingRegion();
80 // Helper function for setting clipping
83 // implementation from now on
84 // --------------------------
86 WXGC
GetGC() const { return m_gc
; }
87 WXGC
GetBackingGC() const { return m_gcBacking
; }
88 WXDisplay
* GetDisplay() const { return m_display
; }
89 bool GetAutoSetting() const { return m_autoSetting
; }
90 void SetAutoSetting(bool flag
) { m_autoSetting
= flag
; }
93 virtual void DoFloodFill(long x
, long y
, const wxColour
& col
,
94 int style
= wxFLOOD_SURFACE
);
96 virtual bool DoGetPixel(long x
, long y
, wxColour
*col
) const;
98 virtual void DoDrawPoint(long x
, long y
);
99 virtual void DoDrawLine(long x1
, long y1
, long x2
, long y2
);
101 virtual void DoDrawArc(long x1
, long y1
,
104 virtual void DoDrawEllipticArc(long x
, long y
, long w
, long h
,
105 double sa
, double ea
);
107 virtual void DoDrawRectangle(long x
, long y
, long width
, long height
);
108 virtual void DoDrawRoundedRectangle(long x
, long y
,
109 long width
, long height
,
111 virtual void DoDrawEllipse(long x
, long y
, long width
, long height
);
113 virtual void DoCrossHair(long x
, long y
);
115 virtual void DoDrawText(const wxString
& text
, long x
, long y
);
117 virtual bool DoBlit(long xdest
, long ydest
, long width
, long height
,
118 wxDC
*source
, long xsrc
, long ysrc
,
119 int rop
= wxCOPY
, bool useMask
= FALSE
);
121 virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
);
122 virtual void DoSetClippingRegion(long x
, long y
,
123 long width
, long height
);
125 virtual void DoDrawLines(int n
, wxPoint points
[],
126 long xoffset
, long yoffset
);
127 virtual void DoDrawPolygon(int n
, wxPoint points
[],
128 long xoffset
, long yoffset
,
129 int fillStyle
= wxODDEVEN_RULE
);
132 virtual void DoDrawSpline(wxList
*points
);
133 #endif // wxUSE_SPLINES
137 WXDisplay
* m_display
;
139 WXRegion m_currentRegion
; // Current clipping region (incl. paint clip region)
140 WXRegion m_userRegion
; // User-defined clipping region
141 WXPixmap m_pixmap
; // Pixmap for drawing on
143 // Not sure if we'll need all of these
144 int m_backgroundPixel
;
145 wxColour m_currentColour
;
146 // int m_currentBkMode;
147 int m_currentPenWidth
;
148 int m_currentPenJoin
;
149 int m_currentPenCap
;
150 int m_currentPenDashCount
;
151 char* m_currentPenDash
;
152 wxBitmap m_currentStipple
;
155 int m_autoSetting
; // See comment in dcclient.cpp
159 class WXDLLEXPORT wxPaintDC
: public wxWindowDC
161 DECLARE_DYNAMIC_CLASS(wxPaintDC
)
165 wxPaintDC(wxWindow
* win
);
170 class WXDLLEXPORT wxClientDC
: public wxWindowDC
172 DECLARE_DYNAMIC_CLASS(wxClientDC
)
176 wxClientDC(wxWindow
* win
) : wxWindowDC(win
) { }