X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf38cbffd54c50dd11c89f34542704f92db174eb..c6ea1fdaf924be4ee49a19d12f76e4fcd257bb0a:/include/wx/generic/prntdlgg.h diff --git a/include/wx/generic/prntdlgg.h b/include/wx/generic/prntdlgg.h index be7cf5c5e4..726f177b1a 100644 --- a/include/wx/generic/prntdlgg.h +++ b/include/wx/generic/prntdlgg.h @@ -1,153 +1,257 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: prntdlgg.h +// Name: wx/generic/prntdlgg.h // Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog, // wxGenericPageSetupDialog // Author: Julian Smart // Modified by: // Created: 01/02/97 // RCS-ID: $Id$ -// Copyright: (c) -// Licence: wxWindows licence +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __PRINTDLGH_G_ #define __PRINTDLGH_G_ -#ifdef __GNUG__ -#pragma interface "prntdlgg.h" -#endif - #include "wx/defs.h" + +#if wxUSE_PRINTING_ARCHITECTURE + #include "wx/dialog.h" -#include "wx/dc.h" #include "wx/cmndata.h" -#include "wx/dialog.h" +#include "wx/prntbase.h" +#include "wx/printdlg.h" +#include "wx/listctrl.h" +#include "wx/dc.h" #if wxUSE_POSTSCRIPT -#include "wx/dcps.h" + #include "wx/dcps.h" #endif -class WXDLLEXPORT wxTextCtrl; -class WXDLLEXPORT wxButton; -class WXDLLEXPORT wxCheckBox; -class WXDLLEXPORT wxChoice; -class WXDLLEXPORT wxStaticText; -class WXDLLEXPORT wxRadioBox; -class WXDLLEXPORT wxPrintSetupData; - -/* - * Simulated Print and Print Setup dialogs - * for non-Windows platforms (and Windows using PostScript print/preview) - */ - -#define wxPRINTID_STATIC 10 -#define wxPRINTID_RANGE 11 -#define wxPRINTID_FROM 12 -#define wxPRINTID_TO 13 -#define wxPRINTID_COPIES 14 -#define wxPRINTID_PRINTTOFILE 15 -#define wxPRINTID_SETUP 16 - -class WXDLLEXPORT wxGenericPrintDialog: public wxDialog +class WXDLLIMPEXP_FWD_CORE wxTextCtrl; +class WXDLLIMPEXP_FWD_CORE wxButton; +class WXDLLIMPEXP_FWD_CORE wxCheckBox; +class WXDLLIMPEXP_FWD_CORE wxComboBox; +class WXDLLIMPEXP_FWD_CORE wxStaticText; +class WXDLLIMPEXP_FWD_CORE wxRadioBox; +class WXDLLIMPEXP_FWD_CORE wxPageSetupData; + +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// This is not clear why all these enums start with 10 or 30 but do not change it +// without good reason to avoid some subtle backwards compatibility breakage + +enum { - DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog) + wxPRINTID_STATIC = 10, + wxPRINTID_RANGE, + wxPRINTID_FROM, + wxPRINTID_TO, + wxPRINTID_COPIES, + wxPRINTID_PRINTTOFILE, + wxPRINTID_SETUP +}; - public: - wxStaticText *printerMessage; - wxButton *setupButton; - wxButton *helpButton; - wxRadioBox *rangeRadioBox; - wxTextCtrl *fromText; - wxTextCtrl *toText; - wxTextCtrl *noCopiesText; - wxCheckBox *printToFileCheckBox; - wxCheckBox *collateCopiesCheckBox; +enum +{ + wxPRINTID_LEFTMARGIN = 30, + wxPRINTID_RIGHTMARGIN, + wxPRINTID_TOPMARGIN, + wxPRINTID_BOTTOMMARGIN +}; - wxPrintData printData; - wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); - ~wxGenericPrintDialog(void); +enum +{ + wxPRINTID_PRINTCOLOUR = 10, + wxPRINTID_ORIENTATION, + wxPRINTID_COMMAND, + wxPRINTID_OPTIONS, + wxPRINTID_PAPERSIZE, + wxPRINTID_PRINTER +}; - void OnSetup(wxCommandEvent& event); - void OnRange(wxCommandEvent& event); - void OnOK(wxCommandEvent& event); +#if wxUSE_POSTSCRIPT - virtual bool TransferDataFromWindow(void); - virtual bool TransferDataToWindow(void); +//---------------------------------------------------------------------------- +// wxPostScriptNativeData +//---------------------------------------------------------------------------- - virtual int ShowModal(void); +class WXDLLIMPEXP_CORE wxPostScriptPrintNativeData: public wxPrintNativeDataBase +{ +public: + wxPostScriptPrintNativeData(); + virtual ~wxPostScriptPrintNativeData(); + + virtual bool TransferTo( wxPrintData &data ); + virtual bool TransferFrom( const wxPrintData &data ); + + virtual bool Ok() const { return IsOk(); } + virtual bool IsOk() const { return true; } + + const wxString& GetPrinterCommand() const { return m_printerCommand; } + const wxString& GetPrinterOptions() const { return m_printerOptions; } + const wxString& GetPreviewCommand() const { return m_previewCommand; } + const wxString& GetFontMetricPath() const { return m_afmPath; } + double GetPrinterScaleX() const { return m_printerScaleX; } + double GetPrinterScaleY() const { return m_printerScaleY; } + long GetPrinterTranslateX() const { return m_printerTranslateX; } + long GetPrinterTranslateY() const { return m_printerTranslateY; } + + void SetPrinterCommand(const wxString& command) { m_printerCommand = command; } + void SetPrinterOptions(const wxString& options) { m_printerOptions = options; } + void SetPreviewCommand(const wxString& command) { m_previewCommand = command; } + void SetFontMetricPath(const wxString& path) { m_afmPath = path; } + void SetPrinterScaleX(double x) { m_printerScaleX = x; } + void SetPrinterScaleY(double y) { m_printerScaleY = y; } + void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; } + void SetPrinterTranslateX(long x) { m_printerTranslateX = x; } + void SetPrinterTranslateY(long y) { m_printerTranslateY = y; } + void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; } + +#if wxUSE_STREAMS + wxOutputStream *GetOutputStream() { return m_outputStream; } + void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; } +#endif - inline wxPrintData& GetPrintData(void) { return printData; } - wxDC *GetPrintDC(void); +private: + wxString m_printerCommand; + wxString m_previewCommand; + wxString m_printerOptions; + wxString m_afmPath; + double m_printerScaleX; + double m_printerScaleY; + long m_printerTranslateX; + long m_printerTranslateY; +#if wxUSE_STREAMS + wxOutputStream *m_outputStream; +#endif -DECLARE_EVENT_TABLE() +private: + DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData) }; -#define wxPRINTID_PRINTCOLOUR 10 -#define wxPRINTID_ORIENTATION 11 -#define wxPRINTID_COMMAND 12 -#define wxPRINTID_OPTIONS 13 -#define wxPRINTID_PAPERSIZE 14 +// ---------------------------------------------------------------------------- +// Simulated Print and Print Setup dialogs for non-Windows platforms (and +// Windows using PostScript print/preview) +// ---------------------------------------------------------------------------- -class WXDLLEXPORT wxGenericPrintSetupDialog: public wxDialog +class WXDLLIMPEXP_CORE wxGenericPrintDialog : public wxPrintDialogBase { - DECLARE_CLASS(wxGenericPrintSetupDialog) +public: + wxGenericPrintDialog(wxWindow *parent, + wxPrintDialogData* data = NULL); + wxGenericPrintDialog(wxWindow *parent, wxPrintData* data); - public: - wxRadioBox *orientationRadioBox; - wxTextCtrl *printerCommandText; - wxTextCtrl *printerOptionsText; - wxCheckBox *colourCheckBox; - wxChoice *paperTypeChoice; + virtual ~wxGenericPrintDialog(); -#if wxUSE_POSTSCRIPT - wxPrintSetupData printData; - inline wxPrintSetupData& GetPrintData(void) { return printData; } -#endif + void OnSetup(wxCommandEvent& event); + void OnRange(wxCommandEvent& event); + void OnOK(wxCommandEvent& event); - wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSetupData* data); - ~wxGenericPrintSetupDialog(void); + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); - virtual bool TransferDataFromWindow(void); - virtual bool TransferDataToWindow(void); + virtual int ShowModal(); - wxChoice *CreatePaperTypeChoice(int* x, int* y); -}; + wxPrintData& GetPrintData() + { return m_printDialogData.GetPrintData(); } + + wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; } + wxDC *GetPrintDC(); + +public: +// wxStaticText* m_printerMessage; + wxButton* m_setupButton; +// wxButton* m_helpButton; + wxRadioBox* m_rangeRadioBox; + wxTextCtrl* m_fromText; + wxTextCtrl* m_toText; + wxTextCtrl* m_noCopiesText; + wxCheckBox* m_printToFileCheckBox; +// wxCheckBox* m_collateCopiesCheckBox; + + wxPrintDialogData m_printDialogData; -#define wxPRINTID_LEFTMARGIN 30 -#define wxPRINTID_RIGHTMARGIN 31 -#define wxPRINTID_TOPMARGIN 32 -#define wxPRINTID_BOTTOMMARGIN 33 +protected: + void Init(wxWindow *parent); -class WXDLLEXPORT wxGenericPageSetupDialog: public wxDialog +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog) +}; + +class WXDLLIMPEXP_CORE wxGenericPrintSetupDialog : public wxDialog { - DECLARE_CLASS(wxGenericPageSetupDialog) +public: + // There are no configuration options for the dialog, so we + // just pass the wxPrintData object (no wxPrintSetupDialogData class needed) + wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data); + virtual ~wxGenericPrintSetupDialog(); + + void Init(wxPrintData* data); + + void OnPrinter(wxListEvent& event); + + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); - public: - wxButton *printerButton; - wxRadioBox *orientationRadioBox; - wxTextCtrl *marginLeftText; - wxTextCtrl *marginTopText; - wxTextCtrl *marginRightText; - wxTextCtrl *marginBottomText; - wxChoice *paperTypeChoice; + virtual wxComboBox *CreatePaperTypeChoice(); - static bool pageSetupDialogCancelled; - - wxPageSetupData pageData; +public: + wxListCtrl* m_printerListCtrl; + wxRadioBox* m_orientationRadioBox; + wxTextCtrl* m_printerCommandText; + wxTextCtrl* m_printerOptionsText; + wxCheckBox* m_colourCheckBox; + wxComboBox* m_paperTypeChoice; - wxGenericPageSetupDialog(wxWindow *parent, wxPageSetupData* data = (wxPageSetupData*) NULL); - ~wxGenericPageSetupDialog(void); + wxPrintData m_printData; + wxPrintData& GetPrintData() { return m_printData; } - virtual bool TransferDataFromWindow(void); - virtual bool TransferDataToWindow(void); + // After pressing OK, write data here. + wxPrintData* m_targetData; - void OnPrinter(wxCommandEvent& event); +private: + DECLARE_EVENT_TABLE() + DECLARE_CLASS(wxGenericPrintSetupDialog) +}; +#endif + // wxUSE_POSTSCRIPT + +class WXDLLIMPEXP_CORE wxGenericPageSetupDialog : public wxPageSetupDialogBase +{ +public: + wxGenericPageSetupDialog(wxWindow *parent = NULL, + wxPageSetupDialogData* data = NULL); + virtual ~wxGenericPageSetupDialog(); + + virtual bool TransferDataFromWindow(); + virtual bool TransferDataToWindow(); - wxChoice *CreatePaperTypeChoice(int* x, int* y); - inline wxPageSetupData& GetPageSetupData(void) { return pageData; } + virtual wxPageSetupDialogData& GetPageSetupDialogData(); -DECLARE_EVENT_TABLE() + void OnPrinter(wxCommandEvent& event); + wxComboBox *CreatePaperTypeChoice(int* x, int* y); + +public: + wxButton* m_printerButton; + wxRadioBox* m_orientationRadioBox; + wxTextCtrl* m_marginLeftText; + wxTextCtrl* m_marginTopText; + wxTextCtrl* m_marginRightText; + wxTextCtrl* m_marginBottomText; + wxComboBox* m_paperTypeChoice; + + wxPageSetupDialogData m_pageData; + +private: + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog) }; #endif - // __PRINTDLGH_G__ + +#endif +// __PRINTDLGH_G_