]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/dcpsg.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / generic / dcpsg.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/generic/dcpsg.h
c801d85f
KB
3// Purpose: wxPostScriptDC class
4// Author: Julian Smart and others
5// Modified by:
371a5b4e 6// Copyright: (c) Julian Smart and Robert Roebling
65571936 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
bf38cbff
JS
10#ifndef _WX_DCPSG_H_
11#define _WX_DCPSG_H_
c801d85f 12
e7445ff8 13#include "wx/defs.h"
c801d85f 14
eb7637b5 15#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
c801d85f 16
e7445ff8 17#include "wx/dc.h"
4f37154e 18#include "wx/dcprint.h"
bf38cbff
JS
19#include "wx/dialog.h"
20#include "wx/module.h"
7bcb11d3 21#include "wx/cmndata.h"
c9f78968 22#include "wx/strvararg.h"
fbc535ff 23
bf38cbff
JS
24//-----------------------------------------------------------------------------
25// wxPostScriptDC
26//-----------------------------------------------------------------------------
f04371f0 27
4f37154e 28
53a2db12 29class WXDLLIMPEXP_CORE wxPostScriptDC : public wxDC
4f37154e
RR
30{
31public:
32 wxPostScriptDC();
33
34 // Recommended constructor
35 wxPostScriptDC(const wxPrintData& printData);
b1f0e54a 36
4f37154e
RR
37private:
38 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
39};
40
53a2db12 41class WXDLLIMPEXP_CORE wxPostScriptDCImpl : public wxDCImpl
c801d85f 42{
bf38cbff 43public:
888dde65
RR
44 wxPostScriptDCImpl( wxPrinterDC *owner );
45 wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data );
46 wxPostScriptDCImpl( wxPostScriptDC *owner );
47 wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data );
7bcb11d3 48
4f37154e
RR
49 void Init();
50
888dde65 51 virtual ~wxPostScriptDCImpl();
c801d85f 52
04ab8b6d
RR
53 virtual bool Ok() const { return IsOk(); }
54 virtual bool IsOk() const;
bf38cbff 55
04ab8b6d 56 bool CanDrawBitmap() const { return true; }
bf38cbff 57
04ab8b6d
RR
58 void Clear();
59 void SetFont( const wxFont& font );
60 void SetPen( const wxPen& pen );
61 void SetBrush( const wxBrush& brush );
89efaf2b 62 void SetLogicalFunction( wxRasterOperationMode function );
04ab8b6d 63 void SetBackground( const wxBrush& brush );
bf38cbff 64
04ab8b6d 65 void DestroyClippingRegion();
af0bb3b1 66
04ab8b6d
RR
67 bool StartDoc(const wxString& message);
68 void EndDoc();
69 void StartPage();
70 void EndPage();
c801d85f 71
04ab8b6d
RR
72 wxCoord GetCharHeight() const;
73 wxCoord GetCharWidth() const;
74 bool CanGetTextExtent() const { return true; }
7bcb11d3 75
04ab8b6d
RR
76 // Resolution in pixels per logical inch
77 wxSize GetPPI() const;
c801d85f 78
c0845ad3 79 virtual void ComputeScaleAndOrigin();
bf38cbff 80
04ab8b6d
RR
81 void SetBackgroundMode(int WXUNUSED(mode)) { }
82 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
c801d85f 83
04ab8b6d
RR
84 void SetPrintData(const wxPrintData& data);
85 wxPrintData& GetPrintData() { return m_printData; }
af0bb3b1 86
04ab8b6d 87 virtual int GetDepth() const { return 24; }
ca65c044 88
04ab8b6d 89 void PsPrint( const wxString& psdata );
b1f0e54a 90
4f37154e 91 // Overrridden for wxPrinterDC Impl
b1f0e54a 92
6d52ca53
FM
93 virtual int GetResolution() const;
94 virtual wxRect GetPaperRect() const;
7bcb11d3 95
9eefb5c1
RD
96 virtual void* GetHandle() const { return NULL; }
97
c801d85f 98protected:
03647350 99 bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col,
89efaf2b 100 wxFloodFillStyle style = wxFLOOD_SURFACE);
6f02a879
VZ
101 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
102 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
103 void DoCrossHair(wxCoord x, wxCoord y) ;
104 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
105 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
106 void DoDrawPoint(wxCoord x, wxCoord y);
4787c92d
PC
107 void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
108 void DoDrawPolygon(int n, const wxPoint points[],
03647350 109 wxCoord xoffset = 0, wxCoord yoffset = 0,
89efaf2b 110 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
4787c92d 111 void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
03647350 112 wxCoord xoffset = 0, wxCoord yoffset = 0,
89efaf2b 113 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
6f02a879
VZ
114 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
115 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
116 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
117#if wxUSE_SPLINES
b0d7707b 118 void DoDrawSpline(const wxPointList *points);
4f37154e 119#endif
6f02a879 120 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
03647350 121 wxDC *source, wxCoord xsrc, wxCoord ysrc,
89efaf2b 122 wxRasterOperationMode rop = wxCOPY, bool useMask = false,
6f02a879
VZ
123 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
124 void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
125 void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false);
126 void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
127 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
128 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
fdaad94e
VZ
129 void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip))
130 {
131 wxFAIL_MSG( "not implemented" );
132 }
6f02a879
VZ
133 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
134 wxCoord *descent = NULL,
135 wxCoord *externalLeading = NULL,
c94f845b 136 const wxFont *theFont = NULL) const;
6f02a879
VZ
137 void DoGetSize(int* width, int* height) const;
138 void DoGetSizeMM(int *width, int *height) const;
3a97d2db 139
eba33006 140 FILE* m_pstream; // PostScript output stream
eba33006
RR
141 unsigned char m_currentRed;
142 unsigned char m_currentGreen;
143 unsigned char m_currentBlue;
144 int m_pageNumber;
145 bool m_clipping;
146 double m_underlinePosition;
147 double m_underlineThickness;
148 wxPrintData m_printData;
eb7637b5 149 double m_pageHeight;
ca65c044 150
eba33006 151private:
888dde65 152 DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl)
c801d85f
KB
153};
154
bf38cbff 155#endif
eb7637b5 156 // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE
ed880dd4 157
c801d85f 158#endif
bf38cbff 159 // _WX_DCPSG_H_