]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/html/htmprint.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html/htmprint.h
3 // Purpose: interface of wxHtmlDCRenderer
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxHtmlDCRenderer
12 This class can render HTML document into a specified area of a DC. You can use
14 in your own printing code, although use of wxHtmlEasyPrinting
15 or wxHtmlPrintout is strongly recommended.
20 class wxHtmlDCRenderer
: public wxObject
29 Returns the height of the HTML text. This is important if area height (see
30 wxHtmlDCRenderer::SetSize)
31 is smaller that total height and thus the page cannot fit into it. In that case
33 call Render() as long as its return value is smaller than GetTotalHeight's.
38 Renders HTML text to the DC.
41 position of upper-left corner of printing rectangle (see SetSize)
43 y-coordinate of the very first visible cell
45 if @true then this method only returns y coordinate of the next page
46 and does not output anything
48 int Render(int x
, int y
, int from
= 0, int dont_render
= false);
51 Assign DC instance to the renderer.
52 @a pixel_scale can be used when rendering to high-resolution DCs (e.g. printer)
53 to adjust size of pixel metrics.
54 (Many dimensions in HTML are given in pixels -- e.g. image sizes. 300x300 image
56 inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)
58 void SetDC(wxDC
* dc
, double pixel_scale
= 1.0);
61 Sets fonts. See wxHtmlWindow::SetFonts for
65 void SetFonts(const wxString
& normal_face
,
66 const wxString
& fixed_face
,
67 const int sizes
= NULL
);
70 Assign text to the renderer. Render() then draws
74 HTML text. This is not a filename.
76 base directory (html string would be stored there if it was in
77 file). It is used to determine path for loading images, for example.
79 @false if basepath is filename, @true if it is directory name
80 (see wxFileSystem for detailed explanation)
82 void SetHtmlText(const wxString
& html
,
83 const wxString
& basepath
= wxEmptyString
,
87 Set size of output rectangle, in pixels. Note that you @b can't change
88 width of the rectangle between calls to wxHtmlDCRenderer::Render!
89 (You can freely change height.)
91 void SetSize(int width
, int height
);
97 @class wxHtmlEasyPrinting
99 This class provides very simple interface to printing
100 architecture. It allows you to print HTML documents using
106 class wxHtmlEasyPrinting
: public wxObject
113 Name of the printing object. Used by preview frames and setup dialogs.
115 pointer to the window that will own the preview frame and setup dialogs.
118 wxHtmlEasyPrinting(const wxString
& name
= "Printing",
119 wxWindow
* parentWindow
= NULL
);
122 Returns a pointer to wxPageSetupDialogData instance used by
123 this class. You can set its parameters (via SetXXXX methods).
125 wxPageSetupDialogData
* GetPageSetupData();
128 Gets the parent window for dialogs.
130 wxWindow
* GetParentWindow() const;
133 Returns pointer to wxPrintData instance used by this class. You can
134 set its parameters (via SetXXXX methods).
136 wxPrintData
* GetPrintData();
139 Display page setup dialog and allows the user to modify settings.
145 Returns @false in case of error -- call
146 wxPrinter::GetLastError to get detailed
147 information about the kind of the error.
149 bool PreviewFile(const wxString
& htmlfile
);
152 Preview HTML text (not file!).
153 Returns @false in case of error -- call
154 wxPrinter::GetLastError to get detailed
155 information about the kind of the error.
160 base directory (html string would be stored there if it was in
161 file). It is used to determine path for loading images, for example.
163 bool PreviewText(const wxString
& htmltext
,
164 const wxString
& basepath
= wxEmptyString
);
168 Returns @false in case of error -- call
169 wxPrinter::GetLastError to get detailed
170 information about the kind of the error.
172 bool PrintFile(const wxString
& htmlfile
);
175 Print HTML text (not file!).
176 Returns @false in case of error -- call
177 wxPrinter::GetLastError to get detailed
178 information about the kind of the error.
183 base directory (html string would be stored there if it was in
184 file). It is used to determine path for loading images, for example.
186 bool PrintText(const wxString
& htmltext
,
187 const wxString
& basepath
= wxEmptyString
);
190 Sets fonts. See wxHtmlWindow::SetFonts for
191 detailed description.
193 void SetFonts(const wxString
& normal_face
,
194 const wxString
& fixed_face
,
195 const int sizes
= NULL
);
198 Set page footer. The following macros can be used inside it:
199 @@DATE@ is replaced by the current date in default format
200 @@PAGENUM@ is replaced by page number
201 @@PAGESCNT@ is replaced by total number of pages
202 @@TIME@ is replaced by the current time in default format
203 @@TITLE@ is replaced with the title of the document
206 HTML text to be used as footer.
208 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
210 void SetFooter(const wxString
& footer
, int pg
= wxPAGE_ALL
);
213 Set page header. The following macros can be used inside it:
214 @@DATE@ is replaced by the current date in default format
215 @@PAGENUM@ is replaced by page number
216 @@PAGESCNT@ is replaced by total number of pages
217 @@TIME@ is replaced by the current time in default format
218 @@TITLE@ is replaced with the title of the document
221 HTML text to be used as header.
223 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
225 void SetHeader(const wxString
& header
, int pg
= wxPAGE_ALL
);
228 Sets the parent window for dialogs.
230 void SetParentWindow(wxWindow
* window
);
236 @class wxHtmlPrintout
238 This class serves as printout class for HTML documents.
243 class wxHtmlPrintout
: public wxPrintout
249 wxHtmlPrintout(const wxString
& title
= "Printout");
252 Adds a filter to the static list of filters for wxHtmlPrintout. See
256 static void AddFilter(wxHtmlFilter
* filter
);
259 Sets fonts. See wxHtmlWindow::SetFonts for
260 detailed description.
262 void SetFonts(const wxString
& normal_face
,
263 const wxString
& fixed_face
,
264 const int sizes
= NULL
);
267 Set page footer. The following macros can be used inside it:
268 @@DATE@ is replaced by the current date in default format
269 @@PAGENUM@ is replaced by page number
270 @@PAGESCNT@ is replaced by total number of pages
271 @@TIME@ is replaced by the current time in default format
272 @@TITLE@ is replaced with the title of the document
275 HTML text to be used as footer.
277 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
279 void SetFooter(const wxString
& footer
, int pg
= wxPAGE_ALL
);
282 Set page header. The following macros can be used inside it:
283 @@DATE@ is replaced by the current date in default format
284 @@PAGENUM@ is replaced by page number
285 @@PAGESCNT@ is replaced by total number of pages
286 @@TIME@ is replaced by the current time in default format
287 @@TITLE@ is replaced with the title of the document
290 HTML text to be used as header.
292 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
294 void SetHeader(const wxString
& header
, int pg
= wxPAGE_ALL
);
297 Prepare the class for printing this HTML @b file. The file may be located on
298 any virtual file system or it may be normal file.
300 void SetHtmlFile(const wxString
& htmlfile
);
303 Prepare the class for printing this HTML text.
306 HTML text. (NOT file!)
308 base directory (html string would be stored there if it was in
309 file). It is used to determine path for loading images, for example.
311 @false if basepath is filename, @true if it is directory name
312 (see wxFileSystem for detailed explanation)
314 void SetHtmlText(const wxString
& html
,
315 const wxString
& basepath
= wxEmptyString
,
319 Sets margins in millimeters. Defaults to 1 inch for margins and 0.5cm for space
320 between text and header and/or footer
322 void SetMargins(float top
= 25.2, float bottom
= 25.2,