]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/dcpsg.h
GTK+ doesn't like slider with min=max values
[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
eb7637b5 16#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
c801d85f 17
e7445ff8 18#include "wx/dc.h"
4f37154e 19#include "wx/dcprint.h"
bf38cbff
JS
20#include "wx/dialog.h"
21#include "wx/module.h"
7bcb11d3 22#include "wx/cmndata.h"
c9f78968 23#include "wx/strvararg.h"
fbc535ff 24
bf38cbff
JS
25//-----------------------------------------------------------------------------
26// wxPostScriptDC
27//-----------------------------------------------------------------------------
f04371f0 28
4f37154e
RR
29
30#if wxUSE_NEW_DC
31
32class WXDLLEXPORT wxPostScriptDC : public wxDC
33{
34public:
35 wxPostScriptDC();
36
37 // Recommended constructor
38 wxPostScriptDC(const wxPrintData& printData);
39
40private:
41 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
42};
43
44#endif
45
46#if wxUSE_NEW_DC
47class WXDLLEXPORT wxPostScriptImplDC : public wxImplDC
48#else
49#define wxPostScriptImplDC wxPostScriptDC
50class WXDLLEXPORT wxPostScriptDC : public wxDC
51#endif
c801d85f 52{
bf38cbff 53public:
4f37154e
RR
54#if wxUSE_NEW_DC
55 wxPostScriptImplDC( wxPrinterDC *owner );
56 wxPostScriptImplDC( wxPrinterDC *owner, const wxPrintData& data );
57 wxPostScriptImplDC( wxPostScriptDC *owner );
58 wxPostScriptImplDC( wxPostScriptDC *owner, const wxPrintData& data );
59#else
3a97d2db 60 wxPostScriptDC();
7bcb11d3 61
3a97d2db
RR
62 // Recommended constructor
63 wxPostScriptDC(const wxPrintData& printData);
4f37154e 64#endif
04ab8b6d 65
4f37154e
RR
66 void Init();
67
68 virtual ~wxPostScriptImplDC();
c801d85f 69
04ab8b6d
RR
70 virtual bool Ok() const { return IsOk(); }
71 virtual bool IsOk() const;
bf38cbff 72
04ab8b6d 73 bool CanDrawBitmap() const { return true; }
bf38cbff 74
04ab8b6d
RR
75 void Clear();
76 void SetFont( const wxFont& font );
77 void SetPen( const wxPen& pen );
78 void SetBrush( const wxBrush& brush );
79 void SetLogicalFunction( int function );
80 void SetBackground( const wxBrush& brush );
bf38cbff 81
04ab8b6d 82 void DestroyClippingRegion();
af0bb3b1 83
04ab8b6d
RR
84 bool StartDoc(const wxString& message);
85 void EndDoc();
86 void StartPage();
87 void EndPage();
c801d85f 88
04ab8b6d
RR
89 wxCoord GetCharHeight() const;
90 wxCoord GetCharWidth() const;
91 bool CanGetTextExtent() const { return true; }
7bcb11d3 92
04ab8b6d
RR
93 // Resolution in pixels per logical inch
94 wxSize GetPPI() const;
c801d85f 95
eb7637b5
RR
96#if wxUSE_NEW_DC
97#else
04ab8b6d
RR
98 // these need to be overridden as wxPostscriptDC inherits
99 // from the platform dependent wxDC and this we'd call
100 // e.g. wxMSW specific code here.
eb7637b5 101 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
04ab8b6d
RR
102 virtual void SetMapMode(int mode);
103 virtual void SetUserScale(double x, double y);
104 virtual void SetLogicalScale(double x, double y);
105 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
106 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
eb7637b5 107#endif
c0845ad3 108 virtual void ComputeScaleAndOrigin();
bf38cbff 109
04ab8b6d
RR
110 void SetBackgroundMode(int WXUNUSED(mode)) { }
111 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
c801d85f 112
04ab8b6d
RR
113 void SetPrintData(const wxPrintData& data);
114 wxPrintData& GetPrintData() { return m_printData; }
af0bb3b1 115
04ab8b6d 116 virtual int GetDepth() const { return 24; }
ca65c044 117
04ab8b6d 118 void PsPrint( const wxString& psdata );
4f37154e
RR
119
120 // Overrridden for wxPrinterDC Impl
121
122 virtual int GetResolution();
123 virtual wxRect GetPaperRect();
7bcb11d3 124
c801d85f 125protected:
6f02a879
VZ
126 bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE);
127 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
128 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
129 void DoCrossHair(wxCoord x, wxCoord y) ;
130 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
131 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
132 void DoDrawPoint(wxCoord x, wxCoord y);
133 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
134 void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE);
135 void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE);
136 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
137 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
138 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
139#if wxUSE_SPLINES
b0d7707b 140 void DoDrawSpline(const wxPointList *points);
4f37154e 141#endif
6f02a879
VZ
142 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
143 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
144 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
145 void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
146 void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false);
147 void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
148 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
149 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
150 void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip)) { }
151 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
152 wxCoord *descent = NULL,
153 wxCoord *externalLeading = NULL,
c94f845b 154 const wxFont *theFont = NULL) const;
6f02a879
VZ
155 void DoGetSize(int* width, int* height) const;
156 void DoGetSizeMM(int *width, int *height) const;
3a97d2db 157
eba33006
RR
158 FILE* m_pstream; // PostScript output stream
159 wxString m_title;
160 unsigned char m_currentRed;
161 unsigned char m_currentGreen;
162 unsigned char m_currentBlue;
163 int m_pageNumber;
164 bool m_clipping;
165 double m_underlinePosition;
166 double m_underlineThickness;
167 wxPrintData m_printData;
eb7637b5 168 double m_pageHeight;
ca65c044 169
eba33006 170private:
4f37154e 171 DECLARE_DYNAMIC_CLASS(wxPostScriptImplDC)
c801d85f
KB
172};
173
bf38cbff 174#endif
eb7637b5 175 // wxUSE_POSTSCRIPT && wxUSE_PRINTING_ARCHITECTURE
ed880dd4 176
c801d85f 177#endif
bf38cbff 178 // _WX_DCPSG_H_