/usr/include/wx-3.0/wx/gtk/print.h is in wx3.0-headers 3.0.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | /////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/print.h
// Author: Anthony Bretaudeau
// Purpose: GTK printing support
// Created: 2007-08-25
// Copyright: (c) Anthony Bretaudeau
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRINT_H_
#define _WX_GTK_PRINT_H_
#include "wx/defs.h"
#if wxUSE_GTKPRINT
#include "wx/print.h"
#include "wx/printdlg.h"
#include "wx/prntbase.h"
#include "wx/dc.h"
typedef struct _GtkPrintOperation GtkPrintOperation;
typedef struct _GtkPrintContext GtkPrintContext;
typedef struct _GtkPrintSettings GtkPrintSettings;
typedef struct _GtkPageSetup GtkPageSetup;
typedef struct _cairo cairo_t;
//----------------------------------------------------------------------------
// wxGtkPrintFactory
//----------------------------------------------------------------------------
class wxGtkPrintFactory: public wxPrintFactory
{
public:
virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
wxPrintout *printout = NULL,
wxPrintDialogData *data = NULL );
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
wxPrintout *printout,
wxPrintData *data );
virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
wxPrintDialogData *data = NULL );
virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
wxPrintData *data );
virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
wxPageSetupDialogData * data = NULL );
virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
virtual bool HasPrintSetupDialog();
virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
virtual bool HasOwnPrintToFile();
virtual bool HasPrinterLine();
virtual wxString CreatePrinterLine();
virtual bool HasStatusLine();
virtual wxString CreateStatusLine();
virtual wxPrintNativeDataBase *CreatePrintNativeData();
};
//----------------------------------------------------------------------------
// wxGtkPrintDialog
//----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrintDialog: public wxPrintDialogBase
{
public:
wxGtkPrintDialog( wxWindow *parent,
wxPrintDialogData* data = NULL );
wxGtkPrintDialog( wxWindow *parent, wxPrintData* data);
virtual ~wxGtkPrintDialog();
wxPrintData& GetPrintData()
{ return m_printDialogData.GetPrintData(); }
wxPrintDialogData& GetPrintDialogData()
{ return m_printDialogData; }
wxDC *GetPrintDC() { return m_dc; }
void SetPrintDC(wxDC * printDC) { m_dc = printDC; }
virtual int ShowModal();
virtual bool Validate() { return true; }
virtual bool TransferDataToWindow() { return true; }
virtual bool TransferDataFromWindow() { return true; }
void SetShowDialog(bool show) { m_showDialog = show; }
bool GetShowDialog() { return m_showDialog; }
protected:
// Implement some base class methods to do nothing to avoid asserts and
// GTK warnings, since this is not a real wxDialog.
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height)) {}
private:
wxPrintDialogData m_printDialogData;
wxWindow *m_parent;
bool m_showDialog;
wxDC *m_dc;
DECLARE_DYNAMIC_CLASS(wxGtkPrintDialog)
};
//----------------------------------------------------------------------------
// wxGtkPageSetupDialog
//----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPageSetupDialog: public wxPageSetupDialogBase
{
public:
wxGtkPageSetupDialog( wxWindow *parent,
wxPageSetupDialogData* data = NULL );
virtual ~wxGtkPageSetupDialog();
virtual wxPageSetupDialogData& GetPageSetupDialogData() { return m_pageDialogData; }
virtual int ShowModal();
virtual bool Validate() { return true; }
virtual bool TransferDataToWindow() { return true; }
virtual bool TransferDataFromWindow() { return true; }
protected:
// Implement some base class methods to do nothing to avoid asserts and
// GTK warnings, since this is not a real wxDialog.
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height)) {}
private:
wxPageSetupDialogData m_pageDialogData;
wxWindow *m_parent;
DECLARE_DYNAMIC_CLASS(wxGtkPageSetupDialog)
};
//----------------------------------------------------------------------------
// wxGtkPrinter
//----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrinter : public wxPrinterBase
{
public:
wxGtkPrinter(wxPrintDialogData *data = NULL);
virtual ~wxGtkPrinter();
virtual bool Print(wxWindow *parent,
wxPrintout *printout,
bool prompt = true);
virtual wxDC* PrintDialog(wxWindow *parent);
virtual bool Setup(wxWindow *parent);
GtkPrintContext *GetPrintContext() { return m_gpc; }
void SetPrintContext(GtkPrintContext *context) {m_gpc = context;}
void BeginPrint(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context);
void DrawPage(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context, int page_nr);
private:
GtkPrintContext *m_gpc;
wxDC *m_dc;
DECLARE_DYNAMIC_CLASS(wxGtkPrinter)
wxDECLARE_NO_COPY_CLASS(wxGtkPrinter);
};
//----------------------------------------------------------------------------
// wxGtkPrintNativeData
//----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrintNativeData : public wxPrintNativeDataBase
{
public:
wxGtkPrintNativeData();
virtual ~wxGtkPrintNativeData();
virtual bool TransferTo( wxPrintData &data );
virtual bool TransferFrom( const wxPrintData &data );
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const { return true; }
GtkPrintSettings* GetPrintConfig() { return m_config; }
void SetPrintConfig( GtkPrintSettings * config );
GtkPrintOperation* GetPrintJob() { return m_job; }
void SetPrintJob(GtkPrintOperation *job) { m_job = job; }
GtkPrintContext *GetPrintContext() { return m_context; }
void SetPrintContext(GtkPrintContext *context) {m_context = context; }
GtkPageSetup* GetPageSetupFromSettings(GtkPrintSettings* settings);
void SetPageSetupToSettings(GtkPrintSettings* settings, GtkPageSetup* page_setup);
private:
// NB: m_config is created and owned by us, but the other objects are not
// and their accessors don't change their ref count.
GtkPrintSettings *m_config;
GtkPrintOperation *m_job;
GtkPrintContext *m_context;
DECLARE_DYNAMIC_CLASS(wxGtkPrintNativeData)
};
//-----------------------------------------------------------------------------
// wxGtkPrinterDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrinterDCImpl : public wxDCImpl
{
public:
wxGtkPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
virtual ~wxGtkPrinterDCImpl();
bool Ok() const { return IsOk(); }
bool IsOk() const;
virtual void* GetCairoContext() const;
virtual void* GetHandle() const;
bool CanDrawBitmap() const { return true; }
void Clear();
void SetFont( const wxFont& font );
void SetPen( const wxPen& pen );
void SetBrush( const wxBrush& brush );
void SetLogicalFunction( wxRasterOperationMode function );
void SetBackground( const wxBrush& brush );
void DestroyClippingRegion();
bool StartDoc(const wxString& message);
void EndDoc();
void StartPage();
void EndPage();
wxCoord GetCharHeight() const;
wxCoord GetCharWidth() const;
bool CanGetTextExtent() const { return true; }
wxSize GetPPI() const;
virtual int GetDepth() const { return 24; }
void SetBackgroundMode(int mode);
void SetPalette(const wxPalette& WXUNUSED(palette)) { }
void SetResolution(int ppi);
// overridden for wxPrinterDC Impl
virtual int GetResolution() const;
virtual wxRect GetPaperRect() const;
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col,
wxFloodFillStyle style=wxFLOOD_SURFACE );
void DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter);
void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection = wxEAST);
bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
void DoCrossHair(wxCoord x, wxCoord y);
void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc);
void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea);
void DoDrawPoint(wxCoord x, wxCoord y);
void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0);
void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE);
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES
void DoDrawSpline(const wxPointList *points);
#endif
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y );
void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false );
void DoDrawText(const wxString& text, wxCoord x, wxCoord y );
void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip) )
{
wxFAIL_MSG( "not implemented" );
}
void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
wxCoord *descent = NULL,
wxCoord *externalLeading = NULL,
const wxFont *theFont = NULL ) const;
void DoGetSize(int* width, int* height) const;
void DoGetSizeMM(int *width, int *height) const;
wxPrintData& GetPrintData() { return m_printData; }
void SetPrintData(const wxPrintData& data);
private:
wxPrintData m_printData;
PangoContext *m_context;
PangoLayout *m_layout;
PangoFontDescription *m_fontdesc;
cairo_t *m_cairo;
unsigned char m_currentRed;
unsigned char m_currentGreen;
unsigned char m_currentBlue;
unsigned char m_currentAlpha;
GtkPrintContext *m_gpc;
int m_resolution;
double m_PS2DEV;
double m_DEV2PS;
DECLARE_DYNAMIC_CLASS(wxGtkPrinterDCImpl)
wxDECLARE_NO_COPY_CLASS(wxGtkPrinterDCImpl);
};
// ----------------------------------------------------------------------------
// wxGtkPrintPreview: programmer creates an object of this class to preview a
// wxPrintout.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrintPreview : public wxPrintPreviewBase
{
public:
wxGtkPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting = NULL,
wxPrintDialogData *data = NULL);
wxGtkPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintData *data);
virtual ~wxGtkPrintPreview();
virtual bool Print(bool interactive);
virtual void DetermineScaling();
private:
void Init(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintData *data);
// resolution to use in DPI
int m_resolution;
DECLARE_CLASS(wxGtkPrintPreview)
};
#endif // wxUSE_GTKPRINT
#endif // _WX_GTK_PRINT_H_
|