]> git.saurik.com Git - wxWidgets.git/commitdiff
Create wxPrintAbortDialog more sensibly.
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 9 Aug 2012 15:52:04 +0000 (15:52 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 9 Aug 2012 15:52:04 +0000 (15:52 +0000)
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

include/wx/prntbase.h
src/common/prntbase.cpp

index ac78189a42b535ea97722219e9a3b50bfc51f385..c40358006d19dda3eeaff5dae4e49e9a644c083e 100644 (file)
@@ -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);
 
index b1bb44c064abfebfccf50e102d60cca4fde68ea9..fb640b2af5734c6b7ceda64f283ef5c1d097f47b 100644 (file)
@@ -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;