X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2978621101b6b5ed4d745ece17402c6e86d6dd8b..ef094fa075bc56bcbc33b12159c395ea28afda3b:/include/wx/html/htmprint.h diff --git a/include/wx/html/htmprint.h b/include/wx/html/htmprint.h index ecff11db6d..8ee2742637 100644 --- a/include/wx/html/htmprint.h +++ b/include/wx/html/htmprint.h @@ -11,11 +11,11 @@ #ifndef _WX_HTMPRINT_H_ #define _WX_HTMPRINT_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "htmprint.h" #endif -#include +#include "wx/defs.h" #if wxUSE_HTML & wxUSE_PRINTING_ARCHITECTURE @@ -25,6 +25,8 @@ #include "wx/print.h" #include "wx/printdlg.h" +#include // INT_MAX + //-------------------------------------------------------------------------------- // wxHtmlDCRenderer // This class is capable of rendering HTML into specified @@ -39,7 +41,7 @@ public: // Following 3 methods *must* be called before any call to Render: - // Asign DC to this render + // Assign DC to this render void SetDC(wxDC *dc, double pixel_scale = 1.0); // Sets size of output rectangle, in pixels. Note that you *can't* change @@ -53,16 +55,27 @@ public: // (see wxFileSystem for detailed explanation) void SetHtmlText(const wxString& html, const wxString& basepath = wxEmptyString, bool isdir = TRUE); + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). + void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes = NULL); + // [x,y] is position of upper-left corner of printing rectangle (see SetSize) - // from is y-coordinate of the very first visible cell + // from is y-coordinate of the very first visible cell + // to is y-coordinate of the next following page break, if any // Returned value is y coordinate of first cell than didn't fit onto page. // Use this value as 'from' in next call to Render in order to print multiple pages // document // If dont_render is TRUE then nothing is rendered into DC and it only counts // pixels and return y coord of the next page // - // CAUTION! Render() changes DC's user scale and does NOT restore it! - int Render(int x, int y, int from = 0, int dont_render = FALSE); + // known_pagebreaks and number_of_pages are used only when counting pages; + // otherwise, their default values should be used. Their purpose is to + // support pagebreaks using a subset of CSS2's
. The
handler + // needs to know what pagebreaks have already been set so that it doesn't + // set the same pagebreak twice. + // + // CAUTION! Render() changes DC's user scale and does NOT restore it! + int Render(int x, int y, int from = 0, int dont_render = FALSE, int to = INT_MAX, + int *known_pagebreaks = NULL, int number_of_pages = 0); // returns total height of the html document // (compare Render's return value with this) @@ -74,6 +87,8 @@ private: wxFileSystem *m_FS; wxHtmlContainerCell *m_Cells; int m_MaxWidth, m_Width, m_Height; + + DECLARE_NO_COPY_CLASS(wxHtmlDCRenderer) }; @@ -98,7 +113,7 @@ enum { class WXDLLEXPORT wxHtmlPrintout : public wxPrintout { public: - wxHtmlPrintout(const wxString& title = "Printout"); + wxHtmlPrintout(const wxString& title = wxT("Printout")); ~wxHtmlPrintout(); void SetHtmlText(const wxString& html, const wxString &basepath = wxEmptyString, bool isdir = TRUE); @@ -123,6 +138,9 @@ public: // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. // You can set different header/footer for odd and even pages + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used). + void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes = NULL); + void SetMargins(float top = 25.2, float bottom = 25.2, float left = 25.2, float right = 25.2, float spaces = 5); // sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space @@ -155,6 +173,8 @@ private: int m_HeaderHeight, m_FooterHeight; wxHtmlDCRenderer *m_Renderer, *m_RendererHdr; float m_MarginTop, m_MarginBottom, m_MarginLeft, m_MarginRight, m_MarginSpace; + + DECLARE_NO_COPY_CLASS(wxHtmlPrintout) }; @@ -176,7 +196,7 @@ private: class WXDLLEXPORT wxHtmlEasyPrinting : public wxObject { public: - wxHtmlEasyPrinting(const wxString& name = "Printing", wxFrame *parent_frame = NULL); + wxHtmlEasyPrinting(const wxString& name = wxT("Printing"), wxWindow *parentWindow = NULL); ~wxHtmlEasyPrinting(); bool PreviewFile(const wxString &htmlfile); @@ -203,12 +223,15 @@ public: // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. // You can set different header/footer for odd and even pages + void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes = 0); + // Sets fonts to be used when displaying HTML page. (if size null then default sizes used) + wxPrintData *GetPrintData() {return m_PrintData;} wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;} // return page setting data objects. // (You can set their parameters.) -protected: +protected: virtual wxHtmlPrintout *CreatePrintout(); virtual bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2); virtual bool DoPrint(wxHtmlPrintout *printout); @@ -217,8 +240,13 @@ private: wxPrintData *m_PrintData; wxPageSetupDialogData *m_PageSetupData; wxString m_Name; + int m_FontsSizesArr[7]; + int *m_FontsSizes; + wxString m_FontFaceFixed, m_FontFaceNormal; wxString m_Headers[2], m_Footers[2]; - wxFrame *m_Frame; + wxWindow *m_ParentWindow; + + DECLARE_NO_COPY_CLASS(wxHtmlEasyPrinting) };