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:
parent
6c0613fd6a
commit
1a19b3210d
@ -733,14 +733,11 @@ class WXDLLIMPEXP_CORE wxPrintAbortDialog: public wxDialog
|
||||
{
|
||||
public:
|
||||
wxPrintAbortDialog(wxWindow *parent,
|
||||
const wxString& title,
|
||||
const wxString& documentTitle,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxT("dialog"))
|
||||
: wxDialog(parent, wxID_ANY, title, pos, size, style, name)
|
||||
{
|
||||
}
|
||||
long style = wxDEFAULT_DIALOG_STYLE,
|
||||
const wxString& name = wxT("dialog"));
|
||||
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
|
||||
|
@ -323,19 +323,7 @@ wxPrinterBase::~wxPrinterBase()
|
||||
|
||||
wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout * printout)
|
||||
{
|
||||
wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing ") , wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
|
||||
|
||||
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;
|
||||
return new wxPrintAbortDialog(parent, printout->GetTitle());
|
||||
}
|
||||
|
||||
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)
|
||||
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))
|
||||
{
|
||||
wxPrinterBase::sm_abortIt = true;
|
||||
|
Loading…
Reference in New Issue
Block a user