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