X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2c84e0c259bd9f4b74fa9c1c67b0d5aac3683bb6..e96ec686d8f244bbd617c14aa0c62ff9ca0c2970:/src/generic/prntdlgg.cpp diff --git a/src/generic/prntdlgg.cpp b/src/generic/prntdlgg.cpp index e201b9d82c..9b9e3846c0 100644 --- a/src/generic/prntdlgg.cpp +++ b/src/generic/prntdlgg.cpp @@ -61,6 +61,7 @@ #include "wx/paper.h" #include "wx/filename.h" #include "wx/tokenzr.h" +#include "wx/imaglist.h" #include #include @@ -110,12 +111,12 @@ wxPostScriptPrintNativeData::~wxPostScriptPrintNativeData() { } -bool wxPostScriptPrintNativeData::TransferTo( wxPrintData &data ) +bool wxPostScriptPrintNativeData::TransferTo( wxPrintData &WXUNUSED(data) ) { return true; } -bool wxPostScriptPrintNativeData::TransferFrom( const wxPrintData &data ) +bool wxPostScriptPrintNativeData::TransferFrom( const wxPrintData &WXUNUSED(data) ) { return true; } @@ -809,44 +810,15 @@ wxComboBox *wxGenericPrintSetupDialog::CreatePaperTypeChoice() // Generic page setup dialog // ---------------------------------------------------------------------------- -IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog) +IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxPageSetupDialogBase) -BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog) +BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxPageSetupDialogBase) EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter) END_EVENT_TABLE() -void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event)) -{ - // We no longer query GetPrintMode, so we can eliminate the need - // to call SetPrintMode. - // This has the limitation that we can't explicitly call the PostScript - // print setup dialog from the generic Page Setup dialog under Windows, - // but since this choice would only happen when trying to do PostScript - // printing under Windows (and only in 16-bit Windows which - // doesn't have a Windows-specific page setup dialog) it's worth it. - - // First save the current settings, so the wxPrintData object is up to date. - TransferDataFromWindow(); - - // Transfer the current print settings from this dialog to the page setup dialog. - wxPrintDialogData data; - data = GetPageSetupData().GetPrintData(); - data.SetSetupDialog(true); - wxPrintDialog printDialog(this, & data); - printDialog.ShowModal(); - - // Transfer the page setup print settings from the page dialog to this dialog again, in case - // the page setup dialog changed something. - GetPageSetupData().GetPrintData() = printDialog.GetPrintDialogData().GetPrintData(); - GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData - - // Now update the dialog in case the page setup dialog changed some of our settings. - TransferDataToWindow(); -} - wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, - wxPageSetupData* data) - : wxDialog( parent, + wxPageSetupDialogData* data) + : wxPageSetupDialogBase( parent, wxID_ANY, _("Page Setup"), wxPoint(0, 0), @@ -933,10 +905,19 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent, // 6) buttons wxSizer* buttonsizer = CreateButtonSizer( wxOK|wxCANCEL); - m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer...") ); - buttonsizer->Add( m_printerButton, 0, wxLEFT|wxRIGHT, 10 ); - if ( !m_pageData.GetEnablePrinter() ) - m_printerButton->Enable(false); + + if (wxPrintFactory::GetFactory()->HasPrintSetupDialog()) + { + m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer...") ); + buttonsizer->Add( m_printerButton, 0, wxLEFT|wxRIGHT, 10 ); + if ( !m_pageData.GetEnablePrinter() ) + m_printerButton->Enable(false); + } + else + { + m_printerButton = NULL; + } + // if (m_printData.GetEnableHelp()) // wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), wxDefaultCoord, wxDefaultCoord, buttonWidth, buttonHeight); mainsizer->Add( buttonsizer, 0, wxCENTER|wxALL, 10 ); @@ -958,6 +939,11 @@ wxGenericPageSetupDialog::~wxGenericPageSetupDialog() { } +wxPageSetupDialogData& wxGenericPageSetupDialog::GetPageSetupDialogData() +{ + return m_pageData; +} + bool wxGenericPageSetupDialog::TransferDataToWindow() { if (m_marginLeftText) @@ -1074,5 +1060,39 @@ wxComboBox *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y) return choice; } +void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event)) +{ + // We no longer query GetPrintMode, so we can eliminate the need + // to call SetPrintMode. + // This has the limitation that we can't explicitly call the PostScript + // print setup dialog from the generic Page Setup dialog under Windows, + // but since this choice would only happen when trying to do PostScript + // printing under Windows (and only in 16-bit Windows which + // doesn't have a Windows-specific page setup dialog) it's worth it. + + // First save the current settings, so the wxPrintData object is up to date. + TransferDataFromWindow(); + + // Transfer the current print settings from this dialog to the page setup dialog. + +#if 0 + // Use print factory later + + wxPrintDialogData data; + data = GetPageSetupData().GetPrintData(); + data.SetSetupDialog(true); + wxPrintDialog printDialog(this, & data); + printDialog.ShowModal(); + + // Transfer the page setup print settings from the page dialog to this dialog again, in case + // the page setup dialog changed something. + GetPageSetupData().GetPrintData() = printDialog.GetPrintDialogData().GetPrintData(); + GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData + + // Now update the dialog in case the page setup dialog changed some of our settings. + TransferDataToWindow(); +#endif +} + #endif