- if ( data )
- printData = *data;
-
- int buttonWidth = 65;
- int buttonHeight = 25;
- int spacing = 5;
- int yPos = 5;
- int xPos = 5;
-
- wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(5, yPos), wxSize(buttonWidth, buttonHeight));
- (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(buttonWidth + 5 + spacing, yPos), wxSize(buttonWidth, buttonHeight));
-
- setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup..."), wxPoint(buttonWidth*2 + 5 + 2*spacing, yPos), wxSize(buttonWidth, buttonHeight));
-
- okButton->SetDefault();
- okButton->SetFocus();
-
- yPos += 35;
-
- wxString *choices = new wxString[2];
- choices[0] = _("All");
- choices[1] = _("Pages");
-
- fromText = (wxTextCtrl*)NULL;
-
- if(printData.GetFromPage() != 0)
- {
- rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
- wxPoint(5, yPos), wxSize(-1, -1), 2, choices, 2);
- rangeRadioBox->SetSelection(1);
- }
-
- yPos += 60;
- xPos = 5;
- int staticWidth = 45;
- int textWidth = 40;
- spacing = 10;
-
- if(printData.GetFromPage() != 0)
- {
- (void) new wxStaticText(this, wxPRINTID_STATIC, _("From:"), wxPoint(xPos, yPos));
- xPos += staticWidth;
-
- fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
- xPos += spacing + textWidth;
-
- (void) new wxStaticText(this, wxPRINTID_STATIC, _("To:"), wxPoint(xPos, yPos));
- xPos += staticWidth;
-
- toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
- xPos += spacing + textWidth;
- }
-
- (void) new wxStaticText(this, wxPRINTID_STATIC, _("Copies:"), wxPoint(xPos, yPos));
- xPos += spacing + staticWidth;
-
- noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(xPos, yPos), wxSize(textWidth, -1));
-
- yPos += 30;
- xPos = 5;
-
- printToFileCheckBox = new wxCheckBox(this, wxPRINTID_PRINTTOFILE, _("Print to File"), wxPoint(xPos, yPos));
-
- Fit();
- Centre(wxBOTH);
-
- // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
- InitDialog();
- delete[] choices;
+ if ( data )
+ m_printDialogData = *data;
+
+ Init(parent);
+}
+
+wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
+ wxPrintData* data)
+ : wxDialog(parent, -1, _("Print"),
+ wxPoint(0, 0), wxSize(600, 600),
+ wxDEFAULT_DIALOG_STYLE |
+ wxDIALOG_MODAL |
+ wxTAB_TRAVERSAL)
+{
+ if ( data )
+ m_printDialogData = *data;
+
+ Init(parent);
+}
+
+void wxGenericPrintDialog::Init(wxWindow * WXUNUSED(parent))
+{
+ // wxDialog::Create(parent, -1, _("Print"), wxPoint(0, 0), wxSize(600, 600),
+ // wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL | wxTAB_TRAVERSAL);
+
+ wxBoxSizer *mainsizer = new wxBoxSizer( wxVERTICAL );
+
+ // 1) top row
+
+ wxStaticBoxSizer *topsizer = new wxStaticBoxSizer(
+ new wxStaticBox( this, -1, _( "Printer options" ) ), wxHORIZONTAL );
+ m_printToFileCheckBox = new wxCheckBox( this, wxPRINTID_PRINTTOFILE, _("Print to File") );
+ topsizer->Add( m_printToFileCheckBox, 0, wxCENTER|wxALL, 5 );
+
+ topsizer->Add( 60,2,1 );
+
+ m_setupButton = new wxButton(this, wxPRINTID_SETUP, _("Setup...") );
+ topsizer->Add( m_setupButton, 0, wxCENTER|wxALL, 5 );
+
+ mainsizer->Add( topsizer, 0, wxLEFT|wxTOP|wxRIGHT, 10 );
+
+ // 2) middle row with radio box
+
+ wxString *choices = new wxString[2];
+ choices[0] = _("All");
+ choices[1] = _("Pages");
+
+ m_fromText = (wxTextCtrl*)NULL;
+ m_toText = (wxTextCtrl*)NULL;
+ m_rangeRadioBox = (wxRadioBox *)NULL;
+
+ if (m_printDialogData.GetFromPage() != 0)
+ {
+ m_rangeRadioBox = new wxRadioBox(this, wxPRINTID_RANGE, _("Print Range"),
+ wxDefaultPosition, wxDefaultSize,
+ 2, choices,
+ 1, wxRA_VERTICAL);
+ m_rangeRadioBox->SetSelection(1);
+
+ mainsizer->Add( m_rangeRadioBox, 0, wxLEFT|wxTOP|wxRIGHT, 10 );
+ }
+
+ // 3) bottom row
+
+ wxBoxSizer *bottomsizer = new wxBoxSizer( wxHORIZONTAL );
+
+ if (m_printDialogData.GetFromPage() != 0)
+ {
+ bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("From:") ), 0, wxCENTER|wxALL, 5 );
+ m_fromText = new wxTextCtrl(this, wxPRINTID_FROM, "", wxDefaultPosition, wxSize(40, -1));
+ bottomsizer->Add( m_fromText, 1, wxCENTER|wxRIGHT, 10 );
+
+ bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("To:") ), 0, wxCENTER|wxALL, 5);
+ m_toText = new wxTextCtrl(this, wxPRINTID_TO, "", wxDefaultPosition, wxSize(40, -1));
+ bottomsizer->Add( m_toText, 1, wxCENTER|wxRIGHT, 10 );
+ }
+
+ bottomsizer->Add( new wxStaticText(this, wxPRINTID_STATIC, _("Copies:") ), 0, wxCENTER|wxALL, 5 );
+ m_noCopiesText = new wxTextCtrl(this, wxPRINTID_COPIES, "", wxPoint(252, 130), wxSize(40, -1));
+ bottomsizer->Add( m_noCopiesText, 1, wxCENTER|wxRIGHT, 10 );
+
+ mainsizer->Add( bottomsizer, 0, wxTOP|wxLEFT|wxRIGHT, 12 );
+
+#if wxUSE_STATLINE
+ // 4) static line
+ mainsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+#endif
+
+ // 5) buttons
+
+ mainsizer->Add( CreateButtonSizer( wxOK|wxCANCEL), 0, wxCENTER|wxALL, 10 );
+
+ SetAutoLayout( TRUE );
+ SetSizer( mainsizer );
+
+ mainsizer->Fit( this );
+ Centre(wxBOTH);
+
+ // Calls wxWindow::OnInitDialog and then wxGenericPrintDialog::TransferDataToWindow
+ InitDialog();
+ delete[] choices;