Began work on print dialogs. Now wxPrintDialog
is a pimpl implementation of the native dialog classes, which are created in wxPrintFactory. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/cmndata.h"
|
#include "wx/cmndata.h"
|
||||||
|
#include "wx/printdlg.h"
|
||||||
|
|
||||||
#if wxUSE_POSTSCRIPT
|
#if wxUSE_POSTSCRIPT
|
||||||
#include "wx/dcps.h"
|
#include "wx/dcps.h"
|
||||||
@@ -76,7 +77,7 @@ enum
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if wxUSE_POSTSCRIPT
|
#if wxUSE_POSTSCRIPT
|
||||||
class WXDLLEXPORT wxGenericPrintDialog : public wxDialog
|
class WXDLLEXPORT wxGenericPrintDialog : public wxPrintDialogBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGenericPrintDialog(wxWindow *parent,
|
wxGenericPrintDialog(wxWindow *parent,
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/cmndata.h"
|
#include "wx/cmndata.h"
|
||||||
|
#include "wx/printdlg.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wxPrinterDialog
|
* wxPrinterDialog
|
||||||
@@ -27,28 +28,29 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class WXDLLEXPORT wxDC;
|
class WXDLLEXPORT wxDC;
|
||||||
class WXDLLEXPORT wxPrintDialog: public wxDialog
|
class WXDLLEXPORT wxMacPrintDialog: public wxPrintDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxPrintDialog)
|
public:
|
||||||
|
wxMacPrintDialog();
|
||||||
public:
|
wxMacPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
|
||||||
wxPrintDialog();
|
wxMacPrintDialog(wxWindow *parent, wxPrintData* data );
|
||||||
wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
|
~wxMacPrintDialog();
|
||||||
wxPrintDialog(wxWindow *parent, wxPrintData* data );
|
|
||||||
~wxPrintDialog();
|
|
||||||
|
|
||||||
bool Create(wxWindow *parent, wxPrintDialogData* data = NULL);
|
bool Create(wxWindow *parent, wxPrintDialogData* data = NULL);
|
||||||
virtual int ShowModal();
|
virtual int ShowModal();
|
||||||
|
|
||||||
wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
|
virtual wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
|
||||||
wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); }
|
virtual wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); }
|
||||||
virtual wxDC *GetPrintDC();
|
virtual wxDC *GetPrintDC();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxPrintDialogData m_printDialogData;
|
wxPrintDialogData m_printDialogData;
|
||||||
wxDC* m_printerDC;
|
wxDC* m_printerDC;
|
||||||
bool m_destroyDC;
|
bool m_destroyDC;
|
||||||
wxWindow* m_dialogParent;
|
wxWindow* m_dialogParent;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxPrintDialog)
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxPageSetupDialog: public wxDialog
|
class WXDLLEXPORT wxPageSetupDialog: public wxDialog
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/cmndata.h"
|
#include "wx/cmndata.h"
|
||||||
|
#include "wx/printdlg.h"
|
||||||
|
|
||||||
class WXDLLEXPORT wxDC;
|
class WXDLLEXPORT wxDC;
|
||||||
|
|
||||||
@@ -27,15 +28,12 @@ class WXDLLEXPORT wxDC;
|
|||||||
// wxPrinterDialog: the common dialog for printing.
|
// wxPrinterDialog: the common dialog for printing.
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxPrintDialog : public wxDialog
|
class WXDLLEXPORT wxWindowsPrintDialog : public wxPrintDialogBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxPrintDialog)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxPrintDialog();
|
wxWindowsPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
|
||||||
wxPrintDialog(wxWindow *parent, wxPrintDialogData* data = NULL);
|
wxWindowsPrintDialog(wxWindow *parent, wxPrintData* data);
|
||||||
wxPrintDialog(wxWindow *parent, wxPrintData* data);
|
virtual ~wxWindowsPrintDialog();
|
||||||
virtual ~wxPrintDialog();
|
|
||||||
|
|
||||||
bool Create(wxWindow *parent, wxPrintDialogData* data = NULL);
|
bool Create(wxWindow *parent, wxPrintDialogData* data = NULL);
|
||||||
virtual int ShowModal();
|
virtual int ShowModal();
|
||||||
@@ -44,13 +42,14 @@ public:
|
|||||||
wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); }
|
wxPrintData& GetPrintData() { return m_printDialogData.GetPrintData(); }
|
||||||
virtual wxDC *GetPrintDC();
|
virtual wxDC *GetPrintDC();
|
||||||
|
|
||||||
private:
|
|
||||||
wxPrintDialogData m_printDialogData;
|
wxPrintDialogData m_printDialogData;
|
||||||
wxDC* m_printerDC;
|
wxDC* m_printerDC;
|
||||||
bool m_destroyDC;
|
bool m_destroyDC;
|
||||||
wxWindow* m_dialogParent;
|
wxWindow* m_dialogParent;
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxPrintDialog)
|
private:
|
||||||
|
DECLARE_NO_COPY_CLASS(wxWindowsPrintDialog)
|
||||||
|
DECLARE_CLASS(wxWindowsPrintDialog)
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxPageSetupDialog: public wxDialog
|
class WXDLLEXPORT wxPageSetupDialog: public wxDialog
|
||||||
|
@@ -1,6 +1,71 @@
|
|||||||
#ifndef _WX_PRINTDLG_H_BASE_
|
#ifndef _WX_PRINTDLG_H_BASE_
|
||||||
#define _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)
|
#if defined(__WXUNIVERSAL__) && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
|
||||||
#include "wx/generic/prntdlgg.h"
|
#include "wx/generic/prntdlgg.h"
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
@@ -20,10 +85,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__WXUNIVERSAL__) && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) ) || (!defined(__WXMSW__) && !defined(__WXMAC__))
|
#if (defined(__WXUNIVERSAL__) && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) ) || (!defined(__WXMSW__) && !defined(__WXMAC__))
|
||||||
#define wxPrintDialog wxGenericPrintDialog
|
|
||||||
|
|
||||||
#define wxPrintSetupDialog wxGenericPrintSetupDialog
|
#define wxPrintSetupDialog wxGenericPrintSetupDialog
|
||||||
|
|
||||||
#define wxPageSetupDialog wxGenericPageSetupDialog
|
#define wxPageSetupDialog wxGenericPageSetupDialog
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@ class WXDLLEXPORT wxChoice;
|
|||||||
class WXDLLEXPORT wxPrintout;
|
class WXDLLEXPORT wxPrintout;
|
||||||
class WXDLLEXPORT wxPrinterBase;
|
class WXDLLEXPORT wxPrinterBase;
|
||||||
class WXDLLEXPORT wxPrintDialog;
|
class WXDLLEXPORT wxPrintDialog;
|
||||||
|
class WXDLLEXPORT wxPrintDialogBase;
|
||||||
class WXDLLEXPORT wxPrintPreviewBase;
|
class WXDLLEXPORT wxPrintPreviewBase;
|
||||||
class WXDLLEXPORT wxPreviewCanvas;
|
class WXDLLEXPORT wxPreviewCanvas;
|
||||||
class WXDLLEXPORT wxPreviewControlBar;
|
class WXDLLEXPORT wxPreviewControlBar;
|
||||||
@@ -64,6 +65,7 @@ public:
|
|||||||
virtual bool HasPrintSetupDialog() = 0;
|
virtual bool HasPrintSetupDialog() = 0;
|
||||||
|
|
||||||
virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0;
|
virtual wxPrinterBase *CreatePrinter( wxPrintDialogData* data ) = 0;
|
||||||
|
|
||||||
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
|
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
|
||||||
wxPrintout *printout = NULL,
|
wxPrintout *printout = NULL,
|
||||||
wxPrintDialogData *data = NULL ) = 0;
|
wxPrintDialogData *data = NULL ) = 0;
|
||||||
@@ -71,6 +73,11 @@ public:
|
|||||||
wxPrintout *printout,
|
wxPrintout *printout,
|
||||||
wxPrintData *data ) = 0;
|
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 void SetPrintFactory( wxPrintFactory *factory );
|
||||||
static wxPrintFactory *GetFactory();
|
static wxPrintFactory *GetFactory();
|
||||||
static wxPrintFactory *m_factory;
|
static wxPrintFactory *m_factory;
|
||||||
@@ -85,12 +92,18 @@ public:
|
|||||||
{ return true; }
|
{ return true; }
|
||||||
|
|
||||||
virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );
|
virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data );
|
||||||
|
|
||||||
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
|
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
|
||||||
wxPrintout *printout = NULL,
|
wxPrintout *printout = NULL,
|
||||||
wxPrintDialogData *data = NULL );
|
wxPrintDialogData *data = NULL );
|
||||||
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
|
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
|
||||||
wxPrintout *printout,
|
wxPrintout *printout,
|
||||||
wxPrintData *data );
|
wxPrintData *data );
|
||||||
|
|
||||||
|
virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
|
||||||
|
wxPrintDialogData *data = NULL );
|
||||||
|
virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
|
||||||
|
wxPrintData *data );
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -110,8 +123,7 @@ public:
|
|||||||
virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
|
virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
|
||||||
virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);
|
virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);
|
||||||
|
|
||||||
wxPrintDialogData& GetPrintDialogData() const
|
virtual wxPrintDialogData& GetPrintDialogData() const;
|
||||||
{ return (wxPrintDialogData&) m_printDialogData; }
|
|
||||||
bool GetAbort() const { return sm_abortIt; }
|
bool GetAbort() const { return sm_abortIt; }
|
||||||
|
|
||||||
static wxPrinterError GetLastError() { return sm_lastError; }
|
static wxPrinterError GetLastError() { return sm_lastError; }
|
||||||
@@ -155,6 +167,8 @@ public:
|
|||||||
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true);
|
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true);
|
||||||
virtual wxDC* PrintDialog(wxWindow *parent);
|
virtual wxDC* PrintDialog(wxWindow *parent);
|
||||||
|
|
||||||
|
virtual wxPrintDialogData& GetPrintDialogData() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxPrinterBase *m_pimpl;
|
wxPrinterBase *m_pimpl;
|
||||||
|
|
||||||
|
@@ -121,6 +121,30 @@ wxPrintPreviewBase *wxNativePrintFactory::CreatePrintPreview( wxPrintout *previe
|
|||||||
#endif
|
#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
|
// wxPrinterBase
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -167,6 +191,11 @@ void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout)
|
|||||||
wxMessageBox(message, _("Printing Error"), wxOK, parent);
|
wxMessageBox(message, _("Printing Error"), wxOK, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxPrintDialogData& wxPrinterBase::GetPrintDialogData() const
|
||||||
|
{
|
||||||
|
return (wxPrintDialogData&) m_printDialogData;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// wxPrinter
|
// wxPrinter
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -208,6 +237,63 @@ wxDC* wxPrinter::PrintDialog(wxWindow *parent)
|
|||||||
return m_pimpl->PrintDialog( parent );
|
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
|
// wxPrintAbortDialog
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@@ -73,15 +73,8 @@
|
|||||||
|
|
||||||
#if wxUSE_POSTSCRIPT
|
#if wxUSE_POSTSCRIPT
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
|
|
||||||
IMPLEMENT_CLASS(wxGenericPrintSetupDialog, 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
|
#endif // wxUSE_POSTSCRIPT
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
|
IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
|
||||||
@@ -102,9 +95,17 @@ extern wxPrintPaperDatabase *wxThePrintPaperDatabase;
|
|||||||
// Generic print dialog for non-Windows printing use.
|
// 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,
|
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
|
||||||
wxPrintDialogData* data)
|
wxPrintDialogData* data)
|
||||||
: wxDialog(parent, wxID_ANY, _("Print"),
|
: wxPrintDialogBase(parent, wxID_ANY, _("Print"),
|
||||||
wxPoint(0, 0), wxSize(600, 600),
|
wxPoint(0, 0), wxSize(600, 600),
|
||||||
wxDEFAULT_DIALOG_STYLE |
|
wxDEFAULT_DIALOG_STYLE |
|
||||||
wxTAB_TRAVERSAL)
|
wxTAB_TRAVERSAL)
|
||||||
@@ -117,7 +118,7 @@ wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
|
|||||||
|
|
||||||
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
|
wxGenericPrintDialog::wxGenericPrintDialog(wxWindow *parent,
|
||||||
wxPrintData* data)
|
wxPrintData* data)
|
||||||
: wxDialog(parent, wxID_ANY, _("Print"),
|
: wxPrintDialogBase(parent, wxID_ANY, _("Print"),
|
||||||
wxPoint(0, 0), wxSize(600, 600),
|
wxPoint(0, 0), wxSize(600, 600),
|
||||||
wxDEFAULT_DIALOG_STYLE |
|
wxDEFAULT_DIALOG_STYLE |
|
||||||
wxTAB_TRAVERSAL)
|
wxTAB_TRAVERSAL)
|
||||||
@@ -228,7 +229,7 @@ int wxGenericPrintDialog::ShowModal()
|
|||||||
// Transfer settings to the print dialog's print data.
|
// Transfer settings to the print dialog's print data.
|
||||||
m_printDialogData.GetPrintData() = genericPrintSetupDialog->GetPrintData();
|
m_printDialogData.GetPrintData() = genericPrintSetupDialog->GetPrintData();
|
||||||
}
|
}
|
||||||
genericPrintSetupDialog->Destroy();
|
// genericPrintSetupDialog->Destroy();
|
||||||
|
|
||||||
// Restore the wxPrintData settings again (uncomment if any settings become common
|
// Restore the wxPrintData settings again (uncomment if any settings become common
|
||||||
// to both dialogs)
|
// to both dialogs)
|
||||||
@@ -575,16 +576,14 @@ void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxPrintDialogData data;
|
wxPrintDialogData data;
|
||||||
data = GetPageSetupData().GetPrintData();
|
data = GetPageSetupData().GetPrintData();
|
||||||
data.SetSetupDialog(true);
|
data.SetSetupDialog(true);
|
||||||
wxPrintDialog *printDialog = new wxPrintDialog(this, & data);
|
wxPrintDialog printDialog(this, & data);
|
||||||
printDialog->ShowModal();
|
printDialog.ShowModal();
|
||||||
|
|
||||||
// Transfer the page setup print settings from the page dialog to this dialog again, in case
|
// Transfer the page setup print settings from the page dialog to this dialog again, in case
|
||||||
// the page setup dialog changed something.
|
// 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
|
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.
|
// Now update the dialog in case the page setup dialog changed some of our settings.
|
||||||
TransferDataToWindow();
|
TransferDataToWindow();
|
||||||
}
|
}
|
||||||
|
@@ -21,24 +21,22 @@
|
|||||||
|
|
||||||
// Use generic page setup dialog: use your own native one if one exists.
|
// Use generic page setup dialog: use your own native one if one exists.
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
|
|
||||||
IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
|
IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
|
||||||
#endif
|
|
||||||
|
|
||||||
wxPrintDialog::wxPrintDialog()
|
wxMacPrintDialog::wxMacPrintDialog()
|
||||||
{
|
{
|
||||||
m_dialogParent = NULL;
|
m_dialogParent = NULL;
|
||||||
m_printerDC = NULL;
|
m_printerDC = NULL;
|
||||||
m_destroyDC = TRUE;
|
m_destroyDC = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data)
|
wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintDialogData* data)
|
||||||
{
|
{
|
||||||
Create(p, data);
|
Create(p, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
|
wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintData* data)
|
||||||
{
|
{
|
||||||
wxPrintDialogData data2;
|
wxPrintDialogData data2;
|
||||||
if ( data )
|
if ( data )
|
||||||
@@ -47,7 +45,7 @@ wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
|
|||||||
Create(p, &data2);
|
Create(p, &data2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
|
bool wxMacPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
|
||||||
{
|
{
|
||||||
m_dialogParent = p;
|
m_dialogParent = p;
|
||||||
m_printerDC = NULL;
|
m_printerDC = NULL;
|
||||||
@@ -59,7 +57,7 @@ bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPrintDialog::~wxPrintDialog()
|
wxMacPrintDialog::~wxMacPrintDialog()
|
||||||
{
|
{
|
||||||
if (m_destroyDC && m_printerDC) {
|
if (m_destroyDC && m_printerDC) {
|
||||||
delete m_printerDC;
|
delete m_printerDC;
|
||||||
@@ -67,7 +65,7 @@ wxPrintDialog::~wxPrintDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxPrintDialog::ShowModal()
|
int wxMacPrintDialog::ShowModal()
|
||||||
{
|
{
|
||||||
m_printDialogData.ConvertToNative() ;
|
m_printDialogData.ConvertToNative() ;
|
||||||
int result = m_printDialogData.GetPrintData().m_nativePrintData->ShowPrintDialog() ;
|
int result = m_printDialogData.GetPrintData().m_nativePrintData->ShowPrintDialog() ;
|
||||||
@@ -77,7 +75,7 @@ int wxPrintDialog::ShowModal()
|
|||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDC *wxPrintDialog::GetPrintDC()
|
wxDC *wxMacPrintDialog::GetPrintDC()
|
||||||
{
|
{
|
||||||
return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
|
return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
|
||||||
}
|
}
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/cmndata.h"
|
||||||
#include "wx/printdlg.h"
|
#include "wx/printdlg.h"
|
||||||
#include "wx/dcprint.h"
|
#include "wx/dcprint.h"
|
||||||
|
|
||||||
@@ -49,34 +50,18 @@
|
|||||||
#include <print.h>
|
#include <print.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// wxWin macros
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
|
|
||||||
IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
// implementation
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// wxPrintDialog
|
// wxPrintDialog
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
wxPrintDialog::wxPrintDialog()
|
IMPLEMENT_CLASS(wxWindowsPrintDialog, wxPrintDialogBase)
|
||||||
{
|
|
||||||
m_dialogParent = NULL;
|
|
||||||
m_printerDC = NULL;
|
|
||||||
m_destroyDC = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data)
|
wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow *p, wxPrintDialogData* data)
|
||||||
{
|
{
|
||||||
Create(p, data);
|
Create(p, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
|
wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow *p, wxPrintData* data)
|
||||||
{
|
{
|
||||||
wxPrintDialogData data2;
|
wxPrintDialogData data2;
|
||||||
if ( data )
|
if ( data )
|
||||||
@@ -85,7 +70,7 @@ wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
|
|||||||
Create(p, &data2);
|
Create(p, &data2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
|
bool wxWindowsPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
|
||||||
{
|
{
|
||||||
m_dialogParent = p;
|
m_dialogParent = p;
|
||||||
m_printerDC = NULL;
|
m_printerDC = NULL;
|
||||||
@@ -99,13 +84,13 @@ bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPrintDialog::~wxPrintDialog()
|
wxWindowsPrintDialog::~wxWindowsPrintDialog()
|
||||||
{
|
{
|
||||||
if (m_destroyDC && m_printerDC)
|
if (m_destroyDC && m_printerDC)
|
||||||
delete m_printerDC;
|
delete m_printerDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxPrintDialog::ShowModal()
|
int wxWindowsPrintDialog::ShowModal()
|
||||||
{
|
{
|
||||||
m_printDialogData.ConvertToNative();
|
m_printDialogData.ConvertToNative();
|
||||||
|
|
||||||
@@ -134,7 +119,7 @@ int wxPrintDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDC *wxPrintDialog::GetPrintDC()
|
wxDC *wxWindowsPrintDialog::GetPrintDC()
|
||||||
{
|
{
|
||||||
if (m_printerDC)
|
if (m_printerDC)
|
||||||
{
|
{
|
||||||
@@ -149,6 +134,8 @@ wxDC *wxPrintDialog::GetPrintDC()
|
|||||||
// wxPageSetupDialog
|
// wxPageSetupDialog
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
|
||||||
|
|
||||||
wxPageSetupDialog::wxPageSetupDialog()
|
wxPageSetupDialog::wxPageSetupDialog()
|
||||||
{
|
{
|
||||||
m_dialogParent = NULL;
|
m_dialogParent = NULL;
|
||||||
|
Reference in New Issue
Block a user