]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/dcpsg.h
some os/2 icon-bitmap fixes
[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$
bf38cbff 7// Copyright: (c) Julian Smart, Robert Roebling and Markus Holzem
a6f6393c 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
bf38cbff
JS
11#ifndef _WX_DCPSG_H_
12#define _WX_DCPSG_H_
c801d85f
KB
13
14#ifdef __GNUG__
bf38cbff 15#pragma interface
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{
40 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
41
bf38cbff
JS
42public:
43
a6f6393c 44 wxPostScriptDC();
7bcb11d3
JS
45
46 // Deprecated constructor
c67daf87 47 wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
c801d85f 48
7bcb11d3
JS
49 // Recommended constructor
50 wxPostScriptDC(const wxPrintData& printData);
51
a6f6393c 52 ~wxPostScriptDC();
c801d85f 53
7bcb11d3 54 // Deprecated
c67daf87 55 bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
c801d85f 56
bf38cbff
JS
57 virtual bool Ok() const;
58
7bcb11d3 59 // Deprecated: use wxGenericPrintDialog instead
c67daf87 60 virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL);
c801d85f 61
bf38cbff
JS
62 virtual void BeginDrawing() {}
63 virtual void EndDrawing() {}
c801d85f 64
72cdf4c9
VZ
65 void DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
66 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
67
68 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
69 void DoCrossHair(wxCoord x, wxCoord y) ;
70 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
71 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
72 void DoDrawPoint(wxCoord x, wxCoord y);
73 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
74 void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
75 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
76 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
77 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
64698f9a
RR
78
79 void DoDrawSpline(wxList *points);
80
72cdf4c9
VZ
81 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
82 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = FALSE);
83 bool CanDrawBitmap() const { return TRUE; }
bf38cbff 84
72cdf4c9
VZ
85 void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
86 void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask=FALSE );
bf38cbff 87
72cdf4c9 88 void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
c801d85f 89
a6f6393c 90 void Clear();
bf38cbff
JS
91 void SetFont( const wxFont& font );
92 void SetPen( const wxPen& pen );
93 void SetBrush( const wxBrush& brush );
94 void SetLogicalFunction( int function );
95 void SetBackground( const wxBrush& brush );
96
72cdf4c9 97 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
a6f6393c 98 void DestroyClippingRegion();
af0bb3b1 99
72cdf4c9 100 void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) { }
c801d85f
KB
101
102 bool StartDoc(const wxString& message);
a6f6393c
VZ
103 void EndDoc();
104 void StartPage();
105 void EndPage();
c801d85f 106
72cdf4c9
VZ
107 wxCoord GetCharHeight() const;
108 wxCoord GetCharWidth() const;
385c54d7 109 bool CanGetTextExtent() const { return TRUE; }
72cdf4c9
VZ
110 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
111 wxCoord *descent = (wxCoord *) NULL,
112 wxCoord *externalLeading = (wxCoord *) NULL,
64698f9a 113 wxFont *theFont = (wxFont *) NULL ) const;
c801d85f 114
4e4ea166
RR
115 void DoGetSize(int* width, int* height) const;
116 void DoGetSizeMM(int *width, int *height) const;
7bcb11d3
JS
117
118 // Resolution in pixels per logical inch
72cdf4c9 119 wxSize GetPPI() const;
c801d85f 120
bf38cbff 121 void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
72cdf4c9 122 void SetDeviceOrigin( wxCoord x, wxCoord y );
bf38cbff 123
72cdf4c9
VZ
124 void SetBackgroundMode(int WXUNUSED(mode)) { }
125 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
c801d85f 126
af0bb3b1
VZ
127 wxPrintData& GetPrintData() { return m_printData; }
128 void SetPrintData(const wxPrintData& data) { m_printData = data; }
129
130 virtual int GetDepth() const { return 24; }
7bcb11d3 131
c801d85f 132protected:
bf38cbff 133
d7657f75 134 FILE* m_pstream; // PostScript output stream
c801d85f
KB
135 wxString m_title;
136 unsigned char m_currentRed;
137 unsigned char m_currentGreen;
138 unsigned char m_currentBlue;
bf38cbff
JS
139 int m_pageNumber;
140 bool m_clipping;
141 double m_underlinePosition;
142 double m_underlineThickness;
7bcb11d3 143 wxPrintData m_printData;
bf38cbff
JS
144};
145
7bcb11d3 146// Deprecated: should use wxGenericPrintDialog instead.
bf38cbff 147#if 1
72cdf4c9
VZ
148enum
149{
150 wxID_PRINTER_COMMAND = 1,
151 wxID_PRINTER_OPTIONS,
152 wxID_PRINTER_ORIENTATION,
153 wxID_PRINTER_MODES,
154 wxID_PRINTER_X_SCALE,
155 wxID_PRINTER_Y_SCALE,
156 wxID_PRINTER_X_TRANS,
157 wxID_PRINTER_Y_TRANS
158};
c801d85f
KB
159
160class WXDLLEXPORT wxPostScriptPrintDialog: public wxDialog
161{
162DECLARE_CLASS(wxPostScriptPrintDialog)
163public:
164 wxPostScriptPrintDialog (wxWindow *parent, const wxString& title,
a6f6393c 165 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
72cdf4c9 166 wxCoord style = wxDEFAULT_DIALOG_STYLE);
c801d85f 167
72cdf4c9 168 virtual int ShowModal();
c801d85f 169};
72cdf4c9 170#endif // 1
c801d85f
KB
171
172// Print Orientation (Should also add Left, Right)
af0bb3b1
VZ
173enum
174{
c801d85f
KB
175 PS_PORTRAIT = 1,
176 PS_LANDSCAPE = 2
177};// ps_orientation = PS_PORTRAIT;
178
179// Print Actions
af0bb3b1
VZ
180enum
181{
7bcb11d3
JS
182 PS_NONE,
183 PS_PREVIEW,
c801d85f 184 PS_FILE,
7bcb11d3 185 PS_PRINTER
c801d85f
KB
186};// ps_action = PS_PREVIEW;
187
188// PostScript printer settings
7bcb11d3
JS
189WXDLLEXPORT void wxSetPrinterCommand(const wxString& cmd);
190WXDLLEXPORT void wxSetPrintPreviewCommand(const wxString& cmd);
191WXDLLEXPORT void wxSetPrinterOptions(const wxString& flags);
184b5d99
JS
192WXDLLEXPORT void wxSetPrinterOrientation(int orientation);
193WXDLLEXPORT void wxSetPrinterScaling(double x, double y);
72cdf4c9 194WXDLLEXPORT void wxSetPrinterTranslation(wxCoord x, wxCoord y);
184b5d99 195WXDLLEXPORT void wxSetPrinterMode(int mode);
7bcb11d3
JS
196WXDLLEXPORT void wxSetPrinterFile(const wxString& f);
197WXDLLEXPORT void wxSetAFMPath(const wxString& f);
c801d85f
KB
198
199// Get current values
7bcb11d3
JS
200WXDLLEXPORT wxString wxGetPrinterCommand();
201WXDLLEXPORT wxString wxGetPrintPreviewCommand();
202WXDLLEXPORT wxString wxGetPrinterOptions();
a6f6393c 203WXDLLEXPORT int wxGetPrinterOrientation();
184b5d99 204WXDLLEXPORT void wxGetPrinterScaling(double* x, double* y);
72cdf4c9 205WXDLLEXPORT void wxGetPrinterTranslation(wxCoord *x, wxCoord *y);
a6f6393c 206WXDLLEXPORT int wxGetPrinterMode();
7bcb11d3
JS
207WXDLLEXPORT wxString wxGetPrinterFile();
208WXDLLEXPORT wxString wxGetAFMPath();
c801d85f
KB
209
210/*
7bcb11d3
JS
211 * PostScript print setup information.
212 * This is now obsolete, but retained for a while for compatibility
c801d85f
KB
213 */
214
215class WXDLLEXPORT wxPrintSetupData: public wxObject
216{
a6f6393c
VZ
217public:
218 wxPrintSetupData();
219 ~wxPrintSetupData();
220
7bcb11d3
JS
221 void SetPrinterCommand(const wxString& cmd) { m_printerCommand = cmd; };
222 void SetPaperName(const wxString& paper) { m_paperName = paper; };
223 void SetPrintPreviewCommand(const wxString& cmd) { m_previewCommand = cmd; };
224 void SetPrinterOptions(const wxString& flags) { m_printerFlags = flags; };
225 void SetPrinterFile(const wxString& f) { m_printerFile = f; };
226 void SetPrinterOrientation(int orient) { m_printerOrient = orient; };
227 void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; };
72cdf4c9 228 void SetPrinterTranslation(wxCoord x, wxCoord y) { m_printerTranslateX = x; m_printerTranslateY = y; };
a6f6393c 229 // 1 = Preview, 2 = print to file, 3 = send to printer
7bcb11d3
JS
230 void SetPrinterMode(int mode) { m_printerMode = mode; };
231 void SetAFMPath(const wxString& f) { m_afmPath = f; };
232 void SetColour(bool col) { m_printColour = col; };
a6f6393c
VZ
233
234 // Get current values
7bcb11d3
JS
235 wxString GetPrinterCommand() const { return m_printerCommand; } ;
236 wxString GetPrintPreviewCommand() const { return m_previewCommand; } ;
237 wxString GetPrinterOptions() const { return m_printerFlags; };
238 wxString GetPrinterFile() const { return m_printerFile; };
239 wxString GetPaperName() const { return m_paperName; }
240 int GetPrinterOrientation() const { return m_printerOrient; };
241 void GetPrinterScaling(double* x, double* y) const { *x = m_printerScaleX; *y = m_printerScaleY; };
72cdf4c9 242 void GetPrinterTranslation(wxCoord *x, wxCoord *y) const { *x = m_printerTranslateX; *y = m_printerTranslateY; };
7bcb11d3
JS
243 int GetPrinterMode() const { return m_printerMode; };
244 wxString GetAFMPath() const { return m_afmPath; };
245 bool GetColour() const { return m_printColour; };
a6f6393c
VZ
246
247 void operator=(wxPrintSetupData& data);
248
7bcb11d3
JS
249 // Initialize from a wxPrintData object (wxPrintData should now be used instead of wxPrintSetupData).
250 // There is also an operator for initializing a wxPrintData from a wxPrintSetupData.
251 void operator=(const wxPrintData& data);
252
72cdf4c9
VZ
253#ifndef __WIN16__
254 void GetPrinterTranslation(long *x, long *y) const
255 { *x = m_printerTranslateX; *y = m_printerTranslateY; }
256#endif // !Win16
257
7bcb11d3
JS
258public:
259 wxString m_printerCommand;
260 wxString m_previewCommand;
261 wxString m_printerFlags;
262 wxString m_printerFile;
263 int m_printerOrient;
264 double m_printerScaleX;
265 double m_printerScaleY;
72cdf4c9
VZ
266 wxCoord m_printerTranslateX;
267 wxCoord m_printerTranslateY;
7bcb11d3
JS
268 // 1 = Preview, 2 = print to file, 3 = send to printer
269 int m_printerMode;
270 wxString m_afmPath;
271 // A name in the paper database (see paper.h)
272 wxString m_paperName;
273 bool m_printColour;
274
72cdf4c9 275 DECLARE_DYNAMIC_CLASS(wxPrintSetupData)
c801d85f
KB
276};
277
184b5d99
JS
278WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData;
279WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE);
c801d85f 280
bf38cbff
JS
281#endif
282 // wxUSE_POSTSCRIPT
72cdf4c9 283
ce4169a4
RR
284#endif
285 // wxUSE_PRINTING_ARCHITECTURE
ed880dd4 286
c801d85f 287#endif
bf38cbff 288 // _WX_DCPSG_H_