]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: dcps.h | |
3 | // Purpose: wxPostScriptDC class | |
4 | // Author: Julian Smart and others | |
5 | // Modified by: | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) Julian Smart, Robert Roebling and Markus Holzem | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef __GTKDCPSH__ | |
12 | #define __GTKDCPSNH__ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | #include "wx/dc.h" | |
19 | #include "wx/dialog.h" | |
20 | #include "wx/module.h" | |
21 | #include <fstream.h> | |
22 | ||
23 | #if wxUSE_POSTSCRIPT | |
24 | ||
25 | //----------------------------------------------------------------------------- | |
26 | // classes | |
27 | //----------------------------------------------------------------------------- | |
28 | ||
29 | class wxPostScriptDC; | |
30 | ||
31 | //----------------------------------------------------------------------------- | |
32 | // wxPostScriptDC | |
33 | //----------------------------------------------------------------------------- | |
34 | ||
35 | class WXDLLEXPORT wxPostScriptDC: public wxDC | |
36 | { | |
37 | DECLARE_DYNAMIC_CLASS(wxPostScriptDC) | |
38 | ||
39 | public: | |
40 | ||
41 | wxPostScriptDC(); | |
42 | wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL); | |
43 | ||
44 | ~wxPostScriptDC(); | |
45 | ||
46 | bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL); | |
47 | ||
48 | virtual bool Ok() const; | |
49 | ||
50 | virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL); | |
51 | ||
52 | virtual void BeginDrawing() {} | |
53 | virtual void EndDrawing() {} | |
54 | ||
55 | void FloodFill(long x1, long y1, const wxColour &col, int style=wxFLOOD_SURFACE) ; | |
56 | bool GetPixel(long x1, long y1, wxColour *col) const; | |
57 | ||
58 | void DrawLine(long x1, long y1, long x2, long y2); | |
59 | void CrossHair(long x, long y) ; | |
60 | void DrawArc(long x1,long y1,long x2,long y2,long xc,long yc); | |
61 | void DrawEllipticArc(long x,long y,long w,long h,double sa,double ea); | |
62 | void DrawPoint(long x, long y); | |
63 | // Avoid compiler warning | |
64 | void DrawPoint(wxPoint& point) { wxDC::DrawPoint(point); } | |
65 | void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0); | |
66 | // Avoid compiler warning | |
67 | void DrawLines(wxList *lines, long xoffset = 0, long yoffset = 0) | |
68 | { wxDC::DrawLines(lines, xoffset, yoffset); } | |
69 | void DrawPolygon(int n, wxPoint points[], long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE); | |
70 | // Avoid compiler warning | |
71 | void DrawPolygon(wxList *lines, long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE) | |
72 | { wxDC::DrawPolygon(lines, xoffset, yoffset, fillStyle); } | |
73 | void DrawRectangle(long x, long y, long width, long height); | |
74 | void DrawRoundedRectangle(long x, long y, long width, long height, double radius = 20); | |
75 | void DrawEllipse(long x, long y, long width, long height); | |
76 | ||
77 | void DrawSpline(wxList *points); | |
78 | ||
79 | bool Blit(long xdest, long ydest, long width, long height, | |
80 | wxDC *source, long xsrc, long ysrc, int rop = wxCOPY, bool useMask = FALSE); | |
81 | inline bool CanDrawBitmap(void) const { return TRUE; } | |
82 | ||
83 | void DrawIcon( const wxIcon& icon, long x, long y ); | |
84 | void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE ); | |
85 | ||
86 | void DrawText(const wxString& text, long x, long y, bool use16 = FALSE); | |
87 | ||
88 | void Clear(); | |
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 | ||
95 | void SetClippingRegion(long x, long y, long width, long height); | |
96 | void SetClippingRegion( const wxRegion ®ion ); | |
97 | void DestroyClippingRegion(); | |
98 | ||
99 | bool StartDoc(const wxString& message); | |
100 | void EndDoc(); | |
101 | void StartPage(); | |
102 | void EndPage(); | |
103 | ||
104 | long GetCharHeight(); | |
105 | long GetCharWidth(); | |
106 | inline bool CanGetTextExtent(void) const { return FALSE; } | |
107 | void GetTextExtent(const wxString& string, long *x, long *y, | |
108 | long *descent = (long *) NULL, | |
109 | long *externalLeading = (long *) NULL, | |
110 | wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE); | |
111 | ||
112 | void GetSize(int* width, int* height) const; | |
113 | void GetSizeMM(long *width, long *height) const; | |
114 | ||
115 | void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); | |
116 | void SetDeviceOrigin( long x, long y ); | |
117 | ||
118 | inline void SetBackgroundMode(int WXUNUSED(mode)) {} | |
119 | inline void SetPalette(const wxPalette& WXUNUSED(palette)) {} | |
120 | ||
121 | inline ofstream *GetStream(void) const { return m_pstream; } | |
122 | ||
123 | protected: | |
124 | ||
125 | ofstream * m_pstream; // PostScript output stream | |
126 | wxString m_title; | |
127 | unsigned char m_currentRed; | |
128 | unsigned char m_currentGreen; | |
129 | unsigned char m_currentBlue; | |
130 | int m_pageNumber; | |
131 | bool m_clipping; | |
132 | double m_underlinePosition; | |
133 | double m_underlineThickness; | |
134 | }; | |
135 | ||
136 | #endif | |
137 | // wxUSE_POSTSCRIPT | |
138 | ||
139 | #endif | |
140 | // __GTKDCPSH__ |