Newer
Older
/***********************************************************************
* FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
* Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For further information please contact the author by e-mail
* at "lyle@lylejohnson.name".
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
***********************************************************************/
class FXApp;
class FXDrawable;
class FXImage;
class FXBitmap;
class FXIcon;
class FXFont;
/// Printer flags
enum FXPrintFlags {
PRINT_DEST_PAPER = 0, /// Send print to paper
PRINT_DEST_FILE = 1, /// Send print to file
PRINT_PAGES_ALL = 0, /// Print all pages
PRINT_PAGES_EVEN = 2, /// Print even pages only
PRINT_PAGES_ODD = 4, /// Print odd pages only
PRINT_PAGES_RANGE = 8, /// Print range of pages
PRINT_COLLATE_NORMAL = 0, /// Normal collate order
PRINT_COLLATE_REVERSED = 16, /// Reversed collate order
PRINT_PORTRAIT = 0, /// Portrait orientation
PRINT_LANDSCAPE = 32, /// Landscape orientation
PRINT_BLACKANDWHITE = 0, /// Black and white output
PRINT_COLOR = 64, /// Color output
PRINT_NOBOUNDS = 128 /// Must determine bounding box
};
/// Printer media size
enum FXMediaSize {
MEDIA_CUSTOM = 0, /// Custom paper size
MEDIA_USLETTER = 1, /// US Letter size
MEDIA_LEGAL = 2, /// US Legal size
MEDIA_A4 = 3, /// A4
MEDIA_ENVELOPE = 4 /// #10 Envelope
};
/// Bounding box
struct FXPSBounds {
FXPSBounds();
FXdouble xmin;
FXdouble xmax;
FXdouble ymin;
FXdouble ymax;
~FXPSBounds();
};
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
/// Describes printer
struct FXPrinter {
FXPrinter();
FXString name; /// Printer name
FXuint firstpage; /// First page that can be printed
FXuint lastpage; /// Last page that can be printed
FXuint currentpage; /// Current page to print
FXuint frompage; /// On output, this is the first page to print
FXuint topage; /// On output, last page to print
FXuint mediasize; /// Media size index
FXdouble mediawidth; /// Width of paper in points [1/72 of an inch]
FXdouble mediaheight; /// Height of paper in points
FXdouble leftmargin; /// Left margin
FXdouble rightmargin; /// Right margin
FXdouble topmargin; /// Top margin
FXdouble bottommargin; /// Bottom margin
FXuint numcopies; /// Number of copies
FXuint flags; /// Flags
~FXPrinter();
};
/// Postscript Printer Device Context
class FXDCPrint : public FXDC {
protected:
void *psout; // File Stream for PS output
FXFont *font;
FXuint flags;
FXint Xr,Yr;
FXdouble mediawidth; // Media width
FXdouble mediaheight; // Media height
FXPSBounds mediabb; // Media bounding box
FXPSBounds docbb; // Document bounding box
FXPSBounds pagebb; // Page bounding box
FXint pagecount; // Number of pages printed
FXint nchars; // Number of characters on a line
FXint pxmin; // min X coord in content
FXint pymin; // min Y coord in content
FXint pxmax; // max X coord in content
FXint pymax; // max Y coord in content
protected:
void bbox(FXfloat x,FXfloat y);
void tfm(FXfloat& xo,FXfloat& yo,FXfloat xi,FXfloat yi);
public:
%extend {
/// Construct
FXDCPrint(FXApp* a){
return new FXRbDCPrint(a);
}
}
/// Generate print job prolog
FXbool beginPrint(FXPrinter& job);
/// Generate print job epilog
FXbool endPrint();
/// Generate begin of page
FXbool beginPage(FXuint page=1);
/// Generate end of page
FXbool endPage();