]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/dcpsg.h
Rewrite selection event code for wxListBox.
[wxWidgets.git] / include / wx / generic / dcpsg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/dcps.h
3 // Purpose: wxPostScriptDC class
4 // Author: Julian Smart and others
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Julian Smart and Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DCPSG_H_
12 #define _WX_DCPSG_H_
13
14 #include "wx/defs.h"
15
16 #if wxUSE_PRINTING_ARCHITECTURE
17
18 #if wxUSE_POSTSCRIPT
19
20 #include "wx/dc.h"
21 #include "wx/dialog.h"
22 #include "wx/module.h"
23 #include "wx/cmndata.h"
24
25 extern WXDLLIMPEXP_DATA_CORE(int) wxPageNumber;
26
27 //-----------------------------------------------------------------------------
28 // classes
29 //-----------------------------------------------------------------------------
30
31 class wxPostScriptDC;
32
33 //-----------------------------------------------------------------------------
34 // wxPostScriptDC
35 //-----------------------------------------------------------------------------
36
37 class WXDLLEXPORT wxPostScriptDC: public wxDC
38 {
39 public:
40 wxPostScriptDC();
41
42 // Recommended constructor
43 wxPostScriptDC(const wxPrintData& printData);
44
45 // Recommended destructor :-)
46 virtual ~wxPostScriptDC();
47
48 virtual bool Ok() const { return IsOk(); }
49 virtual bool IsOk() const;
50
51 bool CanDrawBitmap() const { return true; }
52
53 void Clear();
54 void SetFont( const wxFont& font );
55 void SetPen( const wxPen& pen );
56 void SetBrush( const wxBrush& brush );
57 void SetLogicalFunction( int function );
58 void SetBackground( const wxBrush& brush );
59
60 void DestroyClippingRegion();
61
62 bool StartDoc(const wxString& message);
63 void EndDoc();
64 void StartPage();
65 void EndPage();
66
67 wxCoord GetCharHeight() const;
68 wxCoord GetCharWidth() const;
69 bool CanGetTextExtent() const { return true; }
70
71 // Resolution in pixels per logical inch
72 wxSize GetPPI() const;
73
74 void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
75 void SetDeviceOrigin( wxCoord x, wxCoord y );
76
77 void SetBackgroundMode(int WXUNUSED(mode)) { }
78 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
79
80 wxPrintData& GetPrintData() { return m_printData; }
81 void SetPrintData(const wxPrintData& data) { m_printData = data; }
82
83 virtual int GetDepth() const { return 24; }
84
85 static void SetResolution(int ppi);
86 static int GetResolution();
87
88 void PsPrintf( const wxChar* fmt, ... );
89 void PsPrint( const char* psdata );
90 void PsPrint( int ch );
91
92 #if wxUSE_UNICODE
93 void PsPrint( const wxChar* psdata ) { PsPrint( wxConvUTF8.cWX2MB( psdata ) ); }
94 #endif
95
96 private:
97 static float ms_PSScaleFactor;
98
99 protected:
100 bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE);
101 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
102 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
103 void DoCrossHair(wxCoord x, wxCoord y) ;
104 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
105 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
106 void DoDrawPoint(wxCoord x, wxCoord y);
107 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
108 void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE);
109 void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle = wxODDEVEN_RULE);
110 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
111 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20);
112 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
113 #if wxUSE_SPLINES
114 void DoDrawSpline(wxList *points);
115 #endif // wxUSE_SPLINES
116 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
117 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
118 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
119 void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
120 void DoDrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false);
121 void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
122 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
123 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
124 void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip)) { }
125 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
126 wxCoord *descent = NULL,
127 wxCoord *externalLeading = NULL,
128 wxFont *theFont = NULL) const;
129 void DoGetSize(int* width, int* height) const;
130 void DoGetSizeMM(int *width, int *height) const;
131
132 FILE* m_pstream; // PostScript output stream
133 wxString m_title;
134 unsigned char m_currentRed;
135 unsigned char m_currentGreen;
136 unsigned char m_currentBlue;
137 int m_pageNumber;
138 bool m_clipping;
139 double m_underlinePosition;
140 double m_underlineThickness;
141 wxPrintData m_printData;
142
143 private:
144 DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
145 };
146
147 #endif
148 // wxUSE_POSTSCRIPT
149
150 #endif
151 // wxUSE_PRINTING_ARCHITECTURE
152
153 #endif
154 // _WX_DCPSG_H_