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