]>
git.saurik.com Git - wxWidgets.git/blob - interface/html/htmprint.h
07c6476c89b58c7e5b04d9ba83b0be7873e8a39e
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: html/htmprint.h
3 // Purpose: documentation for wxHtmlDCRenderer class
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)
45 y-coordinate of the very first visible cell
48 if @true then this method only returns y coordinate of the next page
49 and does not output anything
51 int Render(int x
, int y
, int from
= 0, int dont_render
= @
false);
54 Assign DC instance to the renderer.
56 @e pixel_scale can be used when rendering to high-resolution DCs (e.g. printer)
57 to adjust size of pixel metrics.
58 (Many dimensions in HTML are given in pixels -- e.g. image sizes. 300x300 image
60 inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)
62 #define void SetDC(wxDC* dc, double pixel_scale = 1.0) /* implementation is private */
65 Sets fonts. See wxHtmlWindow::SetFonts for
70 void SetFonts(const wxString
& normal_face
,
71 const wxString
& fixed_face
,
72 const int sizes
= @NULL
);
75 Assign text to the renderer. Render() then draws
79 HTML text. This is not a filename.
82 base directory (html string would be stored there if it was in
83 file). It is used to determine path for loading images, for example.
86 @false if basepath is filename, @true if it is directory name
87 (see wxFileSystem for detailed explanation)
89 void SetHtmlText(const wxString
& html
,
90 const wxString
& basepath
= wxEmptyString
,
94 Set size of output rectangle, in pixels. Note that you @b can't change
95 width of the rectangle between calls to wxHtmlDCRenderer::Render!
96 (You can freely change height.)
98 void SetSize(int width
, int height
);
103 @class wxHtmlEasyPrinting
104 @headerfile htmprint.h wx/html/htmprint.h
106 This class provides very simple interface to printing
107 architecture. It allows you to print HTML documents using
113 class wxHtmlEasyPrinting
: public wxObject
120 Name of the printing object. Used by preview frames and setup dialogs.
123 pointer to the window that will own the preview frame and setup dialogs. May be
126 wxHtmlEasyPrinting(const wxString
& name
= "Printing",
127 wxWindow
* parentWindow
= @NULL
);
130 Returns a pointer to wxPageSetupDialogData instance used by
131 this class. You can set its parameters (via SetXXXX methods).
133 wxPageSetupDialogData
* GetPageSetupData();
136 Gets the parent window for dialogs.
138 wxWindow
* GetParentWindow();
141 Returns pointer to wxPrintData instance used by this class. You can
142 set its parameters (via SetXXXX methods).
144 wxPrintData
* GetPrintData();
147 Display page setup dialog and allows the user to modify settings.
154 Returns @false in case of error -- call
155 wxPrinter::GetLastError to get detailed
156 information about the kind of the error.
158 bool PreviewFile(const wxString
& htmlfile
);
161 Preview HTML text (not file!).
163 Returns @false in case of error -- call
164 wxPrinter::GetLastError to get detailed
165 information about the kind of the error.
171 base directory (html string would be stored there if it was in
172 file). It is used to determine path for loading images, for example.
174 bool PreviewText(const wxString
& htmltext
,
175 const wxString
& basepath
= wxEmptyString
);
180 Returns @false in case of error -- call
181 wxPrinter::GetLastError to get detailed
182 information about the kind of the error.
184 bool PrintFile(const wxString
& htmlfile
);
187 Print HTML text (not file!).
189 Returns @false in case of error -- call
190 wxPrinter::GetLastError to get detailed
191 information about the kind of the error.
197 base directory (html string would be stored there if it was in
198 file). It is used to determine path for loading images, for example.
200 bool PrintText(const wxString
& htmltext
,
201 const wxString
& basepath
= wxEmptyString
);
204 Sets fonts. See wxHtmlWindow::SetFonts for
205 detailed description.
207 void SetFonts(const wxString
& normal_face
,
208 const wxString
& fixed_face
,
209 const int sizes
= @NULL
);
212 Set page footer. 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 footer.
224 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
226 void SetFooter(const wxString
& footer
, int pg
= wxPAGE_ALL
);
229 Set page header. The following macros can be used inside it:
231 @DATE@ is replaced by the current date in default format
232 @PAGENUM@ is replaced by page number
233 @PAGESCNT@ is replaced by total number of pages
234 @TIME@ is replaced by the current time in default format
235 @TITLE@ is replaced with the title of the document
238 HTML text to be used as header.
241 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
243 void SetHeader(const wxString
& header
, int pg
= wxPAGE_ALL
);
246 Sets the parent window for dialogs.
248 void SetParentWindow(wxWindow
* window
);
253 @class wxHtmlPrintout
254 @headerfile htmprint.h wx/html/htmprint.h
256 This class serves as printout class for HTML documents.
261 class wxHtmlPrintout
: public wxPrintout
267 wxHtmlPrintout(const wxString
& title
= "Printout");
270 Adds a filter to the static list of filters for wxHtmlPrintout. See
274 static void AddFilter(wxHtmlFilter
* filter
);
277 Sets fonts. See wxHtmlWindow::SetFonts for
278 detailed description.
280 void SetFonts(const wxString
& normal_face
,
281 const wxString
& fixed_face
,
282 const int sizes
= @NULL
);
285 Set page footer. The following macros can be used inside it:
287 @DATE@ is replaced by the current date in default format
288 @PAGENUM@ is replaced by page number
289 @PAGESCNT@ is replaced by total number of pages
290 @TIME@ is replaced by the current time in default format
291 @TITLE@ is replaced with the title of the document
294 HTML text to be used as footer.
297 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
299 void SetFooter(const wxString
& footer
, int pg
= wxPAGE_ALL
);
302 Set page header. The following macros can be used inside it:
304 @DATE@ is replaced by the current date in default format
305 @PAGENUM@ is replaced by page number
306 @PAGESCNT@ is replaced by total number of pages
307 @TIME@ is replaced by the current time in default format
308 @TITLE@ is replaced with the title of the document
311 HTML text to be used as header.
314 one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
316 void SetHeader(const wxString
& header
, int pg
= wxPAGE_ALL
);
319 Prepare the class for printing this HTML @b file. The file may be located on
320 any virtual file system or it may be normal file.
322 void SetHtmlFile(const wxString
& htmlfile
);
325 Prepare the class for printing this HTML text.
328 HTML text. (NOT file!)
331 base directory (html string would be stored there if it was in
332 file). It is used to determine path for loading images, for example.
335 @false if basepath is filename, @true if it is directory name
336 (see wxFileSystem for detailed explanation)
338 void SetHtmlText(const wxString
& html
,
339 const wxString
& basepath
= wxEmptyString
,
343 Sets margins in millimeters. Defaults to 1 inch for margins and 0.5cm for space
344 between text and header and/or footer
346 void SetMargins(float top
= 25.2, float bottom
= 25.2,