// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifndef __POSTSCRPH__
-#define __POSTSCRPH__
+#ifndef _WX_POSTSCRPH__
+#define _WX_POSTSCRPH__
#ifdef __GNUG__
#pragma interface "postscrp.h"
#include "wx/dc.h"
#include "wx/dialog.h"
+#include "wx/module.h"
-#if USE_POSTSCRIPT
+#if wxUSE_POSTSCRIPT
+
+// A module to allow initialization/cleanup of PostScript-related
+// things without calling these functions from app.cpp.
+
+class WXDLLEXPORT wxPostScriptModule: public wxModule
+{
+DECLARE_DYNAMIC_CLASS(wxPostScriptModule)
+public:
+ wxPostScriptModule() {}
+ bool OnInit();
+ void OnExit();
+};
+
+#if wxUSE_IOSTREAMH
+# include <fstream.h>
+#else
+# include <fstream>
+# ifdef _MSC_VER
+ using namespace std;
+# endif
+#endif
-class WXDLLIMPORT ofstream;
class WXDLLEXPORT wxPostScriptDC: public wxDC
{
DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
public:
// Create a printer DC
- wxPostScriptDC(void);
- wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow *parent = NULL);
+ wxPostScriptDC();
+ wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
- ~wxPostScriptDC(void);
+ ~wxPostScriptDC();
- bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = NULL);
+ bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
- virtual bool PrinterDialog(wxWindow *parent = NULL);
+ virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL);
inline virtual void BeginDrawing(void) {} ;
inline virtual void EndDrawing(void) {} ;
- void FloodFill(long x1, long y1, wxColour *col, int style=wxFLOOD_SURFACE) ;
+ void FloodFill(long x1, long y1, const wxColour &col, int style=wxFLOOD_SURFACE) ;
bool GetPixel(long x1, long y1, wxColour *col) const;
void DrawLine(long x1, long y1, long x2, long y2);
void DrawRoundedRectangle(long x, long y, long width, long height, double radius = 20);
void DrawEllipse(long x, long y, long width, long height);
- // RR: I define these in wxDC, after all they all do the same everywhere
-
-#ifdef __WINDOWS__
- // Splines
- // 3-point spline
- void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3);
- // Any number of control points - a list of pointers to wxPoints
void DrawSpline(wxList *points);
- void DrawSpline(int n, wxPoint points[]);
-#endif
- void DrawOpenSpline(wxList *points);
-
- void DrawIcon(const wxIcon& icon, long x, long y);
+ void DrawIcon( const wxIcon& icon, long x, long y );
+ void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE );
void DrawText(const wxString& text, long x, long y, bool use16 = FALSE);
- void Clear(void);
+ void Clear();
void SetFont(const wxFont& font);
void SetPen(const wxPen& pen);
void SetBrush(const wxBrush& brush);
void SetLogicalFunction(int function);
void SetBackground(const wxBrush& brush);
+
void SetClippingRegion(long x, long y, long width, long height);
- void DestroyClippingRegion(void);
+ void SetClippingRegion( const wxRegion ®ion );
+ void DestroyClippingRegion();
bool StartDoc(const wxString& message);
- void EndDoc(void);
- void StartPage(void);
- void EndPage(void);
+ void EndDoc();
+ void StartPage();
+ void EndPage();
- long GetCharHeight(void);
- long GetCharWidth(void);
+ long GetCharHeight();
+ long GetCharWidth();
void GetTextExtent(const wxString& string, long *x, long *y,
- long *descent = NULL, long *externalLeading = NULL,
- wxFont *theFont = NULL, bool use16 = FALSE);
+ long *descent = (long *) NULL,
+ long *externalLeading = (long *) NULL,
+ wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE);
virtual void SetLogicalOrigin(long x, long y);
virtual void CalcBoundingBox(long x, long y);
DECLARE_CLASS(wxPostScriptPrintDialog)
public:
wxPostScriptPrintDialog (wxWindow *parent, const wxString& title,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_DIALOG_STYLE);
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE);
virtual int ShowModal(void) ;
};
};// ps_action = PS_PREVIEW;
// PostScript printer settings
-void WXDLLEXPORT wxSetPrinterCommand(char *cmd);
-void WXDLLEXPORT wxSetPrintPreviewCommand(char *cmd);
-void WXDLLEXPORT wxSetPrinterOptions(char *flags);
-void WXDLLEXPORT wxSetPrinterOrientation(int orientation);
-void WXDLLEXPORT wxSetPrinterScaling(double x, double y);
-void WXDLLEXPORT wxSetPrinterTranslation(long x, long y);
-void WXDLLEXPORT wxSetPrinterMode(int mode);
-void WXDLLEXPORT wxSetPrinterFile(char *f);
-void WXDLLEXPORT wxSetAFMPath(char *f);
+WXDLLEXPORT void wxSetPrinterCommand(const char *cmd);
+WXDLLEXPORT void wxSetPrintPreviewCommand(const char *cmd);
+WXDLLEXPORT void wxSetPrinterOptions(const char *flags);
+WXDLLEXPORT void wxSetPrinterOrientation(int orientation);
+WXDLLEXPORT void wxSetPrinterScaling(double x, double y);
+WXDLLEXPORT void wxSetPrinterTranslation(long x, long y);
+WXDLLEXPORT void wxSetPrinterMode(int mode);
+WXDLLEXPORT void wxSetPrinterFile(const char *f);
+WXDLLEXPORT void wxSetAFMPath(const char *f);
// Get current values
-char* WXDLLEXPORT wxGetPrinterCommand(void);
-char* WXDLLEXPORT wxGetPrintPreviewCommand(void);
-char* WXDLLEXPORT wxGetPrinterOptions(void);
-int WXDLLEXPORT wxGetPrinterOrientation(void);
-void WXDLLEXPORT wxGetPrinterScaling(double* x, double* y);
-void WXDLLEXPORT wxGetPrinterTranslation(long *x, long *y);
-int WXDLLEXPORT wxGetPrinterMode(void);
-char* WXDLLEXPORT wxGetPrinterFile(void);
-char* WXDLLEXPORT wxGetAFMPath(void);
+WXDLLEXPORT char* wxGetPrinterCommand();
+WXDLLEXPORT char* wxGetPrintPreviewCommand();
+WXDLLEXPORT char* wxGetPrinterOptions();
+WXDLLEXPORT int wxGetPrinterOrientation();
+WXDLLEXPORT void wxGetPrinterScaling(double* x, double* y);
+WXDLLEXPORT void wxGetPrinterTranslation(long *x, long *y);
+WXDLLEXPORT int wxGetPrinterMode();
+WXDLLEXPORT char* wxGetPrinterFile();
+WXDLLEXPORT char* wxGetAFMPath();
/*
* PostScript print setup information
class WXDLLEXPORT wxPrintSetupData: public wxObject
{
- DECLARE_DYNAMIC_CLASS(wxPrintSetupData)
+public:
+ char *printerCommand;
+ char *previewCommand;
+ char *printerFlags;
+ char *printerFile;
+ int printerOrient;
+ double printerScaleX;
+ double printerScaleY;
+ long printerTranslateX;
+ long printerTranslateY;
+ // 1 = Preview, 2 = print to file, 3 = send to printer
+ int printerMode;
+ char *afmPath;
+ // A name in the paper database (see wx_print.h: the printing framework)
+ char *paperName;
+ bool printColour;
- public:
- char *printerCommand;
- char *previewCommand;
- char *printerFlags;
- char *printerFile;
- int printerOrient;
- double printerScaleX;
- double printerScaleY;
- long printerTranslateX;
- long printerTranslateY;
- // 1 = Preview, 2 = print to file, 3 = send to printer
- int printerMode;
- char *afmPath;
- // A name in the paper database (see wx_print.h: the printing framework)
- char *paperName;
- bool printColour;
- public:
- wxPrintSetupData(void);
- ~wxPrintSetupData(void);
-
- void SetPrinterCommand(char *cmd);
- void SetPaperName(char *paper);
- void SetPrintPreviewCommand(char *cmd);
- void SetPrinterOptions(char *flags);
- void SetPrinterFile(char *f);
- void SetPrinterOrientation(int orient);
- void SetPrinterScaling(double x, double y);
- void SetPrinterTranslation(long x, long y);
- // 1 = Preview, 2 = print to file, 3 = send to printer
- void SetPrinterMode(int mode);
- void SetAFMPath(char *f);
- void SetColour(bool col);
-
- // Get current values
- char *GetPrinterCommand(void);
- char *GetPrintPreviewCommand(void);
- char *GetPrinterOptions(void);
- char *GetPrinterFile(void);
- char *GetPaperName(void);
- int GetPrinterOrientation(void);
- void GetPrinterScaling(double* x, double* y);
- void GetPrinterTranslation(long *x, long *y);
- int GetPrinterMode(void);
- char *GetAFMPath(void);
- bool GetColour(void);
-
- void operator=(wxPrintSetupData& data);
+public:
+ wxPrintSetupData();
+ ~wxPrintSetupData();
+
+ void SetPrinterCommand(const char *cmd);
+ void SetPaperName(const char *paper);
+ void SetPrintPreviewCommand(const char *cmd);
+ void SetPrinterOptions(const char *flags);
+ void SetPrinterFile(const char *f);
+ void SetPrinterOrientation(int orient);
+ void SetPrinterScaling(double x, double y);
+ void SetPrinterTranslation(long x, long y);
+ // 1 = Preview, 2 = print to file, 3 = send to printer
+ void SetPrinterMode(int mode);
+ void SetAFMPath(const char *f);
+ void SetColour(bool col);
+
+ // Get current values
+ char *GetPrinterCommand();
+ char *GetPrintPreviewCommand();
+ char *GetPrinterOptions();
+ char *GetPrinterFile();
+ char *GetPaperName();
+ int GetPrinterOrientation();
+ void GetPrinterScaling(double* x, double* y);
+ void GetPrinterTranslation(long *x, long *y);
+ int GetPrinterMode();
+ char *GetAFMPath();
+ bool GetColour();
+
+ void operator=(wxPrintSetupData& data);
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrintSetupData)
};
-extern wxPrintSetupData* WXDLLEXPORT wxThePrintSetupData;
-extern void WXDLLEXPORT wxInitializePrintSetupData(bool init = TRUE);
+WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData;
+WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE);
/*
* Again, this only really needed for non-Windows platforms
class WXDLLEXPORT wxPrintPaperType: public wxObject
{
- DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
+public:
+ wxPrintPaperType(const char *name = (const char *) NULL, int wmm = 0, int hmm = 0, int wp = 0, int hp = 0);
+ ~wxPrintPaperType();
- public:
- int widthMM;
- int heightMM;
- int widthPixels;
- int heightPixels;
- char *pageName;
-
- wxPrintPaperType(char *name = NULL, int wmm = 0, int hmm = 0, int wp = 0, int hp = 0);
- ~wxPrintPaperType(void);
+public:
+ int widthMM;
+ int heightMM;
+ int widthPixels;
+ int heightPixels;
+ char *pageName;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrintPaperType)
};
class WXDLLEXPORT wxPrintPaperDatabase: public wxList
{
- DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
+public:
+ wxPrintPaperDatabase();
+ ~wxPrintPaperDatabase();
- public:
- wxPrintPaperDatabase(void);
- ~wxPrintPaperDatabase(void);
+ void CreateDatabase();
+ void ClearDatabase();
- void CreateDatabase(void);
- void ClearDatabase(void);
+ void AddPaperType(const char *name, int wmm, int hmm, int wp, int hp);
+ wxPrintPaperType *FindPaperType(const char *name);
- void AddPaperType(char *name, int wmm, int hmm, int wp, int hp);
- wxPrintPaperType *FindPaperType(char *name);
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrintPaperDatabase)
};
WXDLLEXPORT_DATA(extern wxPrintPaperDatabase*) wxThePrintPaperDatabase;
-#endif // USE_POSTSCRIPT
+#endif // wxUSE_POSTSCRIPT
#endif
- // __POSTSCRPH__
+ // _WX_POSTSCRPH__