Create wxPrintAbortDialog more sensibly.
Instead of having an empty constructor and filling the dialog with controls from outside, do the work in the constructor. This changes the meaning of ctor's 'title' argument, but this class' terrible API made it unusable for direct use anyway, so it doesn't seem to be harmful. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -733,14 +733,11 @@ class WXDLLIMPEXP_CORE wxPrintAbortDialog: public wxDialog
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxPrintAbortDialog(wxWindow *parent,
|
wxPrintAbortDialog(wxWindow *parent,
|
||||||
const wxString& title,
|
const wxString& documentTitle,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = 0,
|
long style = wxDEFAULT_DIALOG_STYLE,
|
||||||
const wxString& name = wxT("dialog"))
|
const wxString& name = wxT("dialog"));
|
||||||
: wxDialog(parent, wxID_ANY, title, pos, size, style, name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnCancel(wxCommandEvent& event);
|
void OnCancel(wxCommandEvent& event);
|
||||||
|
|
||||||
|
@@ -323,19 +323,7 @@ wxPrinterBase::~wxPrinterBase()
|
|||||||
|
|
||||||
wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout * printout)
|
wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout * printout)
|
||||||
{
|
{
|
||||||
wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing ") , wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
|
return new wxPrintAbortDialog(parent, printout->GetTitle());
|
||||||
|
|
||||||
wxBoxSizer *button_sizer = new wxBoxSizer( wxVERTICAL );
|
|
||||||
button_sizer->Add( new wxStaticText(dialog, wxID_ANY, _("Please wait while printing\n") + printout->GetTitle() ), 0, wxALL, 10 );
|
|
||||||
button_sizer->Add( new wxButton( dialog, wxID_CANCEL, wxT("Cancel") ), 0, wxALL | wxALIGN_CENTER, 10 );
|
|
||||||
|
|
||||||
dialog->SetAutoLayout( true );
|
|
||||||
dialog->SetSizer( button_sizer );
|
|
||||||
|
|
||||||
button_sizer->Fit(dialog);
|
|
||||||
button_sizer->SetSizeHints (dialog) ;
|
|
||||||
|
|
||||||
return dialog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout), const wxString& message)
|
void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout), const wxString& message)
|
||||||
@@ -522,6 +510,25 @@ BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
|
|||||||
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
|
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
wxPrintAbortDialog::wxPrintAbortDialog(wxWindow *parent,
|
||||||
|
const wxString& documentTitle,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style,
|
||||||
|
const wxString& name)
|
||||||
|
: wxDialog(parent, wxID_ANY, _("Printing"), pos, size, style, name)
|
||||||
|
{
|
||||||
|
wxBoxSizer *button_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
button_sizer->Add(new wxStaticText(this, wxID_ANY, _("Please wait while printing\n") + documentTitle), 0, wxALL, 10 );
|
||||||
|
button_sizer->Add(new wxButton(this, wxID_CANCEL, wxT("Cancel") ), 0, wxALL | wxALIGN_CENTER, 10);
|
||||||
|
|
||||||
|
SetAutoLayout(true);
|
||||||
|
SetSizer(button_sizer);
|
||||||
|
|
||||||
|
button_sizer->Fit(this);
|
||||||
|
button_sizer->SetSizeHints(this);
|
||||||
|
}
|
||||||
|
|
||||||
void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxPrinterBase::sm_abortIt = true;
|
wxPrinterBase::sm_abortIt = true;
|
||||||
|
Reference in New Issue
Block a user