Allow configuring showing printing dialog in wxHtmlEasyPrinting

Add wxHtmlEasyPrinting::SetPromptMode() to allow suppressing the
"prompt" shown by wxPrinter::Print() when it's called from this class
code.

Closes https://github.com/wxWidgets/wxWidgets/pull/838
This commit is contained in:
pavel-t
2018-06-21 09:11:28 +03:00
committed by Vadim Zeitlin
parent 01cd3cc019
commit 710474c634
4 changed files with 48 additions and 1 deletions

View File

@@ -619,6 +619,8 @@ wxHtmlEasyPrinting::wxHtmlEasyPrinting(const wxString& name, wxWindow *parentWin
m_PageSetupData->SetMarginBottomRight(wxPoint(25, 25));
SetStandardFonts(DEFAULT_PRINT_FONT_SIZE);
m_promptMode = Prompt_Always;
}
@@ -709,7 +711,13 @@ bool wxHtmlEasyPrinting::DoPrint(wxHtmlPrintout *printout)
wxPrintDialogData printDialogData(*GetPrintData());
wxPrinter printer(&printDialogData);
if (!printer.Print(m_ParentWindow, printout, true))
const bool prompt = m_promptMode != Prompt_Never;
if (m_promptMode == Prompt_Once)
{
m_promptMode = Prompt_Never;
}
if (!printer.Print(m_ParentWindow, printout, prompt))
{
return false;
}