1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/dcclient.h
3 // Purpose: wxClientDCImpl, wxPaintDCImpl and wxWindowDCImpl classes
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_DCCLIENT_H_
12 #define _WX_DCCLIENT_H_
14 #include "wx/motif/dc.h"
16 class WXDLLIMPEXP_FWD_CORE wxWindow
;
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 class WXDLLIMPEXP_CORE wxWindowDCImpl
: public wxMotifDCImpl
25 wxWindowDCImpl(wxDC
*owner
);
26 wxWindowDCImpl(wxDC
*owner
, wxWindow
*win
);
28 virtual ~wxWindowDCImpl();
30 // TODO this function is Motif-only for now - should it go into base class?
31 void Clear(const wxRect
& rect
);
33 // implement base class pure virtuals
34 // ----------------------------------
38 virtual void SetFont(const wxFont
& font
);
39 virtual void SetPen(const wxPen
& pen
);
40 virtual void SetBrush(const wxBrush
& brush
);
41 virtual void SetBackground(const wxBrush
& brush
);
42 virtual void SetBackgroundMode(int mode
);
43 virtual void SetPalette(const wxPalette
& palette
);
44 virtual void SetLogicalFunction( wxRasterOperationMode function
);
46 virtual void SetTextForeground(const wxColour
& colour
);
47 virtual void SetTextBackground(const wxColour
& colour
);
49 virtual wxCoord
GetCharHeight() const;
50 virtual wxCoord
GetCharWidth() const;
51 virtual void DoGetTextExtent(const wxString
& string
,
52 wxCoord
*x
, wxCoord
*y
,
53 wxCoord
*descent
= NULL
,
54 wxCoord
*externalLeading
= NULL
,
55 const wxFont
*theFont
= NULL
) const;
57 virtual bool CanDrawBitmap() const;
58 virtual bool CanGetTextExtent() const;
60 virtual int GetDepth() const;
61 virtual wxSize
GetPPI() const;
63 virtual void DestroyClippingRegion();
65 // Helper function for setting clipping
66 void SetDCClipping(WXRegion region
);
68 // implementation from now on
69 // --------------------------
71 WXGC
GetGC() const { return m_gc
; }
72 WXGC
GetBackingGC() const { return m_gcBacking
; }
73 WXDisplay
* GetDisplay() const { return m_display
; }
74 bool GetAutoSetting() const { return (m_autoSetting
!= 0); } // See comment in dcclient.cpp
75 void SetAutoSetting(bool flag
) { m_autoSetting
= flag
; }
78 // note that this function will call colour.SetPixel,
79 // and will do one of curCol = colour, curCol = wxWHITE, curCol = wxBLACK
80 // roundToWhite has an effect for monochrome display only
81 // if roundToWhite == true then the colour will be set to white unless
82 // it is RGB 0x000000;if roundToWhite == true the colour wull be set to
83 // black unless it id RGB 0xffffff
84 WXPixel
CalculatePixel(wxColour
& colour
, wxColour
& curCol
,
85 bool roundToWhite
) const;
86 // sets the foreground pixel taking into account the
87 // currently selected logical operation
88 void SetForegroundPixelWithLogicalFunction(WXPixel pixel
);
90 virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
91 wxFloodFillStyle style
= wxFLOOD_SURFACE
);
93 virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const;
95 virtual void DoDrawPoint(wxCoord x
, wxCoord y
);
96 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
98 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
99 wxCoord x2
, wxCoord y2
,
100 wxCoord xc
, wxCoord yc
);
101 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
102 double sa
, double ea
);
104 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
105 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
106 wxCoord width
, wxCoord height
,
108 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
110 virtual void DoCrossHair(wxCoord x
, wxCoord y
);
112 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
113 virtual void DoDrawRotatedText(const wxString
&text
, wxCoord x
, wxCoord y
, double angle
);
115 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
116 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
117 wxRasterOperationMode rop
= wxCOPY
, bool useMask
= false, wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1);
119 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
120 wxCoord width
, wxCoord height
);
121 virtual void DoSetDeviceClippingRegion(const wxRegion
& region
);
123 virtual void DoDrawLines(int n
, const wxPoint points
[],
124 wxCoord xoffset
, wxCoord yoffset
);
125 virtual void DoDrawPolygon(int n
, const wxPoint points
[],
126 wxCoord xoffset
, wxCoord yoffset
,
127 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
);
129 void DoGetSize( int *width
, int *height
) const;
131 // common part of constructors
136 WXDisplay
* m_display
;
138 // Pixmap for drawing on
140 // Last clipping region set on th GC, this is the combination
141 // of paint clipping region and all user-defined clipping regions
142 WXRegion m_clipRegion
;
144 // Not sure if we'll need all of these
145 WXPixel m_backgroundPixel
;
146 wxColour m_currentColour
;
147 int m_currentPenWidth
;
148 int m_currentPenJoin
;
149 int m_currentPenCap
;
150 int m_currentPenDashCount
;
151 wxX11Dash
* m_currentPenDash
;
152 wxBitmap m_currentStipple
;
155 int m_autoSetting
; // See comment in dcclient.cpp
157 DECLARE_DYNAMIC_CLASS(wxWindowDCImpl
)
160 class WXDLLIMPEXP_CORE wxPaintDCImpl
: public wxWindowDCImpl
163 wxPaintDCImpl(wxDC
*owner
) : wxWindowDCImpl(owner
) { }
164 wxPaintDCImpl(wxDC
*owner
, wxWindow
* win
);
166 virtual ~wxPaintDCImpl();
168 DECLARE_DYNAMIC_CLASS(wxPaintDCImpl
)
171 class WXDLLIMPEXP_CORE wxClientDCImpl
: public wxWindowDCImpl
174 wxClientDCImpl(wxDC
*owner
) : wxWindowDCImpl(owner
) { }
175 wxClientDCImpl(wxDC
*owner
, wxWindow
* win
)
176 : wxWindowDCImpl(owner
, win
) { }
178 DECLARE_DYNAMIC_CLASS(wxClientDCImpl
)
181 #endif // _WX_DCCLIENT_H_