#include <wx/html/htmprint.h>
This class provides very simple interface to printing architecture.
It allows you to print HTML documents using only a few commands.
Public Member Functions | |
wxHtmlEasyPrinting (const wxString &name="Printing", wxWindow *parentWindow=NULL) | |
Constructor. | |
const wxString & | GetName () const |
Returns the current name being used for preview frames and setup dialogs. | |
wxPageSetupDialogData * | GetPageSetupData () |
Returns a pointer to wxPageSetupDialogData instance used by this class. | |
wxWindow * | GetParentWindow () const |
Gets the parent window for dialogs. | |
wxPrintData * | GetPrintData () |
Returns pointer to wxPrintData instance used by this class. | |
void | PageSetup () |
Display page setup dialog and allows the user to modify settings. | |
bool | PreviewFile (const wxString &htmlfile) |
Preview HTML file. | |
bool | PreviewText (const wxString &htmltext, const wxString &basepath=wxEmptyString) |
Preview HTML text (not file!). | |
bool | PrintFile (const wxString &htmlfile) |
Print HTML file. | |
bool | PrintText (const wxString &htmltext, const wxString &basepath=wxEmptyString) |
Print HTML text (not file!). | |
void | SetFonts (const wxString &normal_face, const wxString &fixed_face, const int *sizes=NULL) |
Sets fonts. | |
void | SetName (const wxString &name) |
Sets the name used for preview frames and setup dialogs. | |
void | SetStandardFonts (int size=-1, const wxString &normal_face=wxEmptyString, const wxString &fixed_face=wxEmptyString) |
Sets default font sizes and/or default font size. | |
void | SetFooter (const wxString &footer, int pg=wxPAGE_ALL) |
Set page footer. | |
void | SetHeader (const wxString &header, int pg=wxPAGE_ALL) |
Set page header. | |
void | SetParentWindow (wxWindow *window) |
Sets the parent window for dialogs. | |
Public Member Functions inherited from wxObject | |
wxObject () | |
Default ctor; initializes to NULL the internal reference data. | |
wxObject (const wxObject &other) | |
Copy ctor. | |
virtual | ~wxObject () |
Destructor. | |
virtual wxClassInfo * | GetClassInfo () const |
This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). | |
wxObjectRefData * | GetRefData () const |
Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. | |
bool | IsKindOf (const wxClassInfo *info) const |
Determines whether this class is a subclass of (or the same class as) the given class. | |
bool | IsSameAs (const wxObject &obj) const |
Returns true if this object has the same data pointer as obj. | |
void | Ref (const wxObject &clone) |
Makes this object refer to the data in clone. | |
void | SetRefData (wxObjectRefData *data) |
Sets the wxObject::m_refData pointer. | |
void | UnRef () |
Decrements the reference count in the associated data, and if it is zero, deletes the data. | |
void | UnShare () |
This is the same of AllocExclusive() but this method is public. | |
void | operator delete (void *buf) |
The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. | |
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0) |
The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. | |
Private Member Functions | |
virtual bool | CheckFit (const wxSize &pageArea, const wxSize &docArea) const |
Check whether the document fits into the page area. | |
Additional Inherited Members | |
Protected Member Functions inherited from wxObject | |
void | AllocExclusive () |
Ensure that this object's data is not shared with any other object. | |
virtual wxObjectRefData * | CreateRefData () const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. | |
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. | |
Protected Attributes inherited from wxObject | |
wxObjectRefData * | m_refData |
Pointer to an object which is the object's reference-counted data. | |
wxHtmlEasyPrinting::wxHtmlEasyPrinting | ( | const wxString & | name = "Printing" , |
wxWindow * | parentWindow = NULL |
||
) |
Constructor.
name | Name of the printing object. Used by preview frames and setup dialogs. |
parentWindow | pointer to the window that will own the preview frame and setup dialogs. May be NULL. |
|
privatevirtual |
Check whether the document fits into the page area.
This function is called by the base class OnPreparePrinting() implementation and by default checks whether the document fits into pageArea horizontally and warns the user if it does not, giving him the possibility to cancel printing in this case (presumably in order to change some layout options and retry it again).
You may override it to either suppress this check if truncation of the HTML being printed is acceptable or, on the contrary, add more checks to it, e.g. for the fit in the vertical direction if the document should always appear on a single page.
const wxString& wxHtmlEasyPrinting::GetName | ( | ) | const |
Returns the current name being used for preview frames and setup dialogs.
wxPageSetupDialogData* wxHtmlEasyPrinting::GetPageSetupData | ( | ) |
Returns a pointer to wxPageSetupDialogData instance used by this class.
You can set its parameters (via SetXXXX methods).
wxWindow* wxHtmlEasyPrinting::GetParentWindow | ( | ) | const |
Gets the parent window for dialogs.
wxPrintData* wxHtmlEasyPrinting::GetPrintData | ( | ) |
Returns pointer to wxPrintData instance used by this class.
You can set its parameters (via SetXXXX methods).
void wxHtmlEasyPrinting::PageSetup | ( | ) |
Display page setup dialog and allows the user to modify settings.
bool wxHtmlEasyPrinting::PreviewFile | ( | const wxString & | htmlfile | ) |
Preview HTML file.
Returns false in case of error – call wxPrinter::GetLastError to get detailed information about the kind of the error.
bool wxHtmlEasyPrinting::PreviewText | ( | const wxString & | htmltext, |
const wxString & | basepath = wxEmptyString |
||
) |
Preview HTML text (not file!).
Returns false in case of error – call wxPrinter::GetLastError to get detailed information about the kind of the error.
htmltext | HTML text. |
basepath | base directory (html string would be stored there if it was in file). It is used to determine path for loading images, for example. |
bool wxHtmlEasyPrinting::PrintFile | ( | const wxString & | htmlfile | ) |
Print HTML file.
Returns false in case of error – call wxPrinter::GetLastError to get detailed information about the kind of the error.
bool wxHtmlEasyPrinting::PrintText | ( | const wxString & | htmltext, |
const wxString & | basepath = wxEmptyString |
||
) |
Print HTML text (not file!).
Returns false in case of error – call wxPrinter::GetLastError to get detailed information about the kind of the error.
htmltext | HTML text. |
basepath | base directory (html string would be stored there if it was in file). It is used to determine path for loading images, for example. |
void wxHtmlEasyPrinting::SetFonts | ( | const wxString & | normal_face, |
const wxString & | fixed_face, | ||
const int * | sizes = NULL |
||
) |
Sets fonts.
See wxHtmlDCRenderer::SetFonts for detailed description.
void wxHtmlEasyPrinting::SetFooter | ( | const wxString & | footer, |
int | pg = wxPAGE_ALL |
||
) |
Set page footer.
The following macros can be used inside it: @DATE@ is replaced by the current date in default format @PAGENUM@ is replaced by page number @PAGESCNT@ is replaced by total number of pages @TIME@ is replaced by the current time in default format @TITLE@ is replaced with the title of the document
footer | HTML text to be used as footer. |
pg | one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants. |
void wxHtmlEasyPrinting::SetHeader | ( | const wxString & | header, |
int | pg = wxPAGE_ALL |
||
) |
Set page header.
The following macros can be used inside it:
header | HTML text to be used as header. |
pg | one of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants. |
void wxHtmlEasyPrinting::SetName | ( | const wxString & | name | ) |
Sets the name used for preview frames and setup dialogs.
void wxHtmlEasyPrinting::SetParentWindow | ( | wxWindow * | window | ) |
Sets the parent window for dialogs.
void wxHtmlEasyPrinting::SetStandardFonts | ( | int | size = -1 , |
const wxString & | normal_face = wxEmptyString , |
||
const wxString & | fixed_face = wxEmptyString |
||
) |
Sets default font sizes and/or default font size.
See wxHtmlDCRenderer::SetStandardFonts for detailed description.