prntdlgg.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/generic/prntdlgg.h
  3. // Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog,
  4. // wxGenericPageSetupDialog
  5. // Author: Julian Smart
  6. // Modified by:
  7. // Created: 01/02/97
  8. // Copyright: (c) Julian Smart
  9. // Licence: wxWindows licence
  10. /////////////////////////////////////////////////////////////////////////////
  11. #ifndef __PRINTDLGH_G_
  12. #define __PRINTDLGH_G_
  13. #include "wx/defs.h"
  14. #if wxUSE_PRINTING_ARCHITECTURE
  15. #include "wx/dialog.h"
  16. #include "wx/cmndata.h"
  17. #include "wx/prntbase.h"
  18. #include "wx/printdlg.h"
  19. #include "wx/listctrl.h"
  20. #include "wx/dc.h"
  21. #if wxUSE_POSTSCRIPT
  22. #include "wx/dcps.h"
  23. #endif
  24. class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
  25. class WXDLLIMPEXP_FWD_CORE wxButton;
  26. class WXDLLIMPEXP_FWD_CORE wxCheckBox;
  27. class WXDLLIMPEXP_FWD_CORE wxComboBox;
  28. class WXDLLIMPEXP_FWD_CORE wxStaticText;
  29. class WXDLLIMPEXP_FWD_CORE wxRadioBox;
  30. class WXDLLIMPEXP_FWD_CORE wxPageSetupDialogData;
  31. // ----------------------------------------------------------------------------
  32. // constants
  33. // ----------------------------------------------------------------------------
  34. // This is not clear why all these enums start with 10 or 30 but do not change it
  35. // without good reason to avoid some subtle backwards compatibility breakage
  36. enum
  37. {
  38. wxPRINTID_STATIC = 10,
  39. wxPRINTID_RANGE,
  40. wxPRINTID_FROM,
  41. wxPRINTID_TO,
  42. wxPRINTID_COPIES,
  43. wxPRINTID_PRINTTOFILE,
  44. wxPRINTID_SETUP
  45. };
  46. enum
  47. {
  48. wxPRINTID_LEFTMARGIN = 30,
  49. wxPRINTID_RIGHTMARGIN,
  50. wxPRINTID_TOPMARGIN,
  51. wxPRINTID_BOTTOMMARGIN
  52. };
  53. enum
  54. {
  55. wxPRINTID_PRINTCOLOUR = 10,
  56. wxPRINTID_ORIENTATION,
  57. wxPRINTID_COMMAND,
  58. wxPRINTID_OPTIONS,
  59. wxPRINTID_PAPERSIZE,
  60. wxPRINTID_PRINTER
  61. };
  62. #if wxUSE_POSTSCRIPT
  63. //----------------------------------------------------------------------------
  64. // wxPostScriptNativeData
  65. //----------------------------------------------------------------------------
  66. class WXDLLIMPEXP_CORE wxPostScriptPrintNativeData: public wxPrintNativeDataBase
  67. {
  68. public:
  69. wxPostScriptPrintNativeData();
  70. virtual ~wxPostScriptPrintNativeData();
  71. virtual bool TransferTo( wxPrintData &data );
  72. virtual bool TransferFrom( const wxPrintData &data );
  73. virtual bool Ok() const { return IsOk(); }
  74. virtual bool IsOk() const { return true; }
  75. const wxString& GetPrinterCommand() const { return m_printerCommand; }
  76. const wxString& GetPrinterOptions() const { return m_printerOptions; }
  77. const wxString& GetPreviewCommand() const { return m_previewCommand; }
  78. const wxString& GetFontMetricPath() const { return m_afmPath; }
  79. double GetPrinterScaleX() const { return m_printerScaleX; }
  80. double GetPrinterScaleY() const { return m_printerScaleY; }
  81. long GetPrinterTranslateX() const { return m_printerTranslateX; }
  82. long GetPrinterTranslateY() const { return m_printerTranslateY; }
  83. void SetPrinterCommand(const wxString& command) { m_printerCommand = command; }
  84. void SetPrinterOptions(const wxString& options) { m_printerOptions = options; }
  85. void SetPreviewCommand(const wxString& command) { m_previewCommand = command; }
  86. void SetFontMetricPath(const wxString& path) { m_afmPath = path; }
  87. void SetPrinterScaleX(double x) { m_printerScaleX = x; }
  88. void SetPrinterScaleY(double y) { m_printerScaleY = y; }
  89. void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }
  90. void SetPrinterTranslateX(long x) { m_printerTranslateX = x; }
  91. void SetPrinterTranslateY(long y) { m_printerTranslateY = y; }
  92. void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }
  93. #if wxUSE_STREAMS
  94. wxOutputStream *GetOutputStream() { return m_outputStream; }
  95. void SetOutputStream( wxOutputStream *output ) { m_outputStream = output; }
  96. #endif
  97. private:
  98. wxString m_printerCommand;
  99. wxString m_previewCommand;
  100. wxString m_printerOptions;
  101. wxString m_afmPath;
  102. double m_printerScaleX;
  103. double m_printerScaleY;
  104. long m_printerTranslateX;
  105. long m_printerTranslateY;
  106. #if wxUSE_STREAMS
  107. wxOutputStream *m_outputStream;
  108. #endif
  109. private:
  110. DECLARE_DYNAMIC_CLASS(wxPostScriptPrintNativeData)
  111. };
  112. // ----------------------------------------------------------------------------
  113. // Simulated Print and Print Setup dialogs for non-Windows platforms (and
  114. // Windows using PostScript print/preview)
  115. // ----------------------------------------------------------------------------
  116. class WXDLLIMPEXP_CORE wxGenericPrintDialog : public wxPrintDialogBase
  117. {
  118. public:
  119. wxGenericPrintDialog(wxWindow *parent,
  120. wxPrintDialogData* data = NULL);
  121. wxGenericPrintDialog(wxWindow *parent, wxPrintData* data);
  122. virtual ~wxGenericPrintDialog();
  123. void OnSetup(wxCommandEvent& event);
  124. void OnRange(wxCommandEvent& event);
  125. void OnOK(wxCommandEvent& event);
  126. virtual bool TransferDataFromWindow();
  127. virtual bool TransferDataToWindow();
  128. virtual int ShowModal();
  129. wxPrintData& GetPrintData()
  130. { return m_printDialogData.GetPrintData(); }
  131. wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
  132. wxDC *GetPrintDC();
  133. public:
  134. // wxStaticText* m_printerMessage;
  135. wxButton* m_setupButton;
  136. // wxButton* m_helpButton;
  137. wxRadioBox* m_rangeRadioBox;
  138. wxTextCtrl* m_fromText;
  139. wxTextCtrl* m_toText;
  140. wxTextCtrl* m_noCopiesText;
  141. wxCheckBox* m_printToFileCheckBox;
  142. // wxCheckBox* m_collateCopiesCheckBox;
  143. wxPrintDialogData m_printDialogData;
  144. protected:
  145. void Init(wxWindow *parent);
  146. private:
  147. DECLARE_EVENT_TABLE()
  148. DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
  149. };
  150. class WXDLLIMPEXP_CORE wxGenericPrintSetupDialog : public wxDialog
  151. {
  152. public:
  153. // There are no configuration options for the dialog, so we
  154. // just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
  155. wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data);
  156. virtual ~wxGenericPrintSetupDialog();
  157. void Init(wxPrintData* data);
  158. void OnPrinter(wxListEvent& event);
  159. virtual bool TransferDataFromWindow();
  160. virtual bool TransferDataToWindow();
  161. virtual wxComboBox *CreatePaperTypeChoice();
  162. public:
  163. wxListCtrl* m_printerListCtrl;
  164. wxRadioBox* m_orientationRadioBox;
  165. wxTextCtrl* m_printerCommandText;
  166. wxTextCtrl* m_printerOptionsText;
  167. wxCheckBox* m_colourCheckBox;
  168. wxComboBox* m_paperTypeChoice;
  169. wxPrintData m_printData;
  170. wxPrintData& GetPrintData() { return m_printData; }
  171. // After pressing OK, write data here.
  172. wxPrintData* m_targetData;
  173. private:
  174. DECLARE_EVENT_TABLE()
  175. DECLARE_CLASS(wxGenericPrintSetupDialog)
  176. };
  177. #endif
  178. // wxUSE_POSTSCRIPT
  179. class WXDLLIMPEXP_CORE wxGenericPageSetupDialog : public wxPageSetupDialogBase
  180. {
  181. public:
  182. wxGenericPageSetupDialog(wxWindow *parent = NULL,
  183. wxPageSetupDialogData* data = NULL);
  184. virtual ~wxGenericPageSetupDialog();
  185. virtual bool TransferDataFromWindow();
  186. virtual bool TransferDataToWindow();
  187. virtual wxPageSetupDialogData& GetPageSetupDialogData();
  188. void OnPrinter(wxCommandEvent& event);
  189. wxComboBox *CreatePaperTypeChoice(int* x, int* y);
  190. public:
  191. wxButton* m_printerButton;
  192. wxRadioBox* m_orientationRadioBox;
  193. wxTextCtrl* m_marginLeftText;
  194. wxTextCtrl* m_marginTopText;
  195. wxTextCtrl* m_marginRightText;
  196. wxTextCtrl* m_marginBottomText;
  197. wxComboBox* m_paperTypeChoice;
  198. wxPageSetupDialogData m_pageData;
  199. private:
  200. DECLARE_EVENT_TABLE()
  201. DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericPageSetupDialog)
  202. };
  203. #endif
  204. #endif
  205. // __PRINTDLGH_G_