]>
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 PrinterDialog(wxWindow *parent = (wxWindow *) NULL); | |
49 | ||
50 | inline virtual void BeginDrawing(void) {} ; | |
51 | inline virtual void EndDrawing(void) {} ; | |
52 | ||
53 | void FloodFill(long x1, long y1, const wxColour &col, int style=wxFLOOD_SURFACE) ; | |
54 | bool GetPixel(long x1, long y1, wxColour *col) const; | |
55 | ||
56 | void DrawLine(long x1, long y1, long x2, long y2); | |
57 | void CrossHair(long x, long y) ; | |
58 | void DrawArc(long x1,long y1,long x2,long y2,long xc,long yc); | |
59 | void DrawEllipticArc(long x,long y,long w,long h,double sa,double ea); | |
60 | void DrawPoint(long x, long y); | |
61 | // Avoid compiler warning | |
62 | void DrawPoint(wxPoint& point) { wxDC::DrawPoint(point); } | |
63 | void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0); | |
64 | // Avoid compiler warning | |
65 | void DrawLines(wxList *lines, long xoffset = 0, long yoffset = 0) | |
66 | { wxDC::DrawLines(lines, xoffset, yoffset); } | |
67 | void DrawPolygon(int n, wxPoint points[], long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE); | |
68 | // Avoid compiler warning | |
69 | void DrawPolygon(wxList *lines, long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE) | |
70 | { wxDC::DrawPolygon(lines, xoffset, yoffset, fillStyle); } | |
71 | void DrawRectangle(long x, long y, long width, long height); | |
72 | void DrawRoundedRectangle(long x, long y, long width, long height, double radius = 20); | |
73 | void DrawEllipse(long x, long y, long width, long height); | |
74 | ||
75 | void DrawSpline(wxList *points); | |
76 | ||
77 | bool Blit(long xdest, long ydest, long width, long height, | |
78 | wxDC *source, long xsrc, long ysrc, int rop = wxCOPY, bool useMask = FALSE); | |
79 | inline bool CanDrawBitmap(void) const { return TRUE; } | |
80 | ||
81 | void DrawIcon( const wxIcon& icon, long x, long y ); | |
82 | void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE ); | |
83 | ||
84 | ||
85 | void DrawText(const wxString& text, long x, long y, bool use16 = FALSE); | |
86 | ||
87 | void Clear(); | |
88 | void SetFont( const wxFont& font ); | |
89 | void SetPen( const wxPen& pen ); | |
90 | void SetBrush( const wxBrush& brush ); | |
91 | void SetLogicalFunction( int function ); | |
92 | void SetBackground( const wxBrush& brush ); | |
93 | ||
94 | void SetClippingRegion(long x, long y, long width, long height); | |
95 | void SetClippingRegion( const wxRegion ®ion ); | |
96 | void DestroyClippingRegion(); | |
97 | ||
98 | bool StartDoc(const wxString& message); | |
99 | void EndDoc(); | |
100 | void StartPage(); | |
101 | void EndPage(); | |
102 | ||
103 | long GetCharHeight(); | |
104 | long GetCharWidth(); | |
105 | inline bool CanGetTextExtent(void) const { return FALSE; } | |
106 | void GetTextExtent(const wxString& string, long *x, long *y, | |
107 | long *descent = (long *) NULL, | |
108 | long *externalLeading = (long *) NULL, | |
109 | wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE); | |
110 | ||
111 | void GetSize(int* width, int* height) const; | |
112 | void GetSizeMM(long *width, long *height) const; | |
113 | ||
114 | void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); | |
115 | void SetDeviceOrigin( long x, long y ); | |
116 | ||
117 | inline void SetBackgroundMode(int WXUNUSED(mode)) {}; | |
118 | inline void SetPalette(const wxPalette& WXUNUSED(palette)) {} | |
119 | ||
120 | inline ofstream *GetStream(void) const { return m_pstream; } | |
121 | ||
122 | protected: | |
123 | ||
124 | ofstream * m_pstream; // PostScript output stream | |
125 | wxString m_title; | |
126 | unsigned char m_currentRed; | |
127 | unsigned char m_currentGreen; | |
128 | unsigned char m_currentBlue; | |
129 | int m_pageNumber; | |
130 | bool m_clipping; | |
131 | double m_underlinePosition; | |
132 | double m_underlineThickness; | |
133 | }; | |
134 | ||
135 | #endif | |
136 | // wxUSE_POSTSCRIPT | |
137 | ||
138 | #endif | |
139 | // __GTKDCPSH__ |