1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/dcclient.h
3 // Purpose: wxClientDCImpl, wxPaintDCImpl and wxWindowDCImpl 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_
15 #include "wx/motif/dc.h"
17 class WXDLLIMPEXP_FWD_CORE wxWindow
;
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 class WXDLLIMPEXP_CORE wxWindowDCImpl
: public wxMotifDCImpl
26 wxWindowDCImpl(wxDC
*owner
);
27 wxWindowDCImpl(wxDC
*owner
, wxWindow
*win
);
29 virtual ~wxWindowDCImpl();
31 // TODO this function is Motif-only for now - should it go into base class?
32 void Clear(const wxRect
& rect
);
34 // implement base class pure virtuals
35 // ----------------------------------
39 virtual void SetFont(const wxFont
& font
);
40 virtual void SetPen(const wxPen
& pen
);
41 virtual void SetBrush(const wxBrush
& brush
);
42 virtual void SetBackground(const wxBrush
& brush
);
43 virtual void SetBackgroundMode(int mode
);
44 virtual void SetPalette(const wxPalette
& palette
);
45 virtual void SetLogicalFunction( wxRasterOperationMode function
);
47 virtual void SetTextForeground(const wxColour
& colour
);
48 virtual void SetTextBackground(const wxColour
& colour
);
50 virtual wxCoord
GetCharHeight() const;
51 virtual wxCoord
GetCharWidth() const;
52 virtual void DoGetTextExtent(const wxString
& string
,
53 wxCoord
*x
, wxCoord
*y
,
54 wxCoord
*descent
= NULL
,
55 wxCoord
*externalLeading
= NULL
,
56 const wxFont
*theFont
= NULL
) const;
58 virtual bool CanDrawBitmap() const;
59 virtual bool CanGetTextExtent() const;
61 virtual int GetDepth() const;
62 virtual wxSize
GetPPI() const;
64 virtual void DestroyClippingRegion();
66 // Helper function for setting clipping
67 void SetDCClipping(WXRegion region
);
69 // implementation from now on
70 // --------------------------
72 WXGC
GetGC() const { return m_gc
; }
73 WXGC
GetBackingGC() const { return m_gcBacking
; }
74 WXDisplay
* GetDisplay() const { return m_display
; }
75 bool GetAutoSetting() const { return (m_autoSetting
!= 0); } // See comment in dcclient.cpp
76 void SetAutoSetting(bool flag
) { m_autoSetting
= flag
; }
79 // note that this function will call colour.SetPixel,
80 // and will do one of curCol = colour, curCol = wxWHITE, curCol = wxBLACK
81 // roundToWhite has an effect for monochrome display only
82 // if roundToWhite == true then the colour will be set to white unless
83 // it is RGB 0x000000;if roundToWhite == true the colour wull be set to
84 // black unless it id RGB 0xffffff
85 WXPixel
CalculatePixel(wxColour
& colour
, wxColour
& curCol
,
86 bool roundToWhite
) const;
87 // sets the foreground pixel taking into account the
88 // currently selected logical operation
89 void SetForegroundPixelWithLogicalFunction(WXPixel pixel
);
91 virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
92 wxFloodFillStyle style
= wxFLOOD_SURFACE
);
94 virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const;
96 virtual void DoDrawPoint(wxCoord x
, wxCoord y
);
97 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
99 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
100 wxCoord x2
, wxCoord y2
,
101 wxCoord xc
, wxCoord yc
);
102 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
103 double sa
, double ea
);
105 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
106 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
107 wxCoord width
, wxCoord height
,
109 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
111 virtual void DoCrossHair(wxCoord x
, wxCoord y
);
113 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
114 virtual void DoDrawRotatedText(const wxString
&text
, wxCoord x
, wxCoord y
, double angle
);
116 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
117 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
118 wxRasterOperationMode rop
= wxCOPY
, bool useMask
= false, wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1);
120 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
121 wxCoord width
, wxCoord height
);
122 virtual void DoSetDeviceClippingRegion(const wxRegion
& region
);
124 virtual void DoDrawLines(int n
, wxPoint points
[],
125 wxCoord xoffset
, wxCoord yoffset
);
126 virtual void DoDrawPolygon(int n
, wxPoint points
[],
127 wxCoord xoffset
, wxCoord yoffset
,
128 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
);
130 void DoGetSize( int *width
, int *height
) const;
132 // common part of constructors
137 WXDisplay
* m_display
;
139 // Pixmap for drawing on
141 // Last clipping region set on th GC, this is the combination
142 // of paint clipping region and all user-defined clipping regions
143 WXRegion m_clipRegion
;
145 // Not sure if we'll need all of these
146 WXPixel m_backgroundPixel
;
147 wxColour m_currentColour
;
148 int m_currentPenWidth
;
149 int m_currentPenJoin
;
150 int m_currentPenCap
;
151 int m_currentPenDashCount
;
152 wxX11Dash
* m_currentPenDash
;
153 wxBitmap m_currentStipple
;
156 int m_autoSetting
; // See comment in dcclient.cpp
158 DECLARE_DYNAMIC_CLASS(wxWindowDCImpl
)
161 class WXDLLIMPEXP_CORE wxPaintDCImpl
: public wxWindowDCImpl
164 wxPaintDCImpl(wxDC
*owner
) : wxWindowDCImpl(owner
) { }
165 wxPaintDCImpl(wxDC
*owner
, wxWindow
* win
);
167 virtual ~wxPaintDCImpl();
169 DECLARE_DYNAMIC_CLASS(wxPaintDCImpl
)
172 class WXDLLIMPEXP_CORE wxClientDCImpl
: public wxWindowDCImpl
175 wxClientDCImpl(wxDC
*owner
) : wxWindowDCImpl(owner
) { }
176 wxClientDCImpl(wxDC
*owner
, wxWindow
* win
)
177 : wxWindowDCImpl(owner
, win
) { }
179 DECLARE_DYNAMIC_CLASS(wxClientDCImpl
)
182 #endif // _WX_DCCLIENT_H_