]>
git.saurik.com Git - wxWidgets.git/blob - interface/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
11 @headerfile htmprint.h wx/html/htmprint.h
13 This class can render HTML document into a specified area of a DC. You can use
15 in your own printing code, although use of wxHtmlEasyPrinting
16 or wxHtmlPrintout is strongly recommended.
21 class wxHtmlDCRenderer
: public wxObject
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
34 call Render() as long as its return value is smaller than GetTotalHeight's.
39 Renders HTML text to the DC.
42 position of upper-left corner of printing rectangle (see SetSize)
44 y-coordinate of the very first visible cell
46 if @true then this method only returns y coordinate of the next page
47 and does not output anything
49 int Render(int x
, int y
, int from
= 0, int dont_render
= false);
52 Assign DC instance to the renderer.
53 @a pixel_scale can be used when rendering to high-resolution DCs (e.g. printer)
54 to adjust size of pixel metrics.
55 (Many dimensions in HTML are given in pixels -- e.g. image sizes. 300x300 image
57 inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)
59 void SetDC(wxDC
* dc
, double pixel_scale
= 1.0);
62 Sets fonts. See wxHtmlWindow::SetFonts for
66 void SetFonts(const wxString
& normal_face
,
67 const wxString
& fixed_face
,
68 const int sizes
= NULL
);
71 Assign text to the renderer. Render() then draws
75 HTML text. This is not a filename.
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.
80 @false if basepath is filename, @true if it is directory name
81 (see wxFileSystem for detailed explanation)
83 void SetHtmlText(const wxString
& html
,
84 const wxString
& basepath
= wxEmptyString
,
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.)
92 void SetSize(int width
, int height
);
98 @class wxHtmlEasyPrinting
99 @headerfile htmprint.h wx/html/htmprint.h
101 This class provides very simple interface to printing
102 architecture. It allows you to print HTML documents using
108 class wxHtmlEasyPrinting
: public wxObject
115 Name of the printing object. Used by preview frames and setup dialogs.
117 pointer to the window that will own the preview frame and setup dialogs.
120 wxHtmlEasyPrinting(const wxString
& name
= "Printing",
121 wxWindow
* parentWindow
= NULL
);
124 Returns a pointer to wxPageSetupDialogData instance used by
125 this class. You can set its parameters (via SetXXXX methods).
127 wxPageSetupDialogData
* GetPageSetupData();
130 Gets the parent window for dialogs.
132 wxWindow
* GetParentWindow() const;
135 Returns pointer to wxPrintData instance used by this class. You can
136 set its parameters (via SetXXXX methods).
138 wxPrintData
* GetPrintData();
141 Display page setup dialog and allows the user to modify settings.
147 Returns @false in case of error -- call
148 wxPrinter::GetLastError to get detailed
149 information about the kind of the error.
151 bool PreviewFile(const wxString
& htmlfile
);
154 Preview HTML text (not file!).
155 Returns @false in case of error -- call
156 wxPrinter::GetLastError to get detailed
157 information about the kind of the error.
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.
165 bool PreviewText(const wxString
& htmltext
,
166 const wxString
& basepath
= wxEmptyString
);
170 Returns @false in case of error -- call
171 wxPrinter::GetLastError to get detailed
172 information about the kind of the error.
174 bool PrintFile(const wxString
& htmlfile
);
177 Print HTML text (not file!).
178 Returns @false in case of error -- call
179 wxPrinter::GetLastError to get detailed
180 information about the kind of the error.
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.
188 bool PrintText(const wxString
& htmltext
,
189 const wxString
& basepath
= wxEmptyString
);
192 Sets fonts. See wxHtmlWindow::SetFonts for
193 detailed description.
195 void SetFonts(const wxString
& normal_face
,
196 const wxString
& fixed_face
,
197 const int sizes
= NULL
);
200 Set page footer. The following macros can be used inside it:
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
208 HTML text to be used as footer.
210 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
212 void SetFooter(const wxString
& footer
, int pg
= wxPAGE_ALL
);
215 Set page header. The following macros can be used inside it:
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
223 HTML text to be used as header.
225 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
227 void SetHeader(const wxString
& header
, int pg
= wxPAGE_ALL
);
230 Sets the parent window for dialogs.
232 void SetParentWindow(wxWindow
* window
);
238 @class wxHtmlPrintout
239 @headerfile htmprint.h wx/html/htmprint.h
241 This class serves as printout class for HTML documents.
246 class wxHtmlPrintout
: public wxPrintout
252 wxHtmlPrintout(const wxString
& title
= "Printout");
255 Adds a filter to the static list of filters for wxHtmlPrintout. See
259 static void AddFilter(wxHtmlFilter
* filter
);
262 Sets fonts. See wxHtmlWindow::SetFonts for
263 detailed description.
265 void SetFonts(const wxString
& normal_face
,
266 const wxString
& fixed_face
,
267 const int sizes
= NULL
);
270 Set page footer. The following macros can be used inside it:
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
278 HTML text to be used as footer.
280 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
282 void SetFooter(const wxString
& footer
, int pg
= wxPAGE_ALL
);
285 Set page header. The following macros can be used inside it:
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
293 HTML text to be used as header.
295 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
297 void SetHeader(const wxString
& header
, int pg
= wxPAGE_ALL
);
300 Prepare the class for printing this HTML @b file. The file may be located on
301 any virtual file system or it may be normal file.
303 void SetHtmlFile(const wxString
& htmlfile
);
306 Prepare the class for printing this HTML text.
309 HTML text. (NOT file!)
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.
314 @false if basepath is filename, @true if it is directory name
315 (see wxFileSystem for detailed explanation)
317 void SetHtmlText(const wxString
& html
,
318 const wxString
& basepath
= wxEmptyString
,
322 Sets margins in millimeters. Defaults to 1 inch for margins and 0.5cm for space
323 between text and header and/or footer
325 void SetMargins(float top
= 25.2, float bottom
= 25.2,