]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dcgraph.h
Don't duplicate event sending code in wxGTK wxListBox.
[wxWidgets.git] / include / wx / dcgraph.h
CommitLineData
8acd14d1
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/graphdc.h
3// Purpose: graphics context device bridge header
4// Author: Stefan Csomor
5// Modified by:
6// Created:
7// Copyright: (c) Stefan Csomor
8// RCS-ID: $Id$
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GRAPHICS_DC_H_
13#define _WX_GRAPHICS_DC_H_
14
15#if wxUSE_GRAPHICS_CONTEXT
16
11a0827d 17#include "wx/dc.h"
8acd14d1 18#include "wx/geometry.h"
2b73854d 19#include "wx/graphics.h"
8acd14d1 20
b5dbe15d 21class WXDLLIMPEXP_FWD_CORE wxWindowDC;
8acd14d1 22
8acd14d1 23
53a2db12 24class WXDLLIMPEXP_CORE wxGCDC: public wxDC
8acd14d1 25{
888dde65
RR
26public:
27 wxGCDC( const wxWindowDC& dc );
28 wxGCDC( const wxMemoryDC& dc );
220d37c8 29#if wxUSE_PRINTING_ARCHITECTURE
b25c34aa 30 wxGCDC( const wxPrinterDC& dc );
220d37c8 31#endif
888dde65 32 wxGCDC();
4dd36d1d 33 virtual ~wxGCDC();
03647350 34
888dde65
RR
35 wxGraphicsContext* GetGraphicsContext();
36 void SetGraphicsContext( wxGraphicsContext* ctx );
03647350 37
942d5e2d
VZ
38#ifdef __WXMSW__
39 // override wxDC virtual functions to provide access to HDC associated with
40 // this Graphics object (implemented in src/msw/graphics.cpp)
41 virtual WXHDC AcquireHDC();
42 virtual void ReleaseHDC(WXHDC hdc);
43#endif // __WXMSW__
44
45private:
8acd14d1 46 DECLARE_DYNAMIC_CLASS(wxGCDC)
c0c133e1 47 wxDECLARE_NO_COPY_CLASS(wxGCDC);
888dde65 48};
8acd14d1 49
888dde65 50
53a2db12 51class WXDLLIMPEXP_CORE wxGCDCImpl: public wxDCImpl
888dde65 52{
8acd14d1 53public:
888dde65
RR
54 wxGCDCImpl( wxDC *owner, const wxWindowDC& dc );
55 wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc );
220d37c8 56#if wxUSE_PRINTING_ARCHITECTURE
b25c34aa 57 wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc );
220d37c8 58#endif
888dde65 59 wxGCDCImpl( wxDC *owner );
03647350 60
888dde65 61 virtual ~wxGCDCImpl();
8acd14d1
SC
62
63 void Init();
64
65
66 // implement base class pure virtuals
67 // ----------------------------------
68
69 virtual void Clear();
70
cc18b1c7
SC
71 virtual bool StartDoc( const wxString& message );
72 virtual void EndDoc();
73
74 virtual void StartPage();
75 virtual void EndPage();
03647350 76
cc18b1c7
SC
77 // flushing the content of this dc immediately onto screen
78 virtual void Flush();
8acd14d1
SC
79
80 virtual void SetFont(const wxFont& font);
81 virtual void SetPen(const wxPen& pen);
82 virtual void SetBrush(const wxBrush& brush);
83 virtual void SetBackground(const wxBrush& brush);
84 virtual void SetBackgroundMode(int mode);
85 virtual void SetPalette(const wxPalette& palette);
86
87 virtual void DestroyClippingRegion();
88
89 virtual wxCoord GetCharHeight() const;
90 virtual wxCoord GetCharWidth() const;
91
92 virtual bool CanDrawBitmap() const;
93 virtual bool CanGetTextExtent() const;
94 virtual int GetDepth() const;
95 virtual wxSize GetPPI() const;
96
89efaf2b 97 virtual void SetMapMode(wxMappingMode mode);
8acd14d1 98
89efaf2b 99 virtual void SetLogicalFunction(wxRasterOperationMode function);
8acd14d1
SC
100
101 virtual void SetTextForeground(const wxColour& colour);
102 virtual void SetTextBackground(const wxColour& colour);
103
104 virtual void ComputeScaleAndOrigin();
105
b687dd2f
PC
106 wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; }
107 virtual void SetGraphicsContext( wxGraphicsContext* ctx );
03647350 108
8acd14d1
SC
109 // the true implementations
110 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
89efaf2b 111 wxFloodFillStyle style = wxFLOOD_SURFACE);
8acd14d1
SC
112
113 virtual void DoGradientFillLinear(const wxRect& rect,
114 const wxColour& initialColour,
115 const wxColour& destColour,
116 wxDirection nDirection = wxEAST);
117
118 virtual void DoGradientFillConcentric(const wxRect& rect,
119 const wxColour& initialColour,
120 const wxColour& destColour,
121 const wxPoint& circleCenter);
122
123 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
124
125 virtual void DoDrawPoint(wxCoord x, wxCoord y);
126
127#if wxUSE_SPLINES
b0d7707b 128 virtual void DoDrawSpline(const wxPointList *points);
8acd14d1
SC
129#endif
130
131 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
132
133 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
134 wxCoord x2, wxCoord y2,
135 wxCoord xc, wxCoord yc);
136
137 virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
138 wxCoord width, wxCoord height);
139
140 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
141 double sa, double ea);
142
143 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
144 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
145 wxCoord width, wxCoord height,
146 double radius);
147 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
148
149 virtual void DoCrossHair(wxCoord x, wxCoord y);
150
151 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
152 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
153 bool useMask = false);
154
155 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
156 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
157 double angle);
158
159 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
89efaf2b 160 wxDC *source, wxCoord xsrc, wxCoord ysrc,
03647350 161 wxRasterOperationMode rop = wxCOPY, bool useMask = false,
89efaf2b 162 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
8acd14d1 163
e3b81044
VZ
164 virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
165 wxCoord dstWidth, wxCoord dstHeight,
166 wxDC *source,
167 wxCoord xsrc, wxCoord ysrc,
168 wxCoord srcWidth, wxCoord srcHeight,
89efaf2b 169 wxRasterOperationMode = wxCOPY, bool useMask = false,
e3b81044
VZ
170 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
171
8acd14d1
SC
172 virtual void DoGetSize(int *,int *) const;
173 virtual void DoGetSizeMM(int* width, int* height) const;
174
175 virtual void DoDrawLines(int n, wxPoint points[],
176 wxCoord xoffset, wxCoord yoffset);
177 virtual void DoDrawPolygon(int n, wxPoint points[],
89efaf2b
FM
178 wxCoord xoffset, wxCoord yoffset,
179 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
8acd14d1 180 virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
89efaf2b
FM
181 wxCoord xoffset, wxCoord yoffset,
182 wxPolygonFillMode fillStyle);
8acd14d1 183
fdaad94e 184 virtual void DoSetDeviceClippingRegion(const wxRegion& region);
8acd14d1
SC
185 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
186 wxCoord width, wxCoord height);
187
188 virtual void DoGetTextExtent(const wxString& string,
189 wxCoord *x, wxCoord *y,
190 wxCoord *descent = NULL,
191 wxCoord *externalLeading = NULL,
c94f845b 192 const wxFont *theFont = NULL) const;
8acd14d1
SC
193
194 virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
195
196protected:
197 // scaling variables
4280b879 198 bool m_logicalFunctionSupported;
8acd14d1 199 double m_mm_to_pix_x, m_mm_to_pix_y;
2b73854d
SC
200 wxGraphicsMatrix m_matrixOriginal;
201 wxGraphicsMatrix m_matrixCurrent;
b687dd2f
PC
202
203 double m_formerScaleX, m_formerScaleY;
8acd14d1
SC
204
205 wxGraphicsContext* m_graphicContext;
03647350 206
888dde65 207 DECLARE_CLASS(wxGCDCImpl)
c0c133e1 208 wxDECLARE_NO_COPY_CLASS(wxGCDCImpl);
8acd14d1
SC
209};
210
512cfcc3 211#endif // wxUSE_GRAPHICS_CONTEXT
8acd14d1 212#endif // _WX_GRAPHICS_DC_H_