1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: prntbase.h
|
|
|
|
// Purpose: Base classes for printing framework
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 05:34:04 -05:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-14 20:23:28 -04:00
|
|
|
#ifndef _WX_PRNTBASEH__
|
|
|
|
#define _WX_PRNTBASEH__
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-03-29 15:49:05 -05:00
|
|
|
#pragma interface "prntbase.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
1999-06-13 18:54:04 -04:00
|
|
|
|
|
|
|
#if wxUSE_PRINTING_ARCHITECTURE
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#include "wx/event.h"
|
|
|
|
#include "wx/cmndata.h"
|
|
|
|
#include "wx/panel.h"
|
|
|
|
#include "wx/scrolwin.h"
|
|
|
|
#include "wx/dialog.h"
|
1998-08-14 20:23:28 -04:00
|
|
|
#include "wx/frame.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxDC;
|
|
|
|
class WXDLLEXPORT wxButton;
|
|
|
|
class WXDLLEXPORT wxChoice;
|
|
|
|
class WXDLLEXPORT wxPrintout;
|
|
|
|
class WXDLLEXPORT wxPrinterBase;
|
|
|
|
class WXDLLEXPORT wxPrintDialog;
|
|
|
|
class WXDLLEXPORT wxPrintPreviewBase;
|
|
|
|
class WXDLLEXPORT wxPreviewCanvas;
|
|
|
|
class WXDLLEXPORT wxPreviewControlBar;
|
|
|
|
class WXDLLEXPORT wxPreviewFrame;
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
|
|
|
|
enum wxPrinterError
|
|
|
|
{
|
|
|
|
wxPRINTER_NO_ERROR = 0,
|
|
|
|
wxPRINTER_CANCELLED,
|
|
|
|
wxPRINTER_ERROR
|
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
/*
|
|
|
|
* Represents the printer: manages printing a wxPrintout object
|
|
|
|
*/
|
1999-03-29 15:49:05 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
class WXDLLEXPORT wxPrinterBase: public wxObject
|
|
|
|
{
|
1998-08-28 07:00:50 -04:00
|
|
|
public:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPrinterBase(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
|
|
|
virtual ~wxPrinterBase();
|
|
|
|
|
|
|
|
virtual wxWindow *CreateAbortWindow(wxWindow *parent, wxPrintout *printout);
|
2001-06-02 22:58:56 -04:00
|
|
|
virtual void ReportError(wxWindow *parent, wxPrintout *printout, const wxString& message);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPrintDialogData& GetPrintDialogData() const
|
|
|
|
{ return (wxPrintDialogData&) m_printDialogData; }
|
|
|
|
bool GetAbort() const { return sm_abortIt; }
|
2000-07-15 15:51:35 -04:00
|
|
|
|
|
|
|
static wxPrinterError GetLastError() { return sm_lastError; }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// OVERRIDES
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual bool Setup(wxWindow *parent) = 0;
|
|
|
|
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE) = 0;
|
|
|
|
virtual wxDC* PrintDialog(wxWindow *parent) = 0;
|
1998-08-28 07:00:50 -04:00
|
|
|
|
|
|
|
protected:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPrintDialogData m_printDialogData;
|
|
|
|
wxPrintout* m_currentPrintout;
|
2000-07-15 15:51:35 -04:00
|
|
|
|
|
|
|
static wxPrinterError sm_lastError;
|
|
|
|
|
1998-08-28 07:00:50 -04:00
|
|
|
public:
|
1999-03-29 15:49:05 -05:00
|
|
|
static wxWindow* sm_abortWindow;
|
|
|
|
static bool sm_abortIt;
|
1998-08-28 07:00:50 -04:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
private:
|
|
|
|
DECLARE_CLASS(wxPrinterBase)
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxPrinterBase)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* object for previewing.
|
|
|
|
*/
|
1999-03-29 15:49:05 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
class WXDLLEXPORT wxPrintout: public wxObject
|
|
|
|
{
|
1998-08-28 07:00:50 -04:00
|
|
|
public:
|
2002-12-04 09:11:26 -05:00
|
|
|
wxPrintout(const wxString& title = wxT("Printout"));
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual ~wxPrintout();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual bool OnBeginDocument(int startPage, int endPage);
|
|
|
|
virtual void OnEndDocument();
|
|
|
|
virtual void OnBeginPrinting();
|
|
|
|
virtual void OnEndPrinting();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
// Guaranteed to be before any other functions are called
|
|
|
|
virtual void OnPreparePrinting() { }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual bool HasPage(int page);
|
|
|
|
virtual bool OnPrintPage(int page) = 0;
|
|
|
|
virtual void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual wxString GetTitle() const { return m_printoutTitle; }
|
1998-08-28 07:00:50 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
wxDC *GetDC() const { return m_printoutDC; }
|
|
|
|
void SetDC(wxDC *dc) { m_printoutDC = dc; }
|
|
|
|
void SetPageSizePixels(int w, int h) { m_pageWidthPixels = w; m_pageHeightPixels = h; }
|
|
|
|
void GetPageSizePixels(int *w, int *h) const { *w = m_pageWidthPixels; *h = m_pageHeightPixels; }
|
|
|
|
void SetPageSizeMM(int w, int h) { m_pageWidthMM = w; m_pageHeightMM = h; }
|
|
|
|
void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; }
|
1998-08-28 07:00:50 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; }
|
|
|
|
void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; }
|
|
|
|
void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; }
|
|
|
|
void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; }
|
1998-08-28 07:00:50 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual bool IsPreview() const { return m_isPreview; }
|
1998-08-28 07:00:50 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual void SetIsPreview(bool p) { m_isPreview = p; }
|
1998-08-28 07:00:50 -04:00
|
|
|
|
|
|
|
private:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxString m_printoutTitle;
|
|
|
|
wxDC* m_printoutDC;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
int m_pageWidthPixels;
|
|
|
|
int m_pageHeightPixels;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
int m_pageWidthMM;
|
|
|
|
int m_pageHeightMM;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
int m_PPIScreenX;
|
|
|
|
int m_PPIScreenY;
|
|
|
|
int m_PPIPrinterX;
|
|
|
|
int m_PPIPrinterY;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
bool m_isPreview;
|
2002-12-04 09:11:26 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_ABSTRACT_CLASS(wxPrintout)
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxPrintout)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* wxPreviewCanvas
|
|
|
|
* Canvas upon which a preview is drawn.
|
|
|
|
*/
|
1999-03-29 15:49:05 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
class WXDLLEXPORT wxPreviewCanvas: public wxScrolledWindow
|
|
|
|
{
|
1998-08-28 07:00:50 -04:00
|
|
|
public:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPreviewCanvas(wxPrintPreviewBase *preview,
|
|
|
|
wxWindow *parent,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2002-12-04 09:11:26 -05:00
|
|
|
const wxString& name = wxT("canvas"));
|
1999-03-29 15:49:05 -05:00
|
|
|
~wxPreviewCanvas();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
void OnPaint(wxPaintEvent& event);
|
2003-07-23 16:30:19 -04:00
|
|
|
void OnChar(wxKeyEvent &event);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
// Responds to colour changes
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-08-28 07:00:50 -04:00
|
|
|
private:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPrintPreviewBase* m_printPreview;
|
1998-08-28 07:00:50 -04:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
DECLARE_CLASS(wxPreviewCanvas)
|
1999-03-29 15:49:05 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxPreviewCanvas)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* wxPreviewFrame
|
|
|
|
* Default frame for showing preview.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxPreviewFrame: public wxFrame
|
|
|
|
{
|
1998-08-28 07:00:50 -04:00
|
|
|
public:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPreviewFrame(wxPrintPreviewBase *preview,
|
2003-05-26 05:55:28 -04:00
|
|
|
wxWindow *parent,
|
2002-12-04 09:11:26 -05:00
|
|
|
const wxString& title = wxT("Print Preview"),
|
1999-03-29 15:49:05 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2004-04-01 06:04:33 -05:00
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
2002-12-04 09:11:26 -05:00
|
|
|
const wxString& name = wxT("frame"));
|
1999-03-29 15:49:05 -05:00
|
|
|
~wxPreviewFrame();
|
|
|
|
|
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
|
|
|
virtual void Initialize();
|
|
|
|
virtual void CreateCanvas();
|
|
|
|
virtual void CreateControlBar();
|
2003-07-23 16:30:19 -04:00
|
|
|
|
|
|
|
inline wxPreviewControlBar* GetControlBar() const { return m_controlBar; }
|
|
|
|
|
1998-08-28 07:00:50 -04:00
|
|
|
protected:
|
2003-07-23 16:30:19 -04:00
|
|
|
wxPreviewCanvas* m_previewCanvas;
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPreviewControlBar* m_controlBar;
|
|
|
|
wxPrintPreviewBase* m_printPreview;
|
2004-07-25 13:09:30 -04:00
|
|
|
wxWindowDisabler* m_windowDisabler;
|
1999-02-05 18:55:04 -05:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
private:
|
2002-12-04 09:11:26 -05:00
|
|
|
DECLARE_CLASS(wxPreviewFrame)
|
1999-03-29 15:49:05 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxPreviewFrame)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* wxPreviewControlBar
|
|
|
|
* A panel with buttons for controlling a print preview.
|
|
|
|
* The programmer may wish to use other means for controlling
|
|
|
|
* the print preview.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define wxPREVIEW_PRINT 1
|
|
|
|
#define wxPREVIEW_PREVIOUS 2
|
|
|
|
#define wxPREVIEW_NEXT 4
|
|
|
|
#define wxPREVIEW_ZOOM 8
|
2002-08-16 12:18:28 -04:00
|
|
|
#define wxPREVIEW_FIRST 16
|
|
|
|
#define wxPREVIEW_LAST 32
|
|
|
|
#define wxPREVIEW_GOTO 64
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2002-08-16 12:18:28 -04:00
|
|
|
#define wxPREVIEW_DEFAULT wxPREVIEW_PREVIOUS|wxPREVIEW_NEXT|wxPREVIEW_ZOOM\
|
|
|
|
|wxPREVIEW_FIRST|wxPREVIEW_GOTO|wxPREVIEW_LAST
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
// Ids for controls
|
|
|
|
#define wxID_PREVIEW_CLOSE 1
|
|
|
|
#define wxID_PREVIEW_NEXT 2
|
|
|
|
#define wxID_PREVIEW_PREVIOUS 3
|
|
|
|
#define wxID_PREVIEW_PRINT 4
|
|
|
|
#define wxID_PREVIEW_ZOOM 5
|
2002-08-16 12:18:28 -04:00
|
|
|
#define wxID_PREVIEW_FIRST 6
|
|
|
|
#define wxID_PREVIEW_LAST 7
|
|
|
|
#define wxID_PREVIEW_GOTO 8
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxPreviewControlBar: public wxPanel
|
|
|
|
{
|
1999-03-29 15:49:05 -05:00
|
|
|
DECLARE_CLASS(wxPreviewControlBar)
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-08-28 07:00:50 -04:00
|
|
|
public:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPreviewControlBar(wxPrintPreviewBase *preview,
|
|
|
|
long buttons,
|
|
|
|
wxWindow *parent,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2003-07-23 16:30:19 -04:00
|
|
|
long style = wxTAB_TRAVERSAL,
|
2002-12-04 09:11:26 -05:00
|
|
|
const wxString& name = wxT("panel"));
|
1999-03-29 15:49:05 -05:00
|
|
|
~wxPreviewControlBar();
|
|
|
|
|
|
|
|
virtual void CreateButtons();
|
|
|
|
virtual void SetZoomControl(int zoom);
|
|
|
|
virtual int GetZoomControl();
|
|
|
|
virtual wxPrintPreviewBase *GetPrintPreview() const
|
|
|
|
{ return m_printPreview; }
|
|
|
|
|
|
|
|
void OnWindowClose(wxCommandEvent& event);
|
1999-06-21 17:00:36 -04:00
|
|
|
void OnNext();
|
|
|
|
void OnPrevious();
|
2002-08-16 12:18:28 -04:00
|
|
|
void OnFirst();
|
|
|
|
void OnLast();
|
|
|
|
void OnGoto();
|
2003-07-24 06:07:43 -04:00
|
|
|
void OnPrint();
|
2003-07-24 16:06:02 -04:00
|
|
|
void OnPrintButton(wxCommandEvent& WXUNUSED(event)) { OnPrint(); }
|
1999-09-18 12:49:30 -04:00
|
|
|
void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); }
|
|
|
|
void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); }
|
2002-08-16 12:18:28 -04:00
|
|
|
void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); }
|
|
|
|
void OnLastButton(wxCommandEvent & WXUNUSED(event)) { OnLast(); }
|
|
|
|
void OnGotoButton(wxCommandEvent & WXUNUSED(event)) { OnGoto(); }
|
1999-03-29 15:49:05 -05:00
|
|
|
void OnZoom(wxCommandEvent& event);
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-08-28 07:00:50 -04:00
|
|
|
protected:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPrintPreviewBase* m_printPreview;
|
|
|
|
wxButton* m_closeButton;
|
|
|
|
wxButton* m_nextPageButton;
|
|
|
|
wxButton* m_previousPageButton;
|
|
|
|
wxButton* m_printButton;
|
|
|
|
wxChoice* m_zoomControl;
|
2002-08-16 12:18:28 -04:00
|
|
|
wxButton* m_firstPageButton;
|
|
|
|
wxButton* m_lastPageButton;
|
|
|
|
wxButton* m_gotoPageButton;
|
1999-03-29 15:49:05 -05:00
|
|
|
long m_buttonFlags;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxPreviewControlBar)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* wxPrintPreview
|
|
|
|
* Programmer creates an object of this class to preview a wxPrintout.
|
|
|
|
*/
|
1999-03-29 15:49:05 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
class WXDLLEXPORT wxPrintPreviewBase: public wxObject
|
|
|
|
{
|
1999-03-29 15:49:05 -05:00
|
|
|
DECLARE_CLASS(wxPrintPreviewBase)
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-08-28 07:00:50 -04:00
|
|
|
public:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPrintPreviewBase(wxPrintout *printout,
|
|
|
|
wxPrintout *printoutForPrinting = (wxPrintout *) NULL,
|
|
|
|
wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
|
|
|
wxPrintPreviewBase(wxPrintout *printout,
|
|
|
|
wxPrintout *printoutForPrinting,
|
|
|
|
wxPrintData *data);
|
|
|
|
virtual ~wxPrintPreviewBase();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual bool SetCurrentPage(int pageNum);
|
|
|
|
int GetCurrentPage() const { return m_currentPage; };
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
void SetPrintout(wxPrintout *printout) { m_previewPrintout = printout; };
|
|
|
|
wxPrintout *GetPrintout() const { return m_previewPrintout; };
|
|
|
|
wxPrintout *GetPrintoutForPrinting() const { return m_printPrintout; };
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
void SetFrame(wxFrame *frame) { m_previewFrame = frame; };
|
2003-07-23 16:30:19 -04:00
|
|
|
void SetCanvas(wxPreviewCanvas *canvas) { m_previewCanvas = canvas; };
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual wxFrame *GetFrame() const { return m_previewFrame; }
|
2003-07-23 16:30:19 -04:00
|
|
|
virtual wxPreviewCanvas *GetCanvas() const { return m_previewCanvas; }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
// The preview canvas should call this from OnPaint
|
2003-07-23 16:30:19 -04:00
|
|
|
virtual bool PaintPage(wxPreviewCanvas *canvas, wxDC& dc);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
// This draws a blank page onto the preview canvas
|
2003-07-23 16:30:19 -04:00
|
|
|
virtual bool DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc);
|
|
|
|
|
|
|
|
// Adjusts the scrollbars for the current scale
|
|
|
|
virtual void AdjustScrollbars(wxPreviewCanvas *canvas);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
// This is called by wxPrintPreview to render a page into a wxMemoryDC.
|
|
|
|
virtual bool RenderPage(int pageNum);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
virtual void SetZoom(int percent);
|
|
|
|
int GetZoom() const { return m_currentZoom; };
|
1998-08-28 07:00:50 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
int GetMaxPage() const { return m_maxPage; }
|
|
|
|
int GetMinPage() const { return m_minPage; }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
bool Ok() const { return m_isOk; }
|
|
|
|
void SetOk(bool ok) { m_isOk = ok; }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// OVERRIDES
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
// If we own a wxPrintout that can be used for printing, this
|
|
|
|
// will invoke the actual printing procedure. Called
|
|
|
|
// by the wxPreviewControlBar.
|
|
|
|
virtual bool Print(bool interactive) = 0;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
// Calculate scaling that needs to be done to get roughly
|
|
|
|
// the right scaling for the screen pretending to be
|
|
|
|
// the currently selected printer.
|
|
|
|
virtual void DetermineScaling() = 0;
|
1998-08-28 07:00:50 -04:00
|
|
|
|
|
|
|
protected:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPrintDialogData m_printDialogData;
|
2003-07-23 16:30:19 -04:00
|
|
|
wxPreviewCanvas* m_previewCanvas;
|
1999-03-29 15:49:05 -05:00
|
|
|
wxFrame* m_previewFrame;
|
|
|
|
wxBitmap* m_previewBitmap;
|
|
|
|
wxPrintout* m_previewPrintout;
|
|
|
|
wxPrintout* m_printPrintout;
|
|
|
|
int m_currentPage;
|
|
|
|
int m_currentZoom;
|
|
|
|
float m_previewScale;
|
|
|
|
int m_topMargin;
|
|
|
|
int m_leftMargin;
|
|
|
|
int m_pageWidth;
|
|
|
|
int m_pageHeight;
|
|
|
|
int m_minPage;
|
|
|
|
int m_maxPage;
|
|
|
|
|
|
|
|
bool m_isOk;
|
1999-09-05 11:14:50 -04:00
|
|
|
bool m_printingPrepared; // Called OnPreparePrinting?
|
1999-03-29 15:49:05 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
|
2003-01-02 18:38:11 -05:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxPrintPreviewBase)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Abort dialog
|
|
|
|
*/
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxPrintAbortDialog: public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
1999-03-29 15:49:05 -05:00
|
|
|
wxPrintAbortDialog(wxWindow *parent,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
2002-12-04 09:11:26 -05:00
|
|
|
const wxString& name = wxT("dialog"))
|
1999-03-29 15:49:05 -05:00
|
|
|
: wxDialog(parent, -1, title, pos, size, style, name)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnCancel(wxCommandEvent& event);
|
1998-08-28 07:00:50 -04:00
|
|
|
|
1999-03-29 15:49:05 -05:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
2003-07-21 20:24:07 -04:00
|
|
|
DECLARE_NO_COPY_CLASS(wxPrintAbortDialog)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
1999-06-13 18:54:04 -04:00
|
|
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
1998-08-14 20:23:28 -04:00
|
|
|
// _WX_PRNTBASEH__
|