1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-01-22 06:06:20 -05:00
|
|
|
// Name: dcps.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose: wxPostScriptDC class
|
|
|
|
// Author: Julian Smart and others
|
|
|
|
// Modified by:
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 05:34:04 -05:00
|
|
|
// Copyright: (c) Julian Smart and Robert Roebling
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
#ifndef _WX_DCPSG_H_
|
|
|
|
#define _WX_DCPSG_H_
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
2002-05-05 14:27:03 -04:00
|
|
|
#pragma interface "dcpsg.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/dc.h"
|
|
|
|
|
1999-06-15 16:21:59 -04:00
|
|
|
#if wxUSE_PRINTING_ARCHITECTURE
|
|
|
|
|
1998-09-25 09:28:52 -04:00
|
|
|
#if wxUSE_POSTSCRIPT
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
#include "wx/dialog.h"
|
|
|
|
#include "wx/module.h"
|
1999-03-25 18:06:01 -05:00
|
|
|
#include "wx/cmndata.h"
|
1998-10-12 03:46:15 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
1998-12-05 16:53:51 -05:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
class wxPostScriptDC;
|
1998-12-05 16:53:51 -05:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxPostScriptDC
|
|
|
|
//-----------------------------------------------------------------------------
|
1998-12-05 16:53:51 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
class WXDLLEXPORT wxPostScriptDC: public wxDC
|
|
|
|
{
|
1999-01-22 06:06:20 -05:00
|
|
|
public:
|
2003-07-08 07:18:42 -04:00
|
|
|
wxPostScriptDC();
|
1999-03-25 18:06:01 -05:00
|
|
|
|
2003-07-08 07:18:42 -04:00
|
|
|
// Recommended constructor
|
|
|
|
wxPostScriptDC(const wxPrintData& printData);
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2003-07-08 07:18:42 -04:00
|
|
|
// Recommended destructor :-)
|
|
|
|
~wxPostScriptDC();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2002-09-11 18:03:29 -04:00
|
|
|
#if WXWIN_COMPATIBILITY_2_2
|
2004-06-17 12:22:36 -04:00
|
|
|
wxPostScriptDC( const wxString &output, bool interactive = false, wxWindow *parent = NULL )
|
2003-07-08 07:18:42 -04:00
|
|
|
{ Create( output, interactive, parent ); }
|
2004-06-17 12:22:36 -04:00
|
|
|
bool Create ( const wxString &output, bool interactive = false, wxWindow *parent = NULL );
|
2002-09-11 18:03:29 -04:00
|
|
|
#endif
|
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
virtual bool Ok() const;
|
|
|
|
|
|
|
|
virtual void BeginDrawing() {}
|
|
|
|
virtual void EndDrawing() {}
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2002-04-17 07:48:11 -04:00
|
|
|
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
|
1999-10-18 11:14:52 -04:00
|
|
|
bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
|
|
|
|
|
|
|
|
void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
|
|
|
void DoCrossHair(wxCoord x, wxCoord y) ;
|
|
|
|
void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
|
|
|
|
void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
|
|
|
|
void DoDrawPoint(wxCoord x, wxCoord y);
|
|
|
|
void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
|
|
|
|
void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
|
2004-02-29 18:34:01 -05:00
|
|
|
void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
|
|
|
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
|
|
|
|
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
1999-05-14 16:27:41 -04:00
|
|
|
|
|
|
|
void DoDrawSpline(wxList *points);
|
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
2004-06-17 12:22:36 -04:00
|
|
|
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
|
2004-07-20 06:09:47 -04:00
|
|
|
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
|
2004-06-17 12:22:36 -04:00
|
|
|
bool CanDrawBitmap() const { return true; }
|
1999-01-22 06:06:20 -05:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
|
2004-06-17 12:22:36 -04:00
|
|
|
void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false );
|
1999-01-22 06:06:20 -05:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
|
1999-12-06 04:35:27 -05:00
|
|
|
void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-11-29 17:21:32 -05:00
|
|
|
void Clear();
|
1999-01-22 06:06:20 -05:00
|
|
|
void SetFont( const wxFont& font );
|
|
|
|
void SetPen( const wxPen& pen );
|
|
|
|
void SetBrush( const wxBrush& brush );
|
|
|
|
void SetLogicalFunction( int function );
|
|
|
|
void SetBackground( const wxBrush& brush );
|
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
1998-11-29 17:21:32 -05:00
|
|
|
void DestroyClippingRegion();
|
1999-06-08 15:10:37 -04:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) { }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
bool StartDoc(const wxString& message);
|
1998-11-29 17:21:32 -05:00
|
|
|
void EndDoc();
|
|
|
|
void StartPage();
|
|
|
|
void EndPage();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord GetCharHeight() const;
|
|
|
|
wxCoord GetCharWidth() const;
|
2004-06-17 12:22:36 -04:00
|
|
|
bool CanGetTextExtent() const { return true; }
|
1999-10-18 11:14:52 -04:00
|
|
|
void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
|
|
|
|
wxCoord *descent = (wxCoord *) NULL,
|
|
|
|
wxCoord *externalLeading = (wxCoord *) NULL,
|
1999-05-14 16:27:41 -04:00
|
|
|
wxFont *theFont = (wxFont *) NULL ) const;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-05-15 19:40:42 -04:00
|
|
|
void DoGetSize(int* width, int* height) const;
|
|
|
|
void DoGetSizeMM(int *width, int *height) const;
|
1999-03-25 18:06:01 -05:00
|
|
|
|
|
|
|
// Resolution in pixels per logical inch
|
1999-10-18 11:14:52 -04:00
|
|
|
wxSize GetPPI() const;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
1999-10-18 11:14:52 -04:00
|
|
|
void SetDeviceOrigin( wxCoord x, wxCoord y );
|
1999-01-22 06:06:20 -05:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
void SetBackgroundMode(int WXUNUSED(mode)) { }
|
|
|
|
void SetPalette(const wxPalette& WXUNUSED(palette)) { }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-06-08 15:10:37 -04:00
|
|
|
wxPrintData& GetPrintData() { return m_printData; }
|
|
|
|
void SetPrintData(const wxPrintData& data) { m_printData = data; }
|
|
|
|
|
|
|
|
virtual int GetDepth() const { return 24; }
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2000-08-03 17:43:30 -04:00
|
|
|
static void SetResolution(int ppi);
|
|
|
|
static int GetResolution();
|
2004-02-10 17:46:12 -05:00
|
|
|
|
|
|
|
void PsPrintf( const wxChar* fmt, ... );
|
|
|
|
void PsPrint( const char* psdata );
|
|
|
|
void PsPrint( int ch );
|
|
|
|
|
|
|
|
#if wxUSE_UNICODE
|
|
|
|
void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); }
|
|
|
|
#endif
|
|
|
|
|
2004-06-17 12:22:36 -04:00
|
|
|
private:
|
2002-08-17 12:29:05 -04:00
|
|
|
static float ms_PSScaleFactor;
|
1999-03-25 18:06:01 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
protected:
|
2003-07-08 07:18:42 -04:00
|
|
|
#if wxUSE_PANGO
|
|
|
|
PangoContext *m_context;
|
|
|
|
PangoLayout *m_layout;
|
|
|
|
PangoFontDescription *m_fontdesc;
|
|
|
|
#endif
|
|
|
|
|
2002-08-17 12:29:05 -04:00
|
|
|
FILE* m_pstream; // PostScript output stream
|
|
|
|
wxString m_title;
|
|
|
|
unsigned char m_currentRed;
|
|
|
|
unsigned char m_currentGreen;
|
|
|
|
unsigned char m_currentBlue;
|
|
|
|
int m_pageNumber;
|
|
|
|
bool m_clipping;
|
|
|
|
double m_underlinePosition;
|
|
|
|
double m_underlineThickness;
|
|
|
|
wxPrintData m_printData;
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2002-08-17 12:29:05 -04:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
2002-09-13 18:00:45 -04:00
|
|
|
|
|
|
|
#if WXWIN_COMPATIBILITY_2_2
|
|
|
|
// Print Orientation
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PS_PORTRAIT = wxPORTRAIT,
|
|
|
|
PS_LANDSCAPE = wxLANDSCAPE
|
|
|
|
};
|
|
|
|
|
|
|
|
// Print Actions
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PS_NONE = wxPRINT_MODE_NONE,
|
|
|
|
PS_PREVIEW = wxPRINT_MODE_PREVIEW,
|
|
|
|
PS_FILE = wxPRINT_MODE_FILE,
|
|
|
|
PS_PRINTER = wxPRINT_MODE_PRINTER
|
|
|
|
};
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2002-09-13 18:00:45 -04:00
|
|
|
class wxPrintSetupData: public wxPrintData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPrintSetupData() {}
|
2004-06-17 12:22:36 -04:00
|
|
|
|
|
|
|
void SetPrinterOrientation( int orient )
|
2002-09-13 18:00:45 -04:00
|
|
|
{ SetOrientation( orient ); }
|
2004-06-17 12:22:36 -04:00
|
|
|
void SetPrinterMode( wxPrintMode mode )
|
2002-09-13 18:00:45 -04:00
|
|
|
{ SetPrintMode( mode ); }
|
2004-06-17 12:22:36 -04:00
|
|
|
void SetAFMPath( const wxString &path )
|
2002-09-13 18:00:45 -04:00
|
|
|
{ SetFontMetricPath( path ); }
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2002-09-13 18:00:45 -04:00
|
|
|
void SetPaperName(const wxString& paper) { m_paperName = paper; }
|
|
|
|
void SetPrinterFile(const wxString& file) { m_printerFile = file; }
|
|
|
|
wxString GetPaperName() const { return m_paperName; }
|
|
|
|
wxString GetPrinterFile() const { return m_printerFile; };
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2002-09-13 18:00:45 -04:00
|
|
|
wxString m_paperName;
|
|
|
|
wxString m_printerFile;
|
|
|
|
};
|
|
|
|
|
|
|
|
WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData;
|
2004-06-17 12:22:36 -04:00
|
|
|
WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = true);
|
2002-09-13 18:00:45 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1999-01-22 06:06:20 -05:00
|
|
|
#endif
|
|
|
|
// wxUSE_POSTSCRIPT
|
1999-10-18 11:14:52 -04:00
|
|
|
|
1999-06-15 16:21:59 -04:00
|
|
|
#endif
|
|
|
|
// wxUSE_PRINTING_ARCHITECTURE
|
1998-12-05 16:02:04 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
1999-01-22 06:06:20 -05:00
|
|
|
// _WX_DCPSG_H_
|