Added new wxPrintFactory code and made wxPrinter
and wxPrintPreview make use of it. BIG CHANGE. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29817 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,36 +1,17 @@
|
||||
#ifndef _WX_PRINT_H_BASE_
|
||||
#define _WX_PRINT_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__) && (!defined(__WXUNIVERSAL__) || !wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
|
||||
#include "wx/msw/printwin.h"
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||
|
||||
#ifndef wxPrinter
|
||||
#define wxPrinter wxWindowsPrinter
|
||||
#endif
|
||||
#ifndef wxPrintPreview
|
||||
#define wxPrintPreview wxWindowsPrintPreview
|
||||
#endif
|
||||
#include "wx/msw/printwin.h"
|
||||
|
||||
#elif defined(__WXMAC__)
|
||||
|
||||
#include "wx/mac/printmac.h"
|
||||
|
||||
#ifndef wxPrinter
|
||||
#define wxPrinter wxMacPrinter
|
||||
#endif
|
||||
#ifndef wxPrintPreview
|
||||
#define wxPrintPreview wxMacPrintPreview
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include "wx/generic/printps.h"
|
||||
|
||||
#ifndef wxPrinter
|
||||
#define wxPrinter wxPostScriptPrinter
|
||||
#endif
|
||||
#ifndef wxPrintPreview
|
||||
#define wxPrintPreview wxPostScriptPrintPreview
|
||||
#endif
|
||||
#include "wx/generic/printps.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -37,7 +37,11 @@ class WXDLLEXPORT wxPrintPreviewBase;
|
||||
class WXDLLEXPORT wxPreviewCanvas;
|
||||
class WXDLLEXPORT wxPreviewControlBar;
|
||||
class WXDLLEXPORT wxPreviewFrame;
|
||||
class WXDLLEXPORT wxPrintFactory;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// error consts
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum wxPrinterError
|
||||
{
|
||||
@@ -46,6 +50,52 @@ enum wxPrinterError
|
||||
wxPRINTER_ERROR
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrintFactory
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPrintFactory
|
||||
{
|
||||
public:
|
||||
wxPrintFactory() {}
|
||||
virtual ~wxPrintFactory() {}
|
||||
|
||||
virtual bool HasPageSetupDialog() = 0;
|
||||
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;
|
||||
|
||||
static void SetPrintFactory( wxPrintFactory *factory );
|
||||
static wxPrintFactory *GetFactory();
|
||||
static wxPrintFactory *m_factory;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxNativePrintFactory: public wxPrintFactory
|
||||
{
|
||||
public:
|
||||
virtual bool HasPageSetupDialog()
|
||||
{ return true; }
|
||||
virtual bool HasPrintSetupDialog()
|
||||
{ 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 );
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrinterBase
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Represents the printer: manages printing a wxPrintout object
|
||||
@@ -88,8 +138,36 @@ private:
|
||||
DECLARE_NO_COPY_CLASS(wxPrinterBase)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrinter
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPrinter: public wxPrinterBase
|
||||
{
|
||||
public:
|
||||
wxPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
||||
virtual ~wxPrinter();
|
||||
|
||||
virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
|
||||
virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);
|
||||
|
||||
virtual bool Setup(wxWindow *parent);
|
||||
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true);
|
||||
virtual wxDC* PrintDialog(wxWindow *parent);
|
||||
|
||||
protected:
|
||||
wxPrinterBase *m_pimpl;
|
||||
|
||||
private:
|
||||
DECLARE_CLASS(wxPrinter)
|
||||
DECLARE_NO_COPY_CLASS(wxPrinter)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrintout
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* wxPrintout
|
||||
* Represents an object via which a document may be printed.
|
||||
* The programmer derives from this, overrides (at least) OnPrintPage,
|
||||
* and passes it to a wxPrinter object for printing, or a wxPrintPreview
|
||||
@@ -301,15 +379,16 @@ private:
|
||||
DECLARE_NO_COPY_CLASS(wxPreviewControlBar)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrintPreviewBase
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* wxPrintPreview
|
||||
* Programmer creates an object of this class to preview a wxPrintout.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPrintPreviewBase: public wxObject
|
||||
{
|
||||
DECLARE_CLASS(wxPrintPreviewBase)
|
||||
|
||||
public:
|
||||
wxPrintPreviewBase(wxPrintout *printout,
|
||||
wxPrintout *printoutForPrinting = (wxPrintout *) NULL,
|
||||
@@ -320,17 +399,17 @@ public:
|
||||
virtual ~wxPrintPreviewBase();
|
||||
|
||||
virtual bool SetCurrentPage(int pageNum);
|
||||
int GetCurrentPage() const { return m_currentPage; };
|
||||
virtual int GetCurrentPage() const;
|
||||
|
||||
void SetPrintout(wxPrintout *printout) { m_previewPrintout = printout; };
|
||||
wxPrintout *GetPrintout() const { return m_previewPrintout; };
|
||||
wxPrintout *GetPrintoutForPrinting() const { return m_printPrintout; };
|
||||
virtual void SetPrintout(wxPrintout *printout);
|
||||
virtual wxPrintout *GetPrintout() const;
|
||||
virtual wxPrintout *GetPrintoutForPrinting() const;
|
||||
|
||||
void SetFrame(wxFrame *frame) { m_previewFrame = frame; };
|
||||
void SetCanvas(wxPreviewCanvas *canvas) { m_previewCanvas = canvas; };
|
||||
virtual void SetFrame(wxFrame *frame);
|
||||
virtual void SetCanvas(wxPreviewCanvas *canvas);
|
||||
|
||||
virtual wxFrame *GetFrame() const { return m_previewFrame; }
|
||||
virtual wxPreviewCanvas *GetCanvas() const { return m_previewCanvas; }
|
||||
virtual wxFrame *GetFrame() const;
|
||||
virtual wxPreviewCanvas *GetCanvas() const;
|
||||
|
||||
// The preview canvas should call this from OnPaint
|
||||
virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
|
||||
@@ -344,16 +423,17 @@ public:
|
||||
// This is called by wxPrintPreview to render a page into a wxMemoryDC.
|
||||
virtual bool RenderPage(int pageNum);
|
||||
|
||||
wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
|
||||
|
||||
virtual void SetZoom(int percent);
|
||||
int GetZoom() const { return m_currentZoom; };
|
||||
virtual int GetZoom() const;
|
||||
|
||||
int GetMaxPage() const { return m_maxPage; }
|
||||
int GetMinPage() const { return m_minPage; }
|
||||
virtual wxPrintDialogData& GetPrintDialogData();
|
||||
|
||||
bool Ok() const { return m_isOk; }
|
||||
void SetOk(bool ok) { m_isOk = ok; }
|
||||
virtual int GetMaxPage() const;
|
||||
virtual int GetMinPage() const;
|
||||
|
||||
virtual bool Ok() const;
|
||||
virtual void SetOk(bool ok);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// OVERRIDES
|
||||
@@ -392,11 +472,62 @@ private:
|
||||
void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxPrintPreviewBase)
|
||||
DECLARE_CLASS(wxPrintPreviewBase)
|
||||
};
|
||||
|
||||
/*
|
||||
* Abort dialog
|
||||
*/
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrintPreview
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPrintPreview: public wxPrintPreviewBase
|
||||
{
|
||||
public:
|
||||
wxPrintPreview(wxPrintout *printout,
|
||||
wxPrintout *printoutForPrinting = (wxPrintout *) NULL,
|
||||
wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
||||
wxPrintPreview(wxPrintout *printout,
|
||||
wxPrintout *printoutForPrinting,
|
||||
wxPrintData *data);
|
||||
virtual ~wxPrintPreview();
|
||||
|
||||
virtual bool SetCurrentPage(int pageNum);
|
||||
virtual int GetCurrentPage() const;
|
||||
virtual void SetPrintout(wxPrintout *printout);
|
||||
virtual wxPrintout *GetPrintout() const;
|
||||
virtual wxPrintout *GetPrintoutForPrinting() const;
|
||||
virtual void SetFrame(wxFrame *frame);
|
||||
virtual void SetCanvas(wxPreviewCanvas *canvas);
|
||||
|
||||
virtual wxFrame *GetFrame() const;
|
||||
virtual wxPreviewCanvas *GetCanvas() const;
|
||||
virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
|
||||
virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
|
||||
virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
|
||||
virtual bool RenderPage(int pageNum);
|
||||
virtual void SetZoom(int percent);
|
||||
|
||||
virtual bool Print(bool interactive);
|
||||
virtual void DetermineScaling();
|
||||
|
||||
virtual wxPrintDialogData& GetPrintDialogData();
|
||||
|
||||
virtual int GetMaxPage() const;
|
||||
virtual int GetMinPage() const;
|
||||
|
||||
virtual bool Ok() const;
|
||||
virtual void SetOk(bool ok);
|
||||
|
||||
private:
|
||||
wxPrintPreviewBase *m_pimpl;
|
||||
|
||||
private:
|
||||
DECLARE_CLASS(wxPrintPreview)
|
||||
DECLARE_NO_COPY_CLASS(wxPrintPreview)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrintAbortDialog
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPrintAbortDialog: public wxDialog
|
||||
{
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "wx/prntbase.h"
|
||||
#include "wx/dcprint.h"
|
||||
#include "wx/printdlg.h"
|
||||
#include "wx/print.h"
|
||||
#include "wx/module.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -57,26 +58,74 @@
|
||||
#endif
|
||||
#endif // __WXMSW__
|
||||
|
||||
IMPLEMENT_CLASS(wxPrinterBase, wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject)
|
||||
IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow)
|
||||
IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow)
|
||||
IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
|
||||
IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
|
||||
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrintFactory
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow)
|
||||
EVT_PAINT(wxPreviewCanvas::OnPaint)
|
||||
EVT_CHAR(wxPreviewCanvas::OnChar)
|
||||
EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
wxPrintFactory *wxPrintFactory::m_factory = NULL;
|
||||
|
||||
/*
|
||||
* Printer
|
||||
*/
|
||||
void wxPrintFactory::SetPrintFactory( wxPrintFactory *factory )
|
||||
{
|
||||
if (wxPrintFactory::m_factory)
|
||||
delete wxPrintFactory::m_factory;
|
||||
|
||||
wxPrintFactory::m_factory = factory;
|
||||
}
|
||||
|
||||
wxPrintFactory *wxPrintFactory::GetFactory()
|
||||
{
|
||||
if (!wxPrintFactory::m_factory)
|
||||
wxPrintFactory::m_factory = new wxNativePrintFactory;
|
||||
|
||||
return wxPrintFactory::m_factory;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxNativePrintFactory
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
wxPrinterBase *wxNativePrintFactory::CreatePrinter( wxPrintDialogData *data )
|
||||
{
|
||||
#if defined(__WXMSW__)
|
||||
return new wxWindowsPrinter( data );
|
||||
#elif defined(__WXMAC__)
|
||||
return new wxMacPrinter( data );
|
||||
#else
|
||||
return new wxPostScriptPrinter( data );
|
||||
#endif
|
||||
};
|
||||
|
||||
wxPrintPreviewBase *wxNativePrintFactory::CreatePrintPreview( wxPrintout *preview,
|
||||
wxPrintout *printout, wxPrintDialogData *data )
|
||||
{
|
||||
#if defined(__WXMSW__)
|
||||
return new wxWindowsPrintPreview( preview, printout, data );
|
||||
#elif defined(__WXMAC__)
|
||||
return new wxMacPrintPreview( preview, printout, data );
|
||||
#else
|
||||
return new wxPostScriptPrintPreview( preview, printout, data );
|
||||
#endif
|
||||
}
|
||||
|
||||
wxPrintPreviewBase *wxNativePrintFactory::CreatePrintPreview( wxPrintout *preview,
|
||||
wxPrintout *printout, wxPrintData *data )
|
||||
{
|
||||
#if defined(__WXMSW__)
|
||||
return new wxWindowsPrintPreview( preview, printout, data );
|
||||
#elif defined(__WXMAC__)
|
||||
return new wxMacPrintPreview( preview, printout, data );
|
||||
#else
|
||||
return new wxPostScriptPrintPreview( preview, printout, data );
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrinterBase
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(wxPrinterBase, wxObject)
|
||||
|
||||
wxPrinterBase::wxPrinterBase(wxPrintDialogData *data)
|
||||
{
|
||||
@@ -96,14 +145,6 @@ wxPrinterBase::~wxPrinterBase()
|
||||
{
|
||||
}
|
||||
|
||||
void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPrinterBase::sm_abortIt = true;
|
||||
wxPrinterBase::sm_abortWindow->Show(false);
|
||||
wxPrinterBase::sm_abortWindow->Close(true);
|
||||
wxPrinterBase::sm_abortWindow = (wxWindow *) NULL;
|
||||
}
|
||||
|
||||
wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout * printout)
|
||||
{
|
||||
wxPrintAbortDialog *dialog = new wxPrintAbortDialog(parent, _("Printing ") , wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
|
||||
@@ -126,9 +167,68 @@ void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout)
|
||||
wxMessageBox(message, _("Printing Error"), wxOK, parent);
|
||||
}
|
||||
|
||||
/*
|
||||
* Printout class
|
||||
*/
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrinter
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(wxPrinter, wxPrinterBase)
|
||||
|
||||
wxPrinter::wxPrinter(wxPrintDialogData *data)
|
||||
{
|
||||
m_pimpl = wxPrintFactory::GetFactory()->CreatePrinter( data );
|
||||
}
|
||||
|
||||
wxPrinter::~wxPrinter()
|
||||
{
|
||||
delete m_pimpl;
|
||||
}
|
||||
|
||||
wxWindow *wxPrinter::CreateAbortWindow(wxWindow *parent, wxPrintout *printout)
|
||||
{
|
||||
return m_pimpl->CreateAbortWindow( parent, printout );
|
||||
}
|
||||
|
||||
void wxPrinter::ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message)
|
||||
{
|
||||
m_pimpl->ReportError( parent, printout, message );
|
||||
}
|
||||
|
||||
bool wxPrinter::Setup(wxWindow *parent)
|
||||
{
|
||||
return m_pimpl->Setup( parent );
|
||||
}
|
||||
|
||||
bool wxPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||
{
|
||||
return m_pimpl->Print( parent, printout, prompt );
|
||||
}
|
||||
|
||||
wxDC* wxPrinter::PrintDialog(wxWindow *parent)
|
||||
{
|
||||
return m_pimpl->PrintDialog( parent );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrintAbortDialog
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
|
||||
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPrinterBase::sm_abortIt = true;
|
||||
wxPrinterBase::sm_abortWindow->Show(false);
|
||||
wxPrinterBase::sm_abortWindow->Close(true);
|
||||
wxPrinterBase::sm_abortWindow = (wxWindow *) NULL;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrintout
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject)
|
||||
|
||||
wxPrintout::wxPrintout(const wxString& title)
|
||||
{
|
||||
@@ -180,9 +280,17 @@ void wxPrintout::GetPageInfo(int *minPage, int *maxPage, int *fromPage, int *toP
|
||||
*toPage = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Preview canvas
|
||||
*/
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPreviewCanvas
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow)
|
||||
EVT_PAINT(wxPreviewCanvas::OnPaint)
|
||||
EVT_CHAR(wxPreviewCanvas::OnChar)
|
||||
EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// VZ: the current code doesn't refresh properly without
|
||||
// wxFULL_REPAINT_ON_RESIZE, this must be fixed as otherwise we have
|
||||
@@ -284,9 +392,11 @@ void wxPreviewCanvas::OnChar(wxKeyEvent &event)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Preview control bar
|
||||
*/
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPreviewControlBar
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel)
|
||||
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnWindowClose)
|
||||
@@ -533,6 +643,8 @@ int wxPreviewControlBar::GetZoomControl()
|
||||
* Preview frame
|
||||
*/
|
||||
|
||||
IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxPreviewFrame, wxFrame)
|
||||
EVT_CLOSE(wxPreviewFrame::OnCloseWindow)
|
||||
END_EVENT_TABLE()
|
||||
@@ -702,6 +814,23 @@ bool wxPrintPreviewBase::SetCurrentPage(int pageNum)
|
||||
return true;
|
||||
}
|
||||
|
||||
int wxPrintPreviewBase::GetCurrentPage() const
|
||||
{ return m_currentPage; };
|
||||
void wxPrintPreviewBase::SetPrintout(wxPrintout *printout)
|
||||
{ m_previewPrintout = printout; };
|
||||
wxPrintout *wxPrintPreviewBase::GetPrintout() const
|
||||
{ return m_previewPrintout; };
|
||||
wxPrintout *wxPrintPreviewBase::GetPrintoutForPrinting() const
|
||||
{ return m_printPrintout; };
|
||||
void wxPrintPreviewBase::SetFrame(wxFrame *frame)
|
||||
{ m_previewFrame = frame; };
|
||||
void wxPrintPreviewBase::SetCanvas(wxPreviewCanvas *canvas)
|
||||
{ m_previewCanvas = canvas; };
|
||||
wxFrame *wxPrintPreviewBase::GetFrame() const
|
||||
{ return m_previewFrame; }
|
||||
wxPreviewCanvas *wxPrintPreviewBase::GetCanvas() const
|
||||
{ return m_previewCanvas; }
|
||||
|
||||
bool wxPrintPreviewBase::PaintPage(wxPreviewCanvas *canvas, wxDC& dc)
|
||||
{
|
||||
DrawBlankPage(canvas, dc);
|
||||
@@ -909,4 +1038,159 @@ void wxPrintPreviewBase::SetZoom(int percent)
|
||||
}
|
||||
}
|
||||
|
||||
wxPrintDialogData& wxPrintPreviewBase::GetPrintDialogData()
|
||||
{
|
||||
return m_printDialogData;
|
||||
}
|
||||
|
||||
int wxPrintPreviewBase::GetZoom() const
|
||||
{ return m_currentZoom; }
|
||||
int wxPrintPreviewBase::GetMaxPage() const
|
||||
{ return m_maxPage; }
|
||||
int wxPrintPreviewBase::GetMinPage() const
|
||||
{ return m_minPage; }
|
||||
bool wxPrintPreviewBase::Ok() const
|
||||
{ return m_isOk; }
|
||||
void wxPrintPreviewBase::SetOk(bool ok)
|
||||
{ m_isOk = ok; }
|
||||
//----------------------------------------------------------------------------
|
||||
// wxPrintPreview
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CLASS(wxPrintPreview, wxPrintPreviewBase)
|
||||
|
||||
wxPrintPreview::wxPrintPreview(wxPrintout *printout,
|
||||
wxPrintout *printoutForPrinting,
|
||||
wxPrintDialogData *data) :
|
||||
wxPrintPreviewBase( printout, printoutForPrinting, data )
|
||||
{
|
||||
m_pimpl = wxPrintFactory::GetFactory()->
|
||||
CreatePrintPreview( printout, printoutForPrinting, data );
|
||||
}
|
||||
|
||||
wxPrintPreview::wxPrintPreview(wxPrintout *printout,
|
||||
wxPrintout *printoutForPrinting,
|
||||
wxPrintData *data ) :
|
||||
wxPrintPreviewBase( printout, printoutForPrinting, data )
|
||||
{
|
||||
m_pimpl = wxPrintFactory::GetFactory()->
|
||||
CreatePrintPreview( printout, printoutForPrinting, data );
|
||||
}
|
||||
|
||||
wxPrintPreview::~wxPrintPreview()
|
||||
{
|
||||
delete m_pimpl;
|
||||
|
||||
// don't delete twice
|
||||
m_printPrintout = NULL;
|
||||
m_previewPrintout = NULL;
|
||||
m_previewBitmap = NULL;
|
||||
}
|
||||
|
||||
bool wxPrintPreview::SetCurrentPage(int pageNum)
|
||||
{
|
||||
return m_pimpl->SetCurrentPage( pageNum );
|
||||
}
|
||||
|
||||
int wxPrintPreview::GetCurrentPage() const
|
||||
{
|
||||
return m_pimpl->GetCurrentPage();
|
||||
}
|
||||
|
||||
void wxPrintPreview::SetPrintout(wxPrintout *printout)
|
||||
{
|
||||
m_pimpl->SetPrintout( printout );
|
||||
}
|
||||
|
||||
wxPrintout *wxPrintPreview::GetPrintout() const
|
||||
{
|
||||
return m_pimpl->GetPrintout();
|
||||
}
|
||||
|
||||
wxPrintout *wxPrintPreview::GetPrintoutForPrinting() const
|
||||
{
|
||||
return m_pimpl->GetPrintoutForPrinting();
|
||||
}
|
||||
|
||||
void wxPrintPreview::SetFrame(wxFrame *frame)
|
||||
{
|
||||
m_pimpl->SetFrame( frame );
|
||||
}
|
||||
|
||||
void wxPrintPreview::SetCanvas(wxPreviewCanvas *canvas)
|
||||
{
|
||||
m_pimpl->SetCanvas( canvas );
|
||||
}
|
||||
|
||||
wxFrame *wxPrintPreview::GetFrame() const
|
||||
{
|
||||
return m_pimpl->GetFrame();
|
||||
}
|
||||
|
||||
wxPreviewCanvas *wxPrintPreview::GetCanvas() const
|
||||
{
|
||||
return m_pimpl->GetCanvas();
|
||||
}
|
||||
|
||||
bool wxPrintPreview::PaintPage(wxPreviewCanvas *canvas, wxDC& dc)
|
||||
{
|
||||
return m_pimpl->PaintPage( canvas, dc );
|
||||
}
|
||||
|
||||
bool wxPrintPreview::DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc)
|
||||
{
|
||||
return m_pimpl->DrawBlankPage( canvas, dc );
|
||||
}
|
||||
|
||||
void wxPrintPreview::AdjustScrollbars(wxPreviewCanvas *canvas)
|
||||
{
|
||||
m_pimpl->AdjustScrollbars( canvas );
|
||||
}
|
||||
|
||||
bool wxPrintPreview::RenderPage(int pageNum)
|
||||
{
|
||||
return m_pimpl->RenderPage( pageNum );
|
||||
}
|
||||
|
||||
void wxPrintPreview::SetZoom(int percent)
|
||||
{
|
||||
m_pimpl->SetZoom( percent );
|
||||
}
|
||||
|
||||
wxPrintDialogData& wxPrintPreview::GetPrintDialogData()
|
||||
{
|
||||
return m_pimpl->GetPrintDialogData();
|
||||
}
|
||||
|
||||
int wxPrintPreview::GetMaxPage() const
|
||||
{
|
||||
return m_pimpl->GetMaxPage();
|
||||
}
|
||||
|
||||
int wxPrintPreview::GetMinPage() const
|
||||
{
|
||||
return m_pimpl->GetMinPage();
|
||||
}
|
||||
|
||||
bool wxPrintPreview::Ok() const
|
||||
{
|
||||
return m_pimpl->Ok();
|
||||
}
|
||||
|
||||
void wxPrintPreview::SetOk(bool ok)
|
||||
{
|
||||
m_pimpl->SetOk( ok );
|
||||
}
|
||||
|
||||
bool wxPrintPreview::Print(bool interactive)
|
||||
{
|
||||
return m_pimpl->Print( interactive );
|
||||
}
|
||||
|
||||
void wxPrintPreview::DetermineScaling()
|
||||
{
|
||||
m_pimpl->DetermineScaling();
|
||||
}
|
||||
|
||||
|
||||
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||
|
Reference in New Issue
Block a user