X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0221ef7cb657094d60975e01169de8f4a10bc5e..e7300ec6d9ebbd1cfa2fcf12c0ce6e5aee85a152:/samples/html/printing/printing.cpp diff --git a/samples/html/printing/printing.cpp b/samples/html/printing/printing.cpp index afbe534fd9..fe6db85c75 100644 --- a/samples/html/printing/printing.cpp +++ b/samples/html/printing/printing.cpp @@ -5,7 +5,7 @@ // For compilers that support precompilation, includes "wx/wx.h". -#include +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop @@ -14,13 +14,12 @@ // for all others, include the necessary headers (this file is usually all you // need because it includes almost all "standard" wxWindows headers #ifndef WX_PRECOMP -#include +#include "wx/wx.h" #endif -#include -#include - -#include +#include "wx/image.h" +#include "wx/html/htmlwin.h" +#include "wx/html/htmprint.h" // ---------------------------------------------------------------------------- @@ -45,9 +44,10 @@ class MyApp : public wxApp class MyFrame : public wxFrame { public: - // ctor(s) + // ctor and dtor MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); + virtual ~MyFrame(); // event handlers (these functions should _not_ be virtual) void OnQuit(wxCommandEvent& event); @@ -186,12 +186,18 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)
", wxPAGE_ALL); } +// frame destructor +MyFrame::~MyFrame() +{ + delete m_Prn; + m_Prn = (wxHtmlEasyPrinting *) NULL; +} + // event handlers void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - delete m_Prn; // TRUE is to force the frame to close Close(TRUE); } @@ -235,7 +241,7 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event)) { m_Name = dialog.GetPath(); m_Html -> LoadPage(m_Name); - m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)
", wxPAGE_ALL); + m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)
", wxPAGE_ALL); } }