]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/dcpsg.h
Allow wxSplitterWindow::Initialize(NULL) in case we've deleted both child
[wxWidgets.git] / include / wx / generic / dcpsg.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
bf38cbff 2// Name: 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
12028905 14#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
ade6b9c5 15#pragma interface "dcpsg.h"
c801d85f
KB
16#endif
17
18#include "wx/dc.h"
c801d85f 19
ce4169a4
RR
20#if wxUSE_PRINTING_ARCHITECTURE
21
47d67540 22#if wxUSE_POSTSCRIPT
c801d85f 23
bf38cbff
JS
24#include "wx/dialog.h"
25#include "wx/module.h"
7bcb11d3 26#include "wx/cmndata.h"
fbc535ff 27
bf38cbff
JS
28//-----------------------------------------------------------------------------
29// classes
30//-----------------------------------------------------------------------------
f04371f0 31
bf38cbff 32class wxPostScriptDC;
f04371f0 33
bf38cbff
JS
34//-----------------------------------------------------------------------------
35// wxPostScriptDC
36//-----------------------------------------------------------------------------
f04371f0 37
c801d85f
KB
38class WXDLLEXPORT wxPostScriptDC: public wxDC
39{
bf38cbff 40public:
3a97d2db 41 wxPostScriptDC();
7bcb11d3 42
3a97d2db
RR
43 // Recommended constructor
44 wxPostScriptDC(const wxPrintData& printData);
009a0665 45
3a97d2db
RR
46 // Recommended destructor :-)
47 ~wxPostScriptDC();
c801d85f 48
009a0665 49#if WXWIN_COMPATIBILITY_2_2
3a97d2db
RR
50 wxPostScriptDC( const wxString &output, bool interactive = FALSE, wxWindow *parent = NULL )
51 { Create( output, interactive, parent ); }
52 bool Create ( const wxString &output, bool interactive = FALSE, wxWindow *parent = NULL );
009a0665
RR
53#endif
54
bf38cbff
JS
55 virtual bool Ok() const;
56
bf38cbff
JS
57 virtual void BeginDrawing() {}
58 virtual void EndDrawing() {}
c801d85f 59
387ebd3e 60 bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
72cdf4c9
VZ
61 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
62
63 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
64 void DoCrossHair(wxCoord x, wxCoord y) ;
65 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
66 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
67 void DoDrawPoint(wxCoord x, wxCoord y);
68 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
69 void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
793db755 70 void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
72cdf4c9
VZ
71 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
72 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
73 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
64698f9a
RR
74
75 void DoDrawSpline(wxList *points);
76
72cdf4c9 77 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
f0a6b1cd
JS
78 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = FALSE,
79 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
72cdf4c9 80 bool CanDrawBitmap() const { return TRUE; }
bf38cbff 81
72cdf4c9
VZ
82 void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
83 void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask=FALSE );
bf38cbff 84
72cdf4c9 85 void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
95724b1a 86 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
c801d85f 87
a6f6393c 88 void Clear();
bf38cbff
JS
89 void SetFont( const wxFont& font );
90 void SetPen( const wxPen& pen );
91 void SetBrush( const wxBrush& brush );
92 void SetLogicalFunction( int function );
93 void SetBackground( const wxBrush& brush );
94
72cdf4c9 95 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
a6f6393c 96 void DestroyClippingRegion();
af0bb3b1 97
72cdf4c9 98 void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) { }
c801d85f
KB
99
100 bool StartDoc(const wxString& message);
a6f6393c
VZ
101 void EndDoc();
102 void StartPage();
103 void EndPage();
c801d85f 104
72cdf4c9
VZ
105 wxCoord GetCharHeight() const;
106 wxCoord GetCharWidth() const;
385c54d7 107 bool CanGetTextExtent() const { return TRUE; }
72cdf4c9
VZ
108 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
109 wxCoord *descent = (wxCoord *) NULL,
110 wxCoord *externalLeading = (wxCoord *) NULL,
64698f9a 111 wxFont *theFont = (wxFont *) NULL ) const;
c801d85f 112
4e4ea166
RR
113 void DoGetSize(int* width, int* height) const;
114 void DoGetSizeMM(int *width, int *height) const;
7bcb11d3
JS
115
116 // Resolution in pixels per logical inch
72cdf4c9 117 wxSize GetPPI() const;
c801d85f 118
bf38cbff 119 void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
72cdf4c9 120 void SetDeviceOrigin( wxCoord x, wxCoord y );
bf38cbff 121
72cdf4c9
VZ
122 void SetBackgroundMode(int WXUNUSED(mode)) { }
123 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
c801d85f 124
af0bb3b1
VZ
125 wxPrintData& GetPrintData() { return m_printData; }
126 void SetPrintData(const wxPrintData& data) { m_printData = data; }
127
128 virtual int GetDepth() const { return 24; }
b64de916
VS
129
130 static void SetResolution(int ppi);
131 static int GetResolution();
244e5e34
VZ
132
133 void PsPrintf( const wxChar* fmt, ... );
134 void PsPrint( const char* psdata );
135 void PsPrint( int ch );
136
137#if wxUSE_UNICODE
138 void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); }
139#endif
140
b64de916 141private:
eba33006 142 static float ms_PSScaleFactor;
7bcb11d3 143
c801d85f 144protected:
3a97d2db
RR
145#if wxUSE_PANGO
146 PangoContext *m_context;
147 PangoLayout *m_layout;
148 PangoFontDescription *m_fontdesc;
149#endif
150
eba33006
RR
151 FILE* m_pstream; // PostScript output stream
152 wxString m_title;
153 unsigned char m_currentRed;
154 unsigned char m_currentGreen;
155 unsigned char m_currentBlue;
156 int m_pageNumber;
157 bool m_clipping;
158 double m_underlinePosition;
159 double m_underlineThickness;
160 wxPrintData m_printData;
161
162private:
163 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
c801d85f
KB
164};
165
47dc9f78
RR
166
167#if WXWIN_COMPATIBILITY_2_2
168// Print Orientation
169enum
170{
171 PS_PORTRAIT = wxPORTRAIT,
172 PS_LANDSCAPE = wxLANDSCAPE
173};
174
175// Print Actions
176enum
177{
178 PS_NONE = wxPRINT_MODE_NONE,
179 PS_PREVIEW = wxPRINT_MODE_PREVIEW,
180 PS_FILE = wxPRINT_MODE_FILE,
181 PS_PRINTER = wxPRINT_MODE_PRINTER
182};
183
184class wxPrintSetupData: public wxPrintData
185{
186public:
187 wxPrintSetupData() {}
188
189 void SetPrinterOrientation( int orient )
190 { SetOrientation( orient ); }
191 void SetPrinterMode( wxPrintMode mode )
192 { SetPrintMode( mode ); }
193 void SetAFMPath( const wxString &path )
194 { SetFontMetricPath( path ); }
195
196 void SetPaperName(const wxString& paper) { m_paperName = paper; }
197 void SetPrinterFile(const wxString& file) { m_printerFile = file; }
198 wxString GetPaperName() const { return m_paperName; }
199 wxString GetPrinterFile() const { return m_printerFile; };
200
201 wxString m_paperName;
202 wxString m_printerFile;
203};
204
205WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData;
206WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE);
207#endif
208
209
bf38cbff
JS
210#endif
211 // wxUSE_POSTSCRIPT
72cdf4c9 212
ce4169a4
RR
213#endif
214 // wxUSE_PRINTING_ARCHITECTURE
ed880dd4 215
c801d85f 216#endif
bf38cbff 217 // _WX_DCPSG_H_