]> git.saurik.com Git - wxWidgets.git/blame - interface/html/htmprint.h
Build fix for non-pch builds, e.g. for universal binary building.
[wxWidgets.git] / interface / html / htmprint.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: html/htmprint.h
e54c96f1 3// Purpose: interface of wxHtmlDCRenderer
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxHtmlDCRenderer
11 @headerfile htmprint.h wx/html/htmprint.h
7c913512 12
23324ae1
FM
13 This class can render HTML document into a specified area of a DC. You can use
14 it
7c913512 15 in your own printing code, although use of wxHtmlEasyPrinting
23324ae1 16 or wxHtmlPrintout is strongly recommended.
7c913512 17
23324ae1
FM
18 @library{wxhtml}
19 @category{FIXME}
20*/
21class wxHtmlDCRenderer : public wxObject
22{
23public:
24 /**
25 Constructor.
26 */
27 wxHtmlDCRenderer();
28
29 /**
30 Returns the height of the HTML text. This is important if area height (see
31 wxHtmlDCRenderer::SetSize)
32 is smaller that total height and thus the page cannot fit into it. In that case
33 you're supposed to
34 call Render() as long as its return value is smaller than GetTotalHeight's.
35 */
36 int GetTotalHeight();
37
38 /**
39 Renders HTML text to the DC.
40
7c913512 41 @param x,y
4cc4bfaf 42 position of upper-left corner of printing rectangle (see SetSize)
7c913512 43 @param from
4cc4bfaf 44 y-coordinate of the very first visible cell
7c913512 45 @param dont_render
4cc4bfaf
FM
46 if @true then this method only returns y coordinate of the next page
47 and does not output anything
23324ae1 48 */
4cc4bfaf 49 int Render(int x, int y, int from = 0, int dont_render = false);
23324ae1
FM
50
51 /**
52 Assign DC instance to the renderer.
4cc4bfaf 53 @a pixel_scale can be used when rendering to high-resolution DCs (e.g. printer)
23324ae1
FM
54 to adjust size of pixel metrics.
55 (Many dimensions in HTML are given in pixels -- e.g. image sizes. 300x300 image
56 would be only one
57 inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)
58 */
4cc4bfaf 59 void SetDC(wxDC* dc, double pixel_scale = 1.0);
23324ae1
FM
60
61 /**
62 Sets fonts. See wxHtmlWindow::SetFonts for
63 detailed description.
23324ae1
FM
64 See also SetSize().
65 */
66 void SetFonts(const wxString& normal_face,
67 const wxString& fixed_face,
4cc4bfaf 68 const int sizes = NULL);
23324ae1
FM
69
70 /**
7c913512 71 Assign text to the renderer. Render() then draws
23324ae1
FM
72 the text onto DC.
73
7c913512 74 @param html
4cc4bfaf 75 HTML text. This is not a filename.
7c913512 76 @param basepath
4cc4bfaf
FM
77 base directory (html string would be stored there if it was in
78 file). It is used to determine path for loading images, for example.
7c913512 79 @param isdir
4cc4bfaf
FM
80 @false if basepath is filename, @true if it is directory name
81 (see wxFileSystem for detailed explanation)
23324ae1
FM
82 */
83 void SetHtmlText(const wxString& html,
84 const wxString& basepath = wxEmptyString,
4cc4bfaf 85 bool isdir = true);
23324ae1
FM
86
87 /**
88 Set size of output rectangle, in pixels. Note that you @b can't change
89 width of the rectangle between calls to wxHtmlDCRenderer::Render!
90 (You can freely change height.)
91 */
92 void SetSize(int width, int height);
93};
94
95
e54c96f1 96
23324ae1
FM
97/**
98 @class wxHtmlEasyPrinting
99 @headerfile htmprint.h wx/html/htmprint.h
7c913512
FM
100
101 This class provides very simple interface to printing
23324ae1 102 architecture. It allows you to print HTML documents using
7c913512
FM
103 only a few commands.
104
23324ae1
FM
105 @library{wxhtml}
106 @category{html}
107*/
108class wxHtmlEasyPrinting : public wxObject
109{
110public:
111 /**
112 Constructor.
113
7c913512 114 @param name
4cc4bfaf 115 Name of the printing object. Used by preview frames and setup dialogs.
7c913512 116 @param parentWindow
4cc4bfaf
FM
117 pointer to the window that will own the preview frame and setup dialogs.
118 May be @NULL.
23324ae1
FM
119 */
120 wxHtmlEasyPrinting(const wxString& name = "Printing",
4cc4bfaf 121 wxWindow* parentWindow = NULL);
23324ae1
FM
122
123 /**
7c913512 124 Returns a pointer to wxPageSetupDialogData instance used by
23324ae1
FM
125 this class. You can set its parameters (via SetXXXX methods).
126 */
127 wxPageSetupDialogData* GetPageSetupData();
128
129 /**
130 Gets the parent window for dialogs.
131 */
328f5751 132 wxWindow* GetParentWindow() const;
23324ae1
FM
133
134 /**
135 Returns pointer to wxPrintData instance used by this class. You can
136 set its parameters (via SetXXXX methods).
137 */
138 wxPrintData* GetPrintData();
139
140 /**
141 Display page setup dialog and allows the user to modify settings.
142 */
143 void PageSetup();
144
145 /**
7c913512 146 Preview HTML file.
23324ae1
FM
147 Returns @false in case of error -- call
148 wxPrinter::GetLastError to get detailed
149 information about the kind of the error.
150 */
151 bool PreviewFile(const wxString& htmlfile);
152
153 /**
7c913512 154 Preview HTML text (not file!).
23324ae1
FM
155 Returns @false in case of error -- call
156 wxPrinter::GetLastError to get detailed
157 information about the kind of the error.
158
7c913512 159 @param htmltext
4cc4bfaf 160 HTML text.
7c913512 161 @param basepath
4cc4bfaf
FM
162 base directory (html string would be stored there if it was in
163 file). It is used to determine path for loading images, for example.
23324ae1
FM
164 */
165 bool PreviewText(const wxString& htmltext,
166 const wxString& basepath = wxEmptyString);
167
168 /**
169 Print HTML file.
23324ae1
FM
170 Returns @false in case of error -- call
171 wxPrinter::GetLastError to get detailed
172 information about the kind of the error.
173 */
174 bool PrintFile(const wxString& htmlfile);
175
176 /**
7c913512 177 Print HTML text (not file!).
23324ae1
FM
178 Returns @false in case of error -- call
179 wxPrinter::GetLastError to get detailed
180 information about the kind of the error.
181
7c913512 182 @param htmltext
4cc4bfaf 183 HTML text.
7c913512 184 @param basepath
4cc4bfaf
FM
185 base directory (html string would be stored there if it was in
186 file). It is used to determine path for loading images, for example.
23324ae1
FM
187 */
188 bool PrintText(const wxString& htmltext,
189 const wxString& basepath = wxEmptyString);
190
191 /**
192 Sets fonts. See wxHtmlWindow::SetFonts for
193 detailed description.
194 */
195 void SetFonts(const wxString& normal_face,
196 const wxString& fixed_face,
4cc4bfaf 197 const int sizes = NULL);
23324ae1
FM
198
199 /**
200 Set page footer. The following macros can be used inside it:
23324ae1
FM
201 @DATE@ is replaced by the current date in default format
202 @PAGENUM@ is replaced by page number
203 @PAGESCNT@ is replaced by total number of pages
204 @TIME@ is replaced by the current time in default format
205 @TITLE@ is replaced with the title of the document
206
7c913512 207 @param footer
4cc4bfaf 208 HTML text to be used as footer.
7c913512 209 @param pg
4cc4bfaf 210 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
23324ae1
FM
211 */
212 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
213
214 /**
215 Set page header. The following macros can be used inside it:
23324ae1
FM
216 @DATE@ is replaced by the current date in default format
217 @PAGENUM@ is replaced by page number
218 @PAGESCNT@ is replaced by total number of pages
219 @TIME@ is replaced by the current time in default format
220 @TITLE@ is replaced with the title of the document
221
7c913512 222 @param header
4cc4bfaf 223 HTML text to be used as header.
7c913512 224 @param pg
4cc4bfaf 225 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
23324ae1
FM
226 */
227 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
228
229 /**
230 Sets the parent window for dialogs.
231 */
232 void SetParentWindow(wxWindow* window);
233};
234
235
e54c96f1 236
23324ae1
FM
237/**
238 @class wxHtmlPrintout
239 @headerfile htmprint.h wx/html/htmprint.h
7c913512 240
23324ae1 241 This class serves as printout class for HTML documents.
7c913512 242
23324ae1
FM
243 @library{wxhtml}
244 @category{html}
245*/
246class wxHtmlPrintout : public wxPrintout
247{
248public:
249 /**
250 Constructor.
251 */
252 wxHtmlPrintout(const wxString& title = "Printout");
253
254 /**
255 Adds a filter to the static list of filters for wxHtmlPrintout. See
256 wxHtmlFilter for
257 further information.
258 */
259 static void AddFilter(wxHtmlFilter* filter);
260
261 /**
262 Sets fonts. See wxHtmlWindow::SetFonts for
263 detailed description.
264 */
265 void SetFonts(const wxString& normal_face,
266 const wxString& fixed_face,
4cc4bfaf 267 const int sizes = NULL);
23324ae1
FM
268
269 /**
270 Set page footer. The following macros can be used inside it:
23324ae1
FM
271 @DATE@ is replaced by the current date in default format
272 @PAGENUM@ is replaced by page number
273 @PAGESCNT@ is replaced by total number of pages
274 @TIME@ is replaced by the current time in default format
275 @TITLE@ is replaced with the title of the document
276
7c913512 277 @param footer
4cc4bfaf 278 HTML text to be used as footer.
7c913512 279 @param pg
4cc4bfaf 280 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
23324ae1
FM
281 */
282 void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
283
284 /**
285 Set page header. The following macros can be used inside it:
23324ae1
FM
286 @DATE@ is replaced by the current date in default format
287 @PAGENUM@ is replaced by page number
288 @PAGESCNT@ is replaced by total number of pages
289 @TIME@ is replaced by the current time in default format
290 @TITLE@ is replaced with the title of the document
291
7c913512 292 @param header
4cc4bfaf 293 HTML text to be used as header.
7c913512 294 @param pg
4cc4bfaf 295 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
23324ae1
FM
296 */
297 void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
298
299 /**
7c913512 300 Prepare the class for printing this HTML @b file. The file may be located on
23324ae1
FM
301 any virtual file system or it may be normal file.
302 */
303 void SetHtmlFile(const wxString& htmlfile);
304
305 /**
306 Prepare the class for printing this HTML text.
307
7c913512 308 @param html
4cc4bfaf 309 HTML text. (NOT file!)
7c913512 310 @param basepath
4cc4bfaf
FM
311 base directory (html string would be stored there if it was in
312 file). It is used to determine path for loading images, for example.
7c913512 313 @param isdir
4cc4bfaf
FM
314 @false if basepath is filename, @true if it is directory name
315 (see wxFileSystem for detailed explanation)
23324ae1
FM
316 */
317 void SetHtmlText(const wxString& html,
318 const wxString& basepath = wxEmptyString,
4cc4bfaf 319 bool isdir = true);
23324ae1
FM
320
321 /**
322 Sets margins in millimeters. Defaults to 1 inch for margins and 0.5cm for space
323 between text and header and/or footer
324 */
325 void SetMargins(float top = 25.2, float bottom = 25.2,
326 float left = 25.2,
327 float right = 25.2,
328 float spaces = 5);
329};
e54c96f1 330