]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/gnome/gprint.h
Added GetTempDir change log
[wxWidgets.git] / include / wx / gtk / gnome / gprint.h
CommitLineData
ff910433 1/////////////////////////////////////////////////////////////////////////////
389076f1 2// Name: wx/gtk/gnome/gprint.h
ff910433
RR
3// Author: Robert Roebling
4// Purpose: GNOME printing support
5// Created: 09/20/04
389076f1 6// RCS-ID: $Id$
ff910433 7// Copyright: Robert Roebling
7c72311f 8// Licence: wxWindows Licence
ff910433
RR
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef __gprint_H__
12#define __gprint_H__
13
ff910433
RR
14// Include wxWindows' headers
15
20ceebaa 16#include "wx/defs.h"
ff910433 17
7c72311f
RR
18#if wxUSE_LIBGNOMEPRINT
19
ff910433 20#include "wx/print.h"
ff910433 21#include "wx/printdlg.h"
20ceebaa 22#include "wx/dc.h"
ff910433
RR
23
24typedef struct _GnomePrintJob GnomePrintJob;
25typedef struct _GnomePrintContext GnomePrintContext;
26typedef struct _GnomePrintConfig GnomePrintConfig;
27
28//----------------------------------------------------------------------------
29// wxGnomePrintNativeData
30//----------------------------------------------------------------------------
31
32class wxGnomePrintNativeData: public wxPrintNativeDataBase
33{
34public:
35 wxGnomePrintNativeData();
36 virtual ~wxGnomePrintNativeData();
389076f1 37
ff910433
RR
38 virtual bool TransferTo( wxPrintData &data );
39 virtual bool TransferFrom( const wxPrintData &data );
389076f1 40
b7cacb43
VZ
41 virtual bool Ok() const { return IsOk(); }
42 virtual bool IsOk() const { return true; }
389076f1 43
ff910433 44 GnomePrintConfig* GetPrintConfig() { return m_config; }
cffcf831 45 void SetPrintJob( GnomePrintJob *job ) { m_job = job; }
ff910433 46 GnomePrintJob* GetPrintJob() { return m_job; }
389076f1
WS
47
48
ff910433
RR
49private:
50 GnomePrintConfig *m_config;
51 GnomePrintJob *m_job;
389076f1 52
ff910433
RR
53private:
54 DECLARE_DYNAMIC_CLASS(wxGnomePrintNativeData)
55};
389076f1 56
ff910433
RR
57//----------------------------------------------------------------------------
58// wxGnomePrintFactory
59//----------------------------------------------------------------------------
60
61class wxGnomePrintFactory: public wxPrintFactory
62{
63public:
64 virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );
389076f1
WS
65
66 virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
67 wxPrintout *printout = NULL,
ff910433 68 wxPrintDialogData *data = NULL );
389076f1 69 virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
ff910433
RR
70 wxPrintout *printout,
71 wxPrintData *data );
389076f1
WS
72
73 virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
ff910433 74 wxPrintDialogData *data = NULL );
389076f1 75 virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
ff910433 76 wxPrintData *data );
08680429
RR
77
78 virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
79 wxPageSetupDialogData * data = NULL );
389076f1 80
ff910433
RR
81 virtual bool HasPrintSetupDialog();
82 virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
83 virtual bool HasOwnPrintToFile();
84 virtual bool HasPrinterLine();
85 virtual wxString CreatePrinterLine();
86 virtual bool HasStatusLine();
87 virtual wxString CreateStatusLine();
389076f1 88
ff910433
RR
89 virtual wxPrintNativeDataBase *CreatePrintNativeData();
90};
91
92//----------------------------------------------------------------------------
2934005d 93// wxGnomePrintDialog
ff910433
RR
94//----------------------------------------------------------------------------
95
2934005d 96class wxGnomePrintDialog: public wxPrintDialogBase
ff910433
RR
97{
98public:
2934005d 99 wxGnomePrintDialog( wxWindow *parent,
08680429 100 wxPrintDialogData* data = NULL );
2934005d 101 wxGnomePrintDialog( wxWindow *parent, wxPrintData* data);
d3c7fc99 102 virtual ~wxGnomePrintDialog();
2934005d
RR
103
104 wxPrintData& GetPrintData()
105 { return m_printDialogData.GetPrintData(); }
106 wxPrintDialogData& GetPrintDialogData()
107 { return m_printDialogData; }
389076f1 108
2934005d 109 wxDC *GetPrintDC();
ff910433
RR
110
111 virtual int ShowModal();
112
113 virtual bool Validate();
114 virtual bool TransferDataToWindow();
115 virtual bool TransferDataFromWindow();
116
389076f1 117private:
ff910433
RR
118 // Implement some base class methods to do nothing to avoid asserts and
119 // GTK warnings, since this is not a real wxDialog.
120 virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
121 int WXUNUSED(width), int WXUNUSED(height),
122 int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
123 virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
124 int WXUNUSED(width), int WXUNUSED(height)) {}
389076f1 125
2934005d
RR
126 void Init();
127 wxPrintDialogData m_printDialogData;
389076f1 128
ff910433 129private:
2934005d 130 DECLARE_DYNAMIC_CLASS(wxGnomePrintDialog)
ff910433
RR
131};
132
133//----------------------------------------------------------------------------
08680429
RR
134// wxGnomePageSetupDialog
135//----------------------------------------------------------------------------
136
137class wxGnomePageSetupDialog: public wxPageSetupDialogBase
138{
139public:
140 wxGnomePageSetupDialog( wxWindow *parent,
141 wxPageSetupDialogData* data = NULL );
d3c7fc99 142 virtual ~wxGnomePageSetupDialog();
08680429
RR
143
144 virtual wxPageSetupDialogData& GetPageSetupDialogData();
145
146 virtual int ShowModal();
147
148 virtual bool Validate();
149 virtual bool TransferDataToWindow();
150 virtual bool TransferDataFromWindow();
151
389076f1 152private:
08680429
RR
153 // Implement some base class methods to do nothing to avoid asserts and
154 // GTK warnings, since this is not a real wxDialog.
155 virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
156 int WXUNUSED(width), int WXUNUSED(height),
157 int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
158 virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
159 int WXUNUSED(width), int WXUNUSED(height)) {}
389076f1 160
08680429 161 wxPageSetupDialogData m_pageDialogData;
389076f1 162
08680429
RR
163private:
164 DECLARE_DYNAMIC_CLASS(wxGnomePageSetupDialog)
165};
166
167//----------------------------------------------------------------------------
ff910433
RR
168// wxGnomePrinter
169//----------------------------------------------------------------------------
170
171class wxGnomePrinter: public wxPrinterBase
172{
173public:
174 wxGnomePrinter(wxPrintDialogData *data = NULL);
175 virtual ~wxGnomePrinter();
176
177 virtual bool Print(wxWindow *parent,
178 wxPrintout *printout,
179 bool prompt = true);
180 virtual wxDC* PrintDialog(wxWindow *parent);
181 virtual bool Setup(wxWindow *parent);
389076f1 182
ff910433 183 GnomePrintContext *GetPrintContext() { return m_gpc; }
389076f1 184
ff910433
RR
185private:
186 GnomePrintContext *m_gpc;
0be7709e 187 bool m_native_preview;
ff910433
RR
188
189private:
190 DECLARE_DYNAMIC_CLASS(wxGnomePrinter)
191 DECLARE_NO_COPY_CLASS(wxGnomePrinter)
192};
193
194//-----------------------------------------------------------------------------
195// wxGnomePrintDC
196//-----------------------------------------------------------------------------
197
198class wxGnomePrintDC: public wxDC
199{
200public:
201 wxGnomePrintDC( wxGnomePrinter *printer );
d3c7fc99 202 virtual ~wxGnomePrintDC();
389076f1 203
b7cacb43
VZ
204 bool Ok() const { return IsOk(); }
205 bool IsOk() const;
389076f1 206
ff910433
RR
207 bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
208 bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
209 void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
210 void DoCrossHair(wxCoord x, wxCoord y);
211 void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
212 void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
213 void DoDrawPoint(wxCoord x, wxCoord y);
214 void DoDrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
215 void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
216 void DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fillStyle=wxODDEVEN_RULE);
217 void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
218 void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
219 void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
389076f1 220#if wxUSE_SPLINES
ff910433 221 void DoDrawSpline(wxList *points);
389076f1
WS
222#endif // wxUSE_SPLINES
223
ff910433
RR
224 bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
225 wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
226 wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
227 void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
228 void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false );
229 bool CanDrawBitmap() const { return true; }
389076f1 230
ff910433
RR
231 void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
232 void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
233 void Clear();
234 void SetFont( const wxFont& font );
235 void SetPen( const wxPen& pen );
236 void SetBrush( const wxBrush& brush );
237 void SetLogicalFunction( int function );
238 void SetBackground( const wxBrush& brush );
389076f1 239
ff910433
RR
240 void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
241 void DestroyClippingRegion();
242 void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) { }
389076f1 243
ff910433
RR
244 bool StartDoc(const wxString& message);
245 void EndDoc();
246 void StartPage();
247 void EndPage();
389076f1 248
ff910433
RR
249 wxCoord GetCharHeight() const;
250 wxCoord GetCharWidth() const;
251 bool CanGetTextExtent() const { return true; }
252 void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
253 wxCoord *descent = (wxCoord *) NULL,
254 wxCoord *externalLeading = (wxCoord *) NULL,
255 wxFont *theFont = (wxFont *) NULL ) const;
389076f1 256
ff910433
RR
257 void DoGetSize(int* width, int* height) const;
258 void DoGetSizeMM(int *width, int *height) const;
259 wxSize GetPPI() const;
260 void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
261 void SetDeviceOrigin( wxCoord x, wxCoord y );
389076f1 262
ff910433 263 virtual int GetDepth() const { return 24; }
389076f1 264
ff910433
RR
265 void SetBackgroundMode(int WXUNUSED(mode)) { }
266 void SetPalette(const wxPalette& WXUNUSED(palette)) { }
389076f1 267
ff910433
RR
268 wxPrintData& GetPrintData() { return m_printData; }
269 void SetPrintData(const wxPrintData& data) { m_printData = data; }
389076f1 270
ff910433
RR
271 static void SetResolution(int ppi);
272 static int GetResolution();
273
274private:
275 static float ms_PSScaleFactor;
389076f1 276
ff910433
RR
277private:
278 PangoContext *m_context;
279 PangoLayout *m_layout;
280 PangoFontDescription *m_fontdesc;
389076f1 281
ff910433
RR
282 unsigned char m_currentRed;
283 unsigned char m_currentGreen;
284 unsigned char m_currentBlue;
285 wxPrintData m_printData;
389076f1 286
ff910433
RR
287 wxGnomePrinter *m_printer;
288 GnomePrintContext *m_gpc;
289
74ab0bfb
RR
290 void makeEllipticalPath(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
291
ff910433
RR
292private:
293 wxCoord XDEV2LOG(wxCoord x) const
294 {
295 wxCoord new_x = x - m_deviceOriginX;
296 if (new_x > 0)
297 return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
298 else
299 return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
300 }
301 wxCoord XDEV2LOGREL(wxCoord x) const
302 {
303 if (x > 0)
304 return (wxCoord)((double)(x) / m_scaleX + 0.5);
305 else
306 return (wxCoord)((double)(x) / m_scaleX - 0.5);
307 }
308 wxCoord YDEV2LOG(wxCoord y) const
309 {
310 wxCoord new_y = y - m_deviceOriginY;
311 if (new_y > 0)
312 return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
313 else
314 return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
315 }
316 wxCoord YDEV2LOGREL(wxCoord y) const
317 {
318 if (y > 0)
319 return (wxCoord)((double)(y) / m_scaleY + 0.5);
320 else
321 return (wxCoord)((double)(y) / m_scaleY - 0.5);
322 }
323 wxCoord XLOG2DEV(wxCoord x) const
324 {
325 wxCoord new_x = x - m_logicalOriginX;
326 if (new_x > 0)
327 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
328 else
329 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
330 }
331 wxCoord XLOG2DEVREL(wxCoord x) const
332 {
333 if (x > 0)
334 return (wxCoord)((double)(x) * m_scaleX + 0.5);
335 else
336 return (wxCoord)((double)(x) * m_scaleX - 0.5);
337 }
338 wxCoord YLOG2DEV(wxCoord y) const
339 {
340 wxCoord new_y = y - m_logicalOriginY;
341 if (new_y > 0)
342 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
343 else
344 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
345 }
346 wxCoord YLOG2DEVREL(wxCoord y) const
347 {
348 if (y > 0)
349 return (wxCoord)((double)(y) * m_scaleY + 0.5);
350 else
351 return (wxCoord)((double)(y) * m_scaleY - 0.5);
352 }
353private:
354 DECLARE_DYNAMIC_CLASS(wxGnomePrintDC)
355 DECLARE_NO_COPY_CLASS(wxGnomePrintDC)
356};
357
7c72311f
RR
358#endif
359 // wxUSE_LIBGNOMEPRINT
360
ff910433 361#endif