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