#include "wx/dialog.h"
#include "wx/cmndata.h"
+#include "wx/printdlg.h"
#if wxUSE_POSTSCRIPT
#include "wx/dcps.h"
// ----------------------------------------------------------------------------
#if wxUSE_POSTSCRIPT
-class WXDLLEXPORT wxGenericPrintDialog : public wxDialog
+class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase
{
public:
wxGenericPrintDialog(wxWindow *parent,
#include "wx/dialog.h"
#include "wx/cmndata.h"
+#include "wx/printdlg.h"
/*
* wxPrinterDialog
*/
class WXDLLEXPORT wxDC;
-class WXDLLEXPORT wxPrintDialog: public wxDialog
+class WXDLLEXPORT wxMacPrintDialog: public wxPrintDialogBase
{
- DECLARE_DYNAMIC_CLASS(wxPrintDialog)
-
- public:
- wxPrintDialog();
- wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
- wxPrintDialog(wxWindow *parent, wxPrintData* data );
- ~wxPrintDialog();
+public:
+ wxMacPrintDialog();
+ wxMacPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
+ wxMacPrintDialog(wxWindow *parent, wxPrintData* data );
+ ~wxMacPrintDialog();
bool Create(wxWindow *parent, wxPrintDialogData* data = NULL);
- virtual int ShowModal();
+ virtual int ShowModal();
- wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
- wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); }
- virtual wxDC *GetPrintDC();
+ virtual wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
+ virtual wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); }
+ virtual wxDC *GetPrintDC();
- private:
- wxPrintDialogData m_printDialogData;
- wxDC* m_printerDC;
- bool m_destroyDC;
- wxWindow* m_dialogParent;
+private:
+ wxPrintDialogData m_printDialogData;
+ wxDC* m_printerDC;
+ bool m_destroyDC;
+ wxWindow* m_dialogParent;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrintDialog)
};
class WXDLLEXPORT wxPageSetupDialog: public wxDialog
#include "wx/dialog.h"
#include "wx/cmndata.h"
+#include "wx/printdlg.h"
class WXDLLEXPORT wxDC;
// wxPrinterDialog: the common dialog for printing.
// ---------------------------------------------------------------------------
-class WXDLLEXPORT wxPrintDialog : public wxDialog
+class WXDLLEXPORT wxWindowsPrintDialog : public wxPrintDialogBase
{
- DECLARE_DYNAMIC_CLASS(wxPrintDialog)
-
public:
- wxPrintDialog();
- wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
- wxPrintDialog(wxWindow *parent, wxPrintData* data);
- virtual ~wxPrintDialog();
+ wxWindowsPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
+ wxWindowsPrintDialog(wxWindow *parent, wxPrintData* data);
+ virtual ~wxWindowsPrintDialog();
bool Create(wxWindow *parent, wxPrintDialogData* data = NULL);
virtual int ShowModal();
wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); }
virtual wxDC *GetPrintDC();
-private:
wxPrintDialogData m_printDialogData;
wxDC* m_printerDC;
bool m_destroyDC;
wxWindow* m_dialogParent;
- DECLARE_NO_COPY_CLASS(wxPrintDialog)
+private:
+ DECLARE_NO_COPY_CLASS(wxWindowsPrintDialog)
+ DECLARE_CLASS(wxWindowsPrintDialog)
};
class WXDLLEXPORT wxPageSetupDialog: public wxDialog
#ifndef _WX_PRINTDLG_H_BASE_
#define _WX_PRINTDLG_H_BASE_
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
+ #pragma interface "printdlg.h"
+#endif
+
+#include "wx/defs.h"
+
+#if wxUSE_PRINTING_ARCHITECTURE
+
+#include "wx/event.h"
+#include "wx/dialog.h"
+#include "wx/intl.h"
+#include "wx/cmndata.h"
+
+
+// ---------------------------------------------------------------------------
+// wxPrintDialogBase: interface for the common dialog for printing.
+// ---------------------------------------------------------------------------
+
+class WXDLLEXPORT wxPrintDialogBase : public wxDialog
+{
+public:
+ wxPrintDialogBase() { }
+ wxPrintDialogBase(wxWindow *parent, wxWindowID id = -1, const wxString &title = _("Print"),
+ const wxPoint &pos = wxDefaultPosition,
+ const wxSize &size = wxDefaultSize,
+ long style = wxDEFAULT_DIALOG_STYLE );
+
+ virtual int ShowModal() = 0;
+
+ virtual wxPrintDialogData& GetPrintDialogData() = 0;
+ virtual wxPrintData& GetPrintData() = 0;
+ virtual wxDC *GetPrintDC() = 0;
+
+private:
+ DECLARE_ABSTRACT_CLASS(wxPrintDialogBase)
+ DECLARE_NO_COPY_CLASS(wxPrintDialogBase)
+};
+
+// ---------------------------------------------------------------------------
+// wxPrintDialog: the common dialog for printing.
+// ---------------------------------------------------------------------------
+
+class WXDLLEXPORT wxPrintDialog : public wxObject
+{
+public:
+ wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
+ wxPrintDialog(wxWindow *parent, wxPrintData* data);
+ ~wxPrintDialog();
+
+ virtual int ShowModal();
+
+ virtual wxPrintDialogData& GetPrintDialogData();
+ virtual wxPrintData& GetPrintData();
+ virtual wxDC *GetPrintDC();
+
+private:
+ wxPrintDialogBase *m_pimpl;
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPrintDialog)
+ DECLARE_NO_COPY_CLASS(wxPrintDialog)
+};
+
+#endif
+
#if defined(__WXUNIVERSAL__) && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
#include "wx/generic/prntdlgg.h"
#elif defined(__WXMSW__)
#endif
#if (defined(__WXUNIVERSAL__) && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) ) || (!defined(__WXMSW__) && !defined(__WXMAC__))
-#define wxPrintDialog wxGenericPrintDialog
-
#define wxPrintSetupDialog wxGenericPrintSetupDialog
-
#define wxPageSetupDialog wxGenericPageSetupDialog
#endif
class WXDLLEXPORT wxPrintout;
class WXDLLEXPORT wxPrinterBase;
class WXDLLEXPORT wxPrintDialog;
+class WXDLLEXPORT wxPrintDialogBase;
class WXDLLEXPORT wxPrintPreviewBase;
class WXDLLEXPORT wxPreviewCanvas;
class WXDLLEXPORT wxPreviewControlBar;
virtual bool HasPrintSetupDialog() = 0;
virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0;
+
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
wxPrintout *printout = NULL,
wxPrintDialogData *data = NULL ) = 0;
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
wxPrintout *printout,
wxPrintData *data ) = 0;
+
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintDialogData *data = NULL ) = 0;
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintData *data ) = 0;
static void SetPrintFactory( wxPrintFactory *factory );
static wxPrintFactory *GetFactory();
{ return true; }
virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );
+
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
wxPrintout *printout = NULL,
wxPrintDialogData *data = NULL );
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
wxPrintout *printout,
wxPrintData *data );
+
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintDialogData *data = NULL );
+ virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
+ wxPrintData *data );
};
//----------------------------------------------------------------------------
virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);
- wxPrintDialogData& GetPrintDialogData() const
- { return (wxPrintDialogData&) m_printDialogData; }
+ virtual wxPrintDialogData& GetPrintDialogData() const;
bool GetAbort() const { return sm_abortIt; }
static wxPrinterError GetLastError() { return sm_lastError; }
virtual bool Setup(wxWindow *parent);
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true);
virtual wxDC* PrintDialog(wxWindow *parent);
+
+ virtual wxPrintDialogData& GetPrintDialogData() const;
protected:
wxPrinterBase *m_pimpl;
#endif
}
+wxPrintDialogBase *wxNativePrintFactory::CreatePrintDialog( wxWindow *parent,
+ wxPrintDialogData *data )
+{
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ return new wxWindowsPrintDialog( parent, data );
+#elif defined(__WXMAC__)
+ return new wxMacPrintDialog( parent, data );
+#else
+ return new wxGenericPrintDialog( parent, data );
+#endif
+}
+
+wxPrintDialogBase *wxNativePrintFactory::CreatePrintDialog( wxWindow *parent,
+ wxPrintData *data )
+{
+#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
+ return new wxWindowsPrintDialog( parent, data );
+#elif defined(__WXMAC__)
+ return new wxMacPrintDialog( parent, data );
+#else
+ return new wxGenericPrintDialog( parent, data );
+#endif
+}
+
//----------------------------------------------------------------------------
// wxPrinterBase
//----------------------------------------------------------------------------
wxMessageBox(message, _("Printing Error"), wxOK, parent);
}
+wxPrintDialogData& wxPrinterBase::GetPrintDialogData() const
+{
+ return (wxPrintDialogData&) m_printDialogData;
+}
+
//----------------------------------------------------------------------------
// wxPrinter
//----------------------------------------------------------------------------
return m_pimpl->PrintDialog( parent );
}
+wxPrintDialogData& wxPrinter::GetPrintDialogData() const
+{
+ return m_pimpl->GetPrintDialogData();
+}
+
+// ---------------------------------------------------------------------------
+// wxPrintDialogBase: the common dialog for printing.
+// ---------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxPrintDialogBase, wxObject)
+
+wxPrintDialogBase::wxPrintDialogBase(wxWindow *parent, wxWindowID id,
+ const wxString &title, const wxPoint &pos, const wxSize &size, long style ) :
+ wxDialog( parent, id, title, pos, size, style )
+{
+}
+
+// ---------------------------------------------------------------------------
+// wxPrintDialog: the common dialog for printing.
+// ---------------------------------------------------------------------------
+
+IMPLEMENT_CLASS(wxPrintDialog, wxObject)
+
+wxPrintDialog::wxPrintDialog(wxWindow *parent, wxPrintDialogData* data)
+{
+ m_pimpl = wxPrintFactory::GetFactory()->CreatePrintDialog( parent, data );
+}
+
+wxPrintDialog::wxPrintDialog(wxWindow *parent, wxPrintData* data)
+{
+ m_pimpl = wxPrintFactory::GetFactory()->CreatePrintDialog( parent, data );
+}
+
+wxPrintDialog::~wxPrintDialog()
+{
+ delete m_pimpl;
+}
+
+int wxPrintDialog::ShowModal()
+{
+ return m_pimpl->ShowModal();
+}
+
+wxPrintDialogData& wxPrintDialog::GetPrintDialogData()
+{
+ return m_pimpl->GetPrintDialogData();
+}
+
+wxPrintData& wxPrintDialog::GetPrintData()
+{
+ return m_pimpl->GetPrintData();
+}
+wxDC *wxPrintDialog::GetPrintDC()
+{
+ return m_pimpl->GetPrintDC();
+}
+
//----------------------------------------------------------------------------
// wxPrintAbortDialog
//----------------------------------------------------------------------------
#if wxUSE_POSTSCRIPT
-IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
-BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
- EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
- EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
- EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
-END_EVENT_TABLE()
-
#endif // wxUSE_POSTSCRIPT
IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
// Generic print dialog for non-Windows printing use.
// ----------------------------------------------------------------------------
+IMPLEMENT_CLASS(wxGenericPrintDialog, wxPrintDialogBase)
+
+BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxPrintDialogBase)
+ EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
+ EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
+ EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
+END_EVENT_TABLE()
+
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
wxPrintDialogData* data)
- : wxDialog(parent, wxID_ANY, _("Print"),
+ : wxPrintDialogBase(parent, wxID_ANY, _("Print"),
wxPoint(0, 0), wxSize(600, 600),
wxDEFAULT_DIALOG_STYLE |
wxTAB_TRAVERSAL)
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
wxPrintData* data)
- : wxDialog(parent, wxID_ANY, _("Print"),
+ : wxPrintDialogBase(parent, wxID_ANY, _("Print"),
wxPoint(0, 0), wxSize(600, 600),
wxDEFAULT_DIALOG_STYLE |
wxTAB_TRAVERSAL)
// Transfer settings to the print dialog's print data.
m_printDialogData.GetPrintData() = genericPrintSetupDialog->GetPrintData();
}
- genericPrintSetupDialog->Destroy();
+ // genericPrintSetupDialog->Destroy();
// Restore the wxPrintData settings again (uncomment if any settings become common
// to both dialogs)
wxPrintDialogData data;
data = GetPageSetupData().GetPrintData();
data.SetSetupDialog(true);
- wxPrintDialog *printDialog = new wxPrintDialog(this, & data);
- printDialog->ShowModal();
+ 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().GetPrintData() = printDialog.GetPrintDialogData().GetPrintData();
GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
- printDialog->Destroy();
-
// Now update the dialog in case the page setup dialog changed some of our settings.
TransferDataToWindow();
}
// Use generic page setup dialog: use your own native one if one exists.
-#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
+IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase)
IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
-#endif
-wxPrintDialog::wxPrintDialog()
+wxMacPrintDialog::wxMacPrintDialog()
{
m_dialogParent = NULL;
m_printerDC = NULL;
m_destroyDC = TRUE;
}
-wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data)
+wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintDialogData* data)
{
Create(p, data);
}
-wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
+wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintData* data)
{
wxPrintDialogData data2;
if ( data )
Create(p, &data2);
}
-bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
+bool wxMacPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
{
m_dialogParent = p;
m_printerDC = NULL;
return TRUE;
}
-wxPrintDialog::~wxPrintDialog()
+wxMacPrintDialog::~wxMacPrintDialog()
{
if (m_destroyDC && m_printerDC) {
delete m_printerDC;
}
}
-int wxPrintDialog::ShowModal()
+int wxMacPrintDialog::ShowModal()
{
m_printDialogData.ConvertToNative() ;
int result = m_printDialogData.GetPrintData().m_nativePrintData->ShowPrintDialog() ;
return result ;
}
-wxDC *wxPrintDialog::GetPrintDC()
+wxDC *wxMacPrintDialog::GetPrintDC()
{
return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
}
#include "wx/app.h"
#endif
+#include "wx/cmndata.h"
#include "wx/printdlg.h"
#include "wx/dcprint.h"
#include <print.h>
#endif
-// ---------------------------------------------------------------------------
-// wxWin macros
-// ---------------------------------------------------------------------------
-
- IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
- IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
-
-// ===========================================================================
-// implementation
-// ===========================================================================
-
// ---------------------------------------------------------------------------
// wxPrintDialog
// ---------------------------------------------------------------------------
-wxPrintDialog::wxPrintDialog()
-{
- m_dialogParent = NULL;
- m_printerDC = NULL;
- m_destroyDC = true;
-}
+IMPLEMENT_CLASS(wxWindowsPrintDialog, wxPrintDialogBase)
-wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data)
+wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow *p, wxPrintDialogData* data)
{
Create(p, data);
}
-wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
+wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow *p, wxPrintData* data)
{
wxPrintDialogData data2;
if ( data )
Create(p, &data2);
}
-bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
+bool wxWindowsPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
{
m_dialogParent = p;
m_printerDC = NULL;
return true;
}
-wxPrintDialog::~wxPrintDialog()
+wxWindowsPrintDialog::~wxWindowsPrintDialog()
{
if (m_destroyDC && m_printerDC)
delete m_printerDC;
}
-int wxPrintDialog::ShowModal()
+int wxWindowsPrintDialog::ShowModal()
{
m_printDialogData.ConvertToNative();
}
}
-wxDC *wxPrintDialog::GetPrintDC()
+wxDC *wxWindowsPrintDialog::GetPrintDC()
{
if (m_printerDC)
{
// wxPageSetupDialog
// ---------------------------------------------------------------------------
+IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
+
wxPageSetupDialog::wxPageSetupDialog()
{
m_dialogParent = NULL;