diff --git a/include/wx/gtk/print.h b/include/wx/gtk/print.h index f657838bfb..66e42100f3 100644 --- a/include/wx/gtk/print.h +++ b/include/wx/gtk/print.h @@ -80,8 +80,7 @@ public: wxPrintDialogData& GetPrintDialogData() wxOVERRIDE { return m_printDialogData; } - wxDC *GetPrintDC() wxOVERRIDE { return m_dc; } - void SetPrintDC(wxDC * printDC) { m_dc = printDC; } + wxDC *GetPrintDC() wxOVERRIDE; virtual int ShowModal() wxOVERRIDE; @@ -105,7 +104,6 @@ private: wxPrintDialogData m_printDialogData; wxWindow *m_parent; bool m_showDialog; - wxDC *m_dc; wxDECLARE_DYNAMIC_CLASS(wxGtkPrintDialog); }; diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index 963b5a5b46..277ce6fad2 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -771,6 +771,11 @@ int wxGtkPrintDialog::ShowModal() return wxID_OK; } +wxDC* wxGtkPrintDialog::GetPrintDC() +{ + return new wxPrinterDC(m_printDialogData.GetPrintData()); +} + //---------------------------------------------------------------------------- // wxGtkPageSetupDialog //---------------------------------------------------------------------------- @@ -967,7 +972,6 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) // This is used to setup the DC and // show the dialog if desired - dialog.SetPrintDC(m_dc); dialog.SetShowDialog(prompt); // doesn't necessarily show @@ -1153,7 +1157,6 @@ wxDC* wxGtkPrinter::PrintDialog( wxWindow *parent ) { wxGtkPrintDialog dialog( parent, &m_printDialogData ); - dialog.SetPrintDC(m_dc); dialog.SetShowDialog(true); int ret = dialog.ShowModal(); @@ -1169,9 +1172,13 @@ wxDC* wxGtkPrinter::PrintDialog( wxWindow *parent ) return NULL; } - m_printDialogData = dialog.GetPrintDialogData(); + wxDC* dc = dialog.GetPrintDC(); + if ( dc ) + { + m_printDialogData = dialog.GetPrintDialogData(); + } - return new wxPrinterDC( m_printDialogData.GetPrintData() ); + return dc; } bool wxGtkPrinter::Setup( wxWindow * WXUNUSED(parent) )