]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/dcpsg.h
fix bug in Eof() which returned true even if we were only on the last line, not beyond it
[wxWidgets.git] / include / wx / generic / dcpsg.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
389076f1 2// Name: wx/generic/dcps.h
c801d85f
KB
3// Purpose: wxPostScriptDC class
4// Author: Julian Smart and others
5// Modified by:
c801d85f 6// RCS-ID: $Id$
371a5b4e 7// Copyright: (c) Julian Smart and Robert Roebling
65571936 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
bf38cbff
JS
11#ifndef _WX_DCPSG_H_
12#define _WX_DCPSG_H_
c801d85f 13
c801d85f 14#include "wx/dc.h"
c801d85f 15
ce4169a4
RR
16#if wxUSE_PRINTING_ARCHITECTURE
17
47d67540 18#if wxUSE_POSTSCRIPT
c801d85f 19
bf38cbff
JS
20#include "wx/dialog.h"
21#include "wx/module.h"
7bcb11d3 22#include "wx/cmndata.h"
fbc535ff 23
bf38cbff
JS
24//-----------------------------------------------------------------------------
25// classes
26//-----------------------------------------------------------------------------
f04371f0 27
bf38cbff 28class wxPostScriptDC;
f04371f0 29
bf38cbff
JS
30//-----------------------------------------------------------------------------
31// wxPostScriptDC
32//-----------------------------------------------------------------------------
f04371f0 33
c801d85f
KB
34class WXDLLEXPORT wxPostScriptDC: public wxDC
35{
bf38cbff 36public:
3a97d2db 37 wxPostScriptDC();
7bcb11d3 38
3a97d2db
RR
39 // Recommended constructor
40 wxPostScriptDC(const wxPrintData& printData);
ca65c044 41
3a97d2db
RR
42 // Recommended destructor :-)
43 ~wxPostScriptDC();
c801d85f 44
bf38cbff
JS
45 virtual bool Ok() const;
46
ca65c044 47 bool CanDrawBitmap() const { return true; }
bf38cbff 48
a6f6393c 49 void Clear();
bf38cbff
JS
50 void SetFont( const wxFont& font );
51 void SetPen( const wxPen& pen );
52 void SetBrush( const wxBrush& brush );
53 void SetLogicalFunction( int function );
54 void SetBackground( const wxBrush& brush );
55
a6f6393c 56 void DestroyClippingRegion();
af0bb3b1 57
c801d85f 58 bool StartDoc(const wxString& message);
a6f6393c
VZ
59 void EndDoc();
60 void StartPage();
61 void EndPage();
c801d85f 62
72cdf4c9
VZ
63 wxCoord GetCharHeight() const;
64 wxCoord GetCharWidth() const;
ca65c044 65 bool CanGetTextExtent() const { return true; }
7bcb11d3
JS
66
67 // Resolution in pixels per logical inch
72cdf4c9 68 wxSize GetPPI() const;
c801d85f 69
bf38cbff 70 void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
72cdf4c9 71 void SetDeviceOrigin( wxCoord x, wxCoord y );
bf38cbff 72
72cdf4c9
VZ
73 void SetBackgroundMode(int WXUNUSED(mode)) { }
74 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
c801d85f 75
af0bb3b1
VZ
76 wxPrintData& GetPrintData() { return m_printData; }
77 void SetPrintData(const wxPrintData& data) { m_printData = data; }
78
79 virtual int GetDepth() const { return 24; }
ca65c044 80
b64de916
VS
81 static void SetResolution(int ppi);
82 static int GetResolution();
244e5e34
VZ
83
84 void PsPrintf( const wxChar* fmt, ... );
85 void PsPrint( const char* psdata );
86 void PsPrint( int ch );
87
88#if wxUSE_UNICODE
89 void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); }
90#endif
91
ca65c044 92private:
eba33006 93 static float ms_PSScaleFactor;
7bcb11d3 94
c801d85f 95protected:
6f02a879
VZ
96 bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE);
97 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
98 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
99 void DoCrossHair(wxCoord x, wxCoord y) ;
100 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
101 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
102 void DoDrawPoint(wxCoord x, wxCoord y);
103 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
104 void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE);
105 void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE);
106 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
107 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
108 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
109#if wxUSE_SPLINES
110 void DoDrawSpline(wxList *points);
111#endif // wxUSE_SPLINES
112 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
113 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
114 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
115 void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
116 void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false);
117 void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
118 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
119 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
120 void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip)) { }
121 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
122 wxCoord *descent = NULL,
123 wxCoord *externalLeading = NULL,
124 wxFont *theFont = NULL) const;
125 void DoGetSize(int* width, int* height) const;
126 void DoGetSizeMM(int *width, int *height) const;
3a97d2db 127
eba33006
RR
128 FILE* m_pstream; // PostScript output stream
129 wxString m_title;
130 unsigned char m_currentRed;
131 unsigned char m_currentGreen;
132 unsigned char m_currentBlue;
133 int m_pageNumber;
134 bool m_clipping;
135 double m_underlinePosition;
136 double m_underlineThickness;
137 wxPrintData m_printData;
ca65c044 138
eba33006
RR
139private:
140 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
c801d85f
KB
141};
142
bf38cbff
JS
143#endif
144 // wxUSE_POSTSCRIPT
72cdf4c9 145
ce4169a4
RR
146#endif
147 // wxUSE_PRINTING_ARCHITECTURE
ed880dd4 148
c801d85f 149#endif
bf38cbff 150 // _WX_DCPSG_H_