cmndata.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: cmndata.h
  3. // Purpose: interface of print wx*Data classes
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxPageSetupDialogData
  9. This class holds a variety of information related to wxPageSetupDialog.
  10. It contains a wxPrintData member which is used to hold basic printer
  11. configuration data (as opposed to the user-interface configuration settings
  12. stored by wxPageSetupDialogData).
  13. @library{wxcore}
  14. @category{printing,data}
  15. @see @ref overview_printing, wxPageSetupDialog
  16. */
  17. class wxPageSetupDialogData : public wxObject
  18. {
  19. public:
  20. /**
  21. Default constructor.
  22. */
  23. wxPageSetupDialogData();
  24. /**
  25. Copy constructor.
  26. */
  27. wxPageSetupDialogData(const wxPageSetupDialogData& data);
  28. /**
  29. Construct an object from a print data object.
  30. */
  31. wxPageSetupDialogData(const wxPrintData& printData);
  32. /**
  33. Destructor.
  34. */
  35. virtual ~wxPageSetupDialogData();
  36. /**
  37. Enables or disables the "Help" button (Windows only).
  38. */
  39. void EnableHelp(bool flag);
  40. /**
  41. Enables or disables the margin controls (Windows only).
  42. */
  43. void EnableMargins(bool flag);
  44. /**
  45. Enables or disables the orientation control (Windows only).
  46. */
  47. void EnableOrientation(bool flag);
  48. /**
  49. Enables or disables the paper size control (Windows only).
  50. */
  51. void EnablePaper(bool flag);
  52. /**
  53. Enables or disables the "Printer" button, which invokes a printer setup
  54. dialog.
  55. */
  56. void EnablePrinter(bool flag);
  57. /**
  58. Returns @true if the dialog will simply return default printer
  59. information (such as orientation) instead of showing a dialog (Windows
  60. only).
  61. */
  62. bool GetDefaultInfo() const;
  63. /**
  64. Returns @true if the page setup dialog will take its minimum margin
  65. values from the currently selected printer properties (Windows only).
  66. */
  67. bool GetDefaultMinMargins() const;
  68. /**
  69. Returns @true if the printer setup button is enabled.
  70. */
  71. bool GetEnableHelp() const;
  72. /**
  73. Returns @true if the margin controls are enabled (Windows only).
  74. */
  75. bool GetEnableMargins() const;
  76. /**
  77. Returns @true if the orientation control is enabled (Windows only).
  78. */
  79. bool GetEnableOrientation() const;
  80. /**
  81. Returns @true if the paper size control is enabled (Windows only).
  82. */
  83. bool GetEnablePaper() const;
  84. /**
  85. Returns @true if the printer setup button is enabled.
  86. */
  87. bool GetEnablePrinter() const;
  88. /**
  89. Returns the right (x) and bottom (y) margins in millimetres.
  90. */
  91. wxPoint GetMarginBottomRight() const;
  92. /**
  93. Returns the left (x) and top (y) margins in millimetres.
  94. */
  95. wxPoint GetMarginTopLeft() const;
  96. /**
  97. Returns the right (x) and bottom (y) minimum margins the user can enter
  98. (Windows only). Units are in millimetres.
  99. */
  100. wxPoint GetMinMarginBottomRight() const;
  101. /**
  102. Returns the left (x) and top (y) minimum margins the user can enter
  103. (Windows only). Units are in millimetres.
  104. */
  105. wxPoint GetMinMarginTopLeft() const;
  106. /**
  107. Returns the paper id (stored in the internal wxPrintData object).
  108. @see wxPrintData::SetPaperId()
  109. */
  110. wxPaperSize GetPaperId() const;
  111. /**
  112. Returns the paper size in millimetres.
  113. */
  114. wxSize GetPaperSize() const;
  115. /**
  116. Returns a reference to the print data associated with this object.
  117. */
  118. wxPrintData& GetPrintData();
  119. const wxPrintData& GetPrintData() const;
  120. /**
  121. Returns @true if the print data associated with the dialog data is
  122. valid. This can return @false on Windows if the current printer is not
  123. set, for example. On all other platforms, it returns @true.
  124. */
  125. bool IsOk() const;
  126. /**
  127. Pass @true if the dialog will simply return default printer information
  128. (such as orientation) instead of showing a dialog (Windows only).
  129. */
  130. void SetDefaultInfo(bool flag);
  131. /**
  132. Pass @true if the page setup dialog will take its minimum margin values
  133. from the currently selected printer properties (Windows only). Units
  134. are in millimetres.
  135. */
  136. void SetDefaultMinMargins(bool flag);
  137. /**
  138. Sets the right (x) and bottom (y) margins in millimetres.
  139. */
  140. void SetMarginBottomRight(const wxPoint& pt);
  141. /**
  142. Sets the left (x) and top (y) margins in millimetres.
  143. */
  144. void SetMarginTopLeft(const wxPoint& pt);
  145. /**
  146. Sets the right (x) and bottom (y) minimum margins the user can enter
  147. (Windows only). Units are in millimetres.
  148. */
  149. void SetMinMarginBottomRight(const wxPoint& pt);
  150. /**
  151. Sets the left (x) and top (y) minimum margins the user can enter
  152. (Windows only). Units are in millimetres.
  153. */
  154. void SetMinMarginTopLeft(const wxPoint& pt);
  155. /**
  156. Sets the paper size id. Calling this function overrides the explicit
  157. paper dimensions passed in SetPaperSize().
  158. @see wxPrintData::SetPaperId()
  159. */
  160. void SetPaperId(wxPaperSize id);
  161. /**
  162. Sets the paper size in millimetres. If a corresponding paper id is
  163. found, it will be set in the internal wxPrintData object, otherwise the
  164. paper size overrides the paper id.
  165. */
  166. void SetPaperSize(const wxSize& size);
  167. /**
  168. Sets the print data associated with this object.
  169. */
  170. void SetPrintData(const wxPrintData& printData);
  171. /**
  172. Assigns print data to this object.
  173. */
  174. wxPageSetupDialogData& operator =(const wxPrintData& data);
  175. /**
  176. Assigns page setup data to this object.
  177. */
  178. wxPageSetupDialogData& operator =(const wxPageSetupDialogData& data);
  179. };
  180. /**
  181. Enumeration of various printer bin sources.
  182. @see wxPrintData::SetBin()
  183. */
  184. enum wxPrintBin
  185. {
  186. wxPRINTBIN_DEFAULT,
  187. wxPRINTBIN_ONLYONE,
  188. wxPRINTBIN_LOWER,
  189. wxPRINTBIN_MIDDLE,
  190. wxPRINTBIN_MANUAL,
  191. wxPRINTBIN_ENVELOPE,
  192. wxPRINTBIN_ENVMANUAL,
  193. wxPRINTBIN_AUTO,
  194. wxPRINTBIN_TRACTOR,
  195. wxPRINTBIN_SMALLFMT,
  196. wxPRINTBIN_LARGEFMT,
  197. wxPRINTBIN_LARGECAPACITY,
  198. wxPRINTBIN_CASSETTE,
  199. wxPRINTBIN_FORMSOURCE,
  200. wxPRINTBIN_USER,
  201. };
  202. /**
  203. @class wxPrintData
  204. This class holds a variety of information related to printers and printer
  205. device contexts. This class is used to create a wxPrinterDC and a
  206. wxPostScriptDC. It is also used as a data member of wxPrintDialogData and
  207. wxPageSetupDialogData, as part of the mechanism for transferring data
  208. between the print dialogs and the application.
  209. @library{wxcore}
  210. @category{printing,data}
  211. @see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
  212. wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
  213. wxPrinterDC, wxPostScriptDC
  214. */
  215. class wxPrintData : public wxObject
  216. {
  217. public:
  218. /**
  219. Default constructor.
  220. */
  221. wxPrintData();
  222. /**
  223. Copy constructor.
  224. */
  225. wxPrintData(const wxPrintData& data);
  226. /**
  227. Destructor.
  228. */
  229. virtual ~wxPrintData();
  230. /**
  231. Returns the current bin (papersource). By default, the system is left
  232. to select the bin (@c wxPRINTBIN_DEFAULT is returned).
  233. See SetBin() for the full list of bin values.
  234. */
  235. wxPrintBin GetBin() const;
  236. /**
  237. Returns @true if collation is on.
  238. */
  239. bool GetCollate() const;
  240. /**
  241. Returns @true if colour printing is on.
  242. */
  243. bool GetColour() const;
  244. /**
  245. Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
  246. wxDUPLEX_VERTICAL.
  247. */
  248. wxDuplexMode GetDuplex() const;
  249. /**
  250. Returns the number of copies requested by the user.
  251. */
  252. int GetNoCopies() const;
  253. /**
  254. Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
  255. */
  256. wxPrintOrientation GetOrientation() const;
  257. /**
  258. Returns the paper size id.
  259. @see SetPaperId()
  260. */
  261. wxPaperSize GetPaperId() const;
  262. /**
  263. Returns the printer name. If the printer name is the empty string, it
  264. indicates that the default printer should be used.
  265. */
  266. const wxString& GetPrinterName() const;
  267. /**
  268. Returns the current print quality. This can be a positive integer,
  269. denoting the number of dots per inch, or one of the following
  270. identifiers:
  271. - wxPRINT_QUALITY_HIGH
  272. - wxPRINT_QUALITY_MEDIUM
  273. - wxPRINT_QUALITY_LOW
  274. - wxPRINT_QUALITY_DRAFT
  275. On input you should pass one of these identifiers, but on return you
  276. may get back a positive integer indicating the current resolution
  277. setting.
  278. */
  279. wxPrintQuality GetQuality() const;
  280. /**
  281. Returns @true if the print data is valid for using in print dialogs.
  282. This can return @false on Windows if the current printer is not set,
  283. for example. On all other platforms, it returns @true.
  284. */
  285. bool IsOk() const;
  286. /**
  287. Sets the current bin.
  288. */
  289. void SetBin(wxPrintBin flag);
  290. /**
  291. Sets collation to on or off.
  292. */
  293. void SetCollate(bool flag);
  294. /**
  295. Sets colour printing on or off.
  296. */
  297. void SetColour(bool flag);
  298. /**
  299. Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
  300. wxDUPLEX_VERTICAL.
  301. */
  302. void SetDuplex(wxDuplexMode mode);
  303. /**
  304. Sets the default number of copies to be printed out.
  305. */
  306. void SetNoCopies(int n);
  307. /**
  308. Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
  309. */
  310. void SetOrientation(wxPrintOrientation orientation);
  311. /**
  312. Sets the paper id. This indicates the type of paper to be used. For a
  313. mapping between paper id, paper size and string name, see
  314. wxPrintPaperDatabase in @c "paper.h" (not yet documented).
  315. */
  316. void SetPaperId(wxPaperSize paperId);
  317. /**
  318. Sets the printer name. This can be the empty string to indicate that
  319. the default printer should be used.
  320. */
  321. void SetPrinterName(const wxString& printerName);
  322. /**
  323. Sets the desired print quality. This can be a positive integer,
  324. denoting the number of dots per inch, or one of the following
  325. identifiers:
  326. - wxPRINT_QUALITY_HIGH
  327. - wxPRINT_QUALITY_MEDIUM
  328. - wxPRINT_QUALITY_LOW
  329. - wxPRINT_QUALITY_DRAFT
  330. On input you should pass one of these identifiers, but on return you
  331. may get back a positive integer indicating the current resolution
  332. setting.
  333. */
  334. void SetQuality(wxPrintQuality quality);
  335. /**
  336. Assigns print data to this object.
  337. */
  338. wxPrintData& operator =(const wxPrintData& data);
  339. wxString GetFilename() const;
  340. void SetFilename( const wxString &filename );
  341. wxPrintMode GetPrintMode() const ;
  342. void SetPrintMode(wxPrintMode printMode) ;
  343. };
  344. /**
  345. @class wxPrintDialogData
  346. This class holds information related to the visual characteristics of
  347. wxPrintDialog. It contains a wxPrintData object with underlying printing
  348. settings.
  349. @library{wxcore}
  350. @category{printing,cmndlg,data}
  351. @see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
  352. */
  353. class wxPrintDialogData : public wxObject
  354. {
  355. public:
  356. /**
  357. Default constructor.
  358. */
  359. wxPrintDialogData();
  360. /**
  361. Copy constructor.
  362. */
  363. wxPrintDialogData(const wxPrintDialogData& dialogData);
  364. /**
  365. Construct an object from a print dialog data object.
  366. */
  367. wxPrintDialogData(const wxPrintData& printData);
  368. /**
  369. Destructor.
  370. */
  371. virtual ~wxPrintDialogData();
  372. /**
  373. Enables or disables the "Help" button.
  374. */
  375. void EnableHelp(bool flag);
  376. /**
  377. Enables or disables the "Page numbers" controls.
  378. */
  379. void EnablePageNumbers(bool flag);
  380. /**
  381. Enables or disables the "Print to file" checkbox.
  382. */
  383. void EnablePrintToFile(bool flag);
  384. /**
  385. Enables or disables the "Selection" radio button.
  386. */
  387. void EnableSelection(bool flag);
  388. /**
  389. Returns @true if the user requested that all pages be printed.
  390. */
  391. bool GetAllPages() const;
  392. /**
  393. Returns @true if the user requested that the document(s) be collated.
  394. */
  395. bool GetCollate() const;
  396. /**
  397. Returns the @e from page number, as entered by the user.
  398. */
  399. int GetFromPage() const;
  400. /**
  401. Returns the @e maximum page number.
  402. */
  403. int GetMaxPage() const;
  404. /**
  405. Returns the @e minimum page number.
  406. */
  407. int GetMinPage() const;
  408. /**
  409. Returns the number of copies requested by the user.
  410. */
  411. int GetNoCopies() const;
  412. /**
  413. Returns a reference to the internal wxPrintData object.
  414. */
  415. wxPrintData& GetPrintData();
  416. /**
  417. Returns @true if the user has selected printing to a file.
  418. */
  419. bool GetPrintToFile() const;
  420. /**
  421. Returns @true if the user requested that the selection be printed
  422. (where "selection" is a concept specific to the application).
  423. */
  424. bool GetSelection() const;
  425. /**
  426. Returns the @e "print to" page number, as entered by the user.
  427. */
  428. int GetToPage() const;
  429. /**
  430. Returns @true if the print data is valid for using in print dialogs.
  431. This can return @false on Windows if the current printer is not set,
  432. for example. On all other platforms, it returns @true.
  433. */
  434. bool IsOk() const;
  435. /**
  436. Sets the "Collate" checkbox to @true or @false.
  437. */
  438. void SetCollate(bool flag);
  439. /**
  440. Sets the @e from page number.
  441. */
  442. void SetFromPage(int page);
  443. /**
  444. Sets the @e maximum page number.
  445. */
  446. void SetMaxPage(int page);
  447. /**
  448. Sets the @e minimum page number.
  449. */
  450. void SetMinPage(int page);
  451. /**
  452. Sets the default number of copies the user has requested to be printed
  453. out.
  454. */
  455. void SetNoCopies(int n);
  456. /**
  457. Sets the internal wxPrintData.
  458. */
  459. void SetPrintData(const wxPrintData& printData);
  460. /**
  461. Sets the "Print to file" checkbox to @true or @false.
  462. */
  463. void SetPrintToFile(bool flag);
  464. /**
  465. Selects the "Selection" radio button. The effect of printing the
  466. selection depends on how the application implements this command, if at
  467. all.
  468. */
  469. void SetSelection(bool flag);
  470. /**
  471. @deprecated This function has been deprecated since version 2.5.4.
  472. Determines whether the dialog to be shown will be the Print dialog
  473. (pass @false) or Print Setup dialog (pass @true).
  474. */
  475. void SetSetupDialog(bool flag);
  476. /**
  477. Sets the @e "print to" page number.
  478. */
  479. void SetToPage(int page);
  480. /**
  481. Assigns print data to this object.
  482. */
  483. void operator =(const wxPrintData& data);
  484. /**
  485. Assigns another print dialog data object to this object.
  486. */
  487. void operator =(const wxPrintDialogData& data);
  488. };