1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412
|
\section{\class{wxPrintData}}\label{wxprintdata}
This class holds a variety of information related to printers and
printer device contexts. This class is used to create a wxPrinterDC
and a wxPostScriptDC. It is also used as a data member of wxPrintDialogData
and wxPageSetupDialogData, as part of the mechanism for transferring data
between the print dialogs and the application.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/cmndata.h>
\wxheading{See also}
\helpref{Printing framework overview}{printingoverview},
\helpref{wxPrintDialog}{wxprintdialog},
\helpref{wxPageSetupDialog}{wxpagesetupdialog},
\helpref{wxPrintDialogData}{wxprintdialogdata},
\helpref{wxPageSetupDialogData}{wxpagesetupdialogdata},
\helpref{wxPrintDialog Overview}{wxprintdialogoverview},
\helpref{wxPrinterDC}{wxprinterdc},
\helpref{wxPostScriptDC}{wxpostscriptdc}
\wxheading{Remarks}
The following functions are specific to PostScript printing
and have not yet been documented:
\begin{verbatim}
const wxString& GetPrinterCommand() const ;
const wxString& GetPrinterOptions() const ;
const wxString& GetPreviewCommand() const ;
const wxString& GetFilename() const ;
const wxString& GetFontMetricPath() const ;
double GetPrinterScaleX() const ;
double GetPrinterScaleY() const ;
long GetPrinterTranslateX() const ;
long GetPrinterTranslateY() const ;
// wxPRINT_MODE_PREVIEW, wxPRINT_MODE_FILE, wxPRINT_MODE_PRINTER
wxPrintMode GetPrintMode() const ;
void SetPrinterCommand(const wxString& command) ;
void SetPrinterOptions(const wxString& options) ;
void SetPreviewCommand(const wxString& command) ;
void SetFilename(const wxString& filename) ;
void SetFontMetricPath(const wxString& path) ;
void SetPrinterScaleX(double x) ;
void SetPrinterScaleY(double y) ;
void SetPrinterScaling(double x, double y) ;
void SetPrinterTranslateX(long x) ;
void SetPrinterTranslateY(long y) ;
void SetPrinterTranslation(long x, long y) ;
void SetPrintMode(wxPrintMode printMode) ;
\end{verbatim}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxPrintData::wxPrintData}\label{wxprintdatactor}
\func{}{wxPrintData}{\void}
Default constructor.
\func{}{wxPrintData}{\param{const wxPrintData\&}{ data}}
Copy constructor.
\membersection{wxPrintData::\destruct{wxPrintData}}\label{wxprintdatadtor}
\func{}{\destruct{wxPrintData}}{\void}
Destructor.
\membersection{wxPrintData::GetCollate}\label{wxprintdatagetcollate}
\constfunc{bool}{GetCollate}{\void}
Returns true if collation is on.
\membersection{wxPrintData::GetBin}\label{wxprintdatagetbin}
\constfunc{wxPrintBin}{GetBin}{\void}
Returns the current bin (papersource). By default, the system is left to select
the bin (\texttt{wxPRINTBIN\_DEFAULT} is returned).
See \helpref{SetBin()}{wxprintdatasetbin} for the full list of bin values.
\membersection{wxPrintData::GetColour}\label{wxprintdatagetcolour}
\constfunc{bool}{GetColour}{\void}
Returns true if colour printing is on.
\membersection{wxPrintData::GetDuplex}\label{wxprintdatagetduplex}
\constfunc{wxDuplexMode}{GetDuplex}{\void}
Returns the duplex mode. One of wxDUPLEX\_SIMPLEX, wxDUPLEX\_HORIZONTAL, wxDUPLEX\_VERTICAL.
\membersection{wxPrintData::GetNoCopies}\label{wxprintdatagetnocopies}
\constfunc{int}{GetNoCopies}{\void}
Returns the number of copies requested by the user.
\membersection{wxPrintData::GetOrientation}\label{wxprintdatagetorientation}
\constfunc{int}{GetOrientation}{\void}
Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
\membersection{wxPrintData::GetPaperId}\label{wxprintdatagetpaperid}
\constfunc{wxPaperSize}{GetPaperId}{\void}
Returns the paper size id. For more information, see \helpref{wxPrintData::SetPaperId}{wxprintdatasetpaperid}.
\membersection{wxPrintData::GetPrinterName}\label{wxprintdatagetprintername}
\constfunc{const wxString\&}{GetPrinterName}{\void}
Returns the printer name. If the printer name is the empty string, it indicates that the default
printer should be used.
\membersection{wxPrintData::GetQuality}\label{wxprintdatagetquality}
\constfunc{wxPrintQuality}{GetQuality}{\void}
Returns the current print quality. This can be a positive integer, denoting the number of dots per inch, or
one of the following identifiers:
\begin{verbatim}
wxPRINT_QUALITY_HIGH
wxPRINT_QUALITY_MEDIUM
wxPRINT_QUALITY_LOW
wxPRINT_QUALITY_DRAFT
\end{verbatim}
On input you should pass one of these identifiers, but on return you may get back a positive integer
indicating the current resolution setting.
\membersection{wxPrintData::IsOk}\label{wxprintdataisok}
\constfunc{bool}{IsOk}{\void}
Returns true if the print data is valid for using in print dialogs.
This can return false on Windows if the current printer is not set, for example.
On all other platforms, it returns true.
\membersection{wxPrintData::SetBin}\label{wxprintdatasetbin}
\func{void}{SetBin}{\param{wxPrintBin }{flag}}
Sets the current bin. Possible values are:
\small{
\begin{verbatim}
enum wxPrintBin
{
wxPRINTBIN_DEFAULT,
wxPRINTBIN_ONLYONE,
wxPRINTBIN_LOWER,
wxPRINTBIN_MIDDLE,
wxPRINTBIN_MANUAL,
wxPRINTBIN_ENVELOPE,
wxPRINTBIN_ENVMANUAL,
wxPRINTBIN_AUTO,
wxPRINTBIN_TRACTOR,
wxPRINTBIN_SMALLFMT,
wxPRINTBIN_LARGEFMT,
wxPRINTBIN_LARGECAPACITY,
wxPRINTBIN_CASSETTE,
wxPRINTBIN_FORMSOURCE,
wxPRINTBIN_USER,
};
\end{verbatim}
}
\membersection{wxPrintData::SetCollate}\label{wxprintdatasetcollate}
\func{void}{SetCollate}{\param{bool }{flag}}
Sets collation to on or off.
\membersection{wxPrintData::SetColour}\label{wxprintdatasetcolour}
\func{void}{SetColour}{\param{bool }{flag}}
Sets colour printing on or off.
\membersection{wxPrintData::SetDuplex}\label{wxprintdatasetduplex}
\func{void}{SetDuplex}{\param{wxDuplexMode}{ mode}}
Returns the duplex mode. One of wxDUPLEX\_SIMPLEX, wxDUPLEX\_HORIZONTAL, wxDUPLEX\_VERTICAL.
\membersection{wxPrintData::SetNoCopies}\label{wxprintdatasetnocopies}
\func{void}{SetNoCopies}{\param{int }{n}}
Sets the default number of copies to be printed out.
\membersection{wxPrintData::SetOrientation}\label{wxprintdatasetorientation}
\func{void}{SetOrientation}{\param{int }{orientation}}
Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
\membersection{wxPrintData::SetPaperId}\label{wxprintdatasetpaperid}
\func{void}{SetPaperId}{\param{wxPaperSize}{ paperId}}
\index{wxPaperSize}Sets the paper id. This indicates the type of paper to be used. For a mapping between
paper id, paper size and string name, see wxPrintPaperDatabase in {\tt paper.h} (not yet documented).
{\it paperId} can be one of:
{\small
\begin{verbatim}
wxPAPER_NONE, // Use specific dimensions
wxPAPER_LETTER, // Letter, 8 1/2 by 11 inches
wxPAPER_LEGAL, // Legal, 8 1/2 by 14 inches
wxPAPER_A4, // A4 Sheet, 210 by 297 millimeters
wxPAPER_CSHEET, // C Sheet, 17 by 22 inches
wxPAPER_DSHEET, // D Sheet, 22 by 34 inches
wxPAPER_ESHEET, // E Sheet, 34 by 44 inches
wxPAPER_LETTERSMALL, // Letter Small, 8 1/2 by 11 inches
wxPAPER_TABLOID, // Tabloid, 11 by 17 inches
wxPAPER_LEDGER, // Ledger, 17 by 11 inches
wxPAPER_STATEMENT, // Statement, 5 1/2 by 8 1/2 inches
wxPAPER_EXECUTIVE, // Executive, 7 1/4 by 10 1/2 inches
wxPAPER_A3, // A3 sheet, 297 by 420 millimeters
wxPAPER_A4SMALL, // A4 small sheet, 210 by 297 millimeters
wxPAPER_A5, // A5 sheet, 148 by 210 millimeters
wxPAPER_B4, // B4 sheet, 250 by 354 millimeters
wxPAPER_B5, // B5 sheet, 182-by-257-millimeter paper
wxPAPER_FOLIO, // Folio, 8-1/2-by-13-inch paper
wxPAPER_QUARTO, // Quarto, 215-by-275-millimeter paper
wxPAPER_10X14, // 10-by-14-inch sheet
wxPAPER_11X17, // 11-by-17-inch sheet
wxPAPER_NOTE, // Note, 8 1/2 by 11 inches
wxPAPER_ENV_9, // #9 Envelope, 3 7/8 by 8 7/8 inches
wxPAPER_ENV_10, // #10 Envelope, 4 1/8 by 9 1/2 inches
wxPAPER_ENV_11, // #11 Envelope, 4 1/2 by 10 3/8 inches
wxPAPER_ENV_12, // #12 Envelope, 4 3/4 by 11 inches
wxPAPER_ENV_14, // #14 Envelope, 5 by 11 1/2 inches
wxPAPER_ENV_DL, // DL Envelope, 110 by 220 millimeters
wxPAPER_ENV_C5, // C5 Envelope, 162 by 229 millimeters
wxPAPER_ENV_C3, // C3 Envelope, 324 by 458 millimeters
wxPAPER_ENV_C4, // C4 Envelope, 229 by 324 millimeters
wxPAPER_ENV_C6, // C6 Envelope, 114 by 162 millimeters
wxPAPER_ENV_C65, // C65 Envelope, 114 by 229 millimeters
wxPAPER_ENV_B4, // B4 Envelope, 250 by 353 millimeters
wxPAPER_ENV_B5, // B5 Envelope, 176 by 250 millimeters
wxPAPER_ENV_B6, // B6 Envelope, 176 by 125 millimeters
wxPAPER_ENV_ITALY, // Italy Envelope, 110 by 230 millimeters
wxPAPER_ENV_MONARCH, // Monarch Envelope, 3 7/8 by 7 1/2 inches
wxPAPER_ENV_PERSONAL, // 6 3/4 Envelope, 3 5/8 by 6 1/2 inches
wxPAPER_FANFOLD_US, // US Std Fanfold, 14 7/8 by 11 inches
wxPAPER_FANFOLD_STD_GERMAN, // German Std Fanfold, 8 1/2 by 12 inches
wxPAPER_FANFOLD_LGL_GERMAN, // German Legal Fanfold, 8 1/2 by 13 inches
Windows 95 only:
wxPAPER_ISO_B4, // B4 (ISO) 250 x 353 mm
wxPAPER_JAPANESE_POSTCARD, // Japanese Postcard 100 x 148 mm
wxPAPER_9X11, // 9 x 11 in
wxPAPER_10X11, // 10 x 11 in
wxPAPER_15X11, // 15 x 11 in
wxPAPER_ENV_INVITE, // Envelope Invite 220 x 220 mm
wxPAPER_LETTER_EXTRA, // Letter Extra 9 \275 x 12 in
wxPAPER_LEGAL_EXTRA, // Legal Extra 9 \275 x 15 in
wxPAPER_TABLOID_EXTRA, // Tabloid Extra 11.69 x 18 in
wxPAPER_A4_EXTRA, // A4 Extra 9.27 x 12.69 in
wxPAPER_LETTER_TRANSVERSE, // Letter Transverse 8 \275 x 11 in
wxPAPER_A4_TRANSVERSE, // A4 Transverse 210 x 297 mm
wxPAPER_LETTER_EXTRA_TRANSVERSE, // Letter Extra Transverse 9\275 x 12 in
wxPAPER_A_PLUS, // SuperA/SuperA/A4 227 x 356 mm
wxPAPER_B_PLUS, // SuperB/SuperB/A3 305 x 487 mm
wxPAPER_LETTER_PLUS, // Letter Plus 8.5 x 12.69 in
wxPAPER_A4_PLUS, // A4 Plus 210 x 330 mm
wxPAPER_A5_TRANSVERSE, // A5 Transverse 148 x 210 mm
wxPAPER_B5_TRANSVERSE, // B5 (JIS) Transverse 182 x 257 mm
wxPAPER_A3_EXTRA, // A3 Extra 322 x 445 mm
wxPAPER_A5_EXTRA, // A5 Extra 174 x 235 mm
wxPAPER_B5_EXTRA, // B5 (ISO) Extra 201 x 276 mm
wxPAPER_A2, // A2 420 x 594 mm
wxPAPER_A3_TRANSVERSE, // A3 Transverse 297 x 420 mm
wxPAPER_A3_EXTRA_TRANSVERSE // A3 Extra Transverse 322 x 445 mm
\end{verbatim}
}
\membersection{wxPrintData::SetPrinterName}\label{wxprintdatasetprintername}
\func{void}{SetPrinterName}{\param{const wxString\& }{printerName}}
Sets the printer name. This can be the empty string to indicate that the default
printer should be used.
\membersection{wxPrintData::SetQuality}\label{wxprintdatasetquality}
\func{void}{SetQuality}{\param{wxPrintQuality}{ quality}}
Sets the desired print quality. This can be a positive integer, denoting the number of dots per inch, or
one of the following identifiers:
\begin{verbatim}
wxPRINT_QUALITY_HIGH
wxPRINT_QUALITY_MEDIUM
wxPRINT_QUALITY_LOW
wxPRINT_QUALITY_DRAFT
\end{verbatim}
On input you should pass one of these identifiers, but on return you may get back a positive integer
indicating the current resolution setting.
\membersection{wxPrintData::operator $=$}\label{wxprintdataassign}
\func{void}{operator $=$}{\param{const wxPrintData\&}{ data}}
Assigns print data to this object.
\func{void}{operator $=$}{\param{const wxPrintSetupData\&}{ data}}
Assigns print setup data to this object. wxPrintSetupData is deprecated,
but retained for backward compatibility.
\section{\class{wxPrintDialog}}\label{wxprintdialog}
This class represents the print and print setup common dialogs.
You may obtain a \helpref{wxPrinterDC}{wxprinterdc} device context from
a successfully dismissed print dialog.
\wxheading{Derived from}
\helpref{wxDialog}{wxdialog}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/printdlg.h>
\wxheading{See also}
\helpref{Printing framework overview}{printingoverview},
\helpref{wxPrintDialog Overview}{wxprintdialogoverview}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxPrintDialog::wxPrintDialog}\label{wxprintdialogctor}
\func{}{wxPrintDialog}{\param{wxWindow* }{parent}, \param{wxPrintDialogData* }{data = NULL}}
Constructor. Pass a parent window, and optionally a pointer to a block of print
data, which will be copied to the print dialog's print data.
\wxheading{See also}
\helpref{wxPrintDialogData}{wxprintdialogdata}
\membersection{wxPrintDialog::\destruct{wxPrintDialog}}\label{wxprintdialogdtor}
\func{}{\destruct{wxPrintDialog}}{\void}
Destructor. If wxPrintDialog::GetPrintDC has {\it not} been called,
the device context obtained by the dialog (if any) will be deleted.
\membersection{wxPrintDialog::GetPrintDialogData}\label{wxprintdialoggetprintdialogdata}
\func{wxPrintDialogData\&}{GetPrintDialogData}{\void}
Returns the \helpref{print dialog data}{wxprintdialogdata} associated with the print dialog.
\membersection{wxPrintDialog::GetPrintDC}\label{wxprintdialoggetprintdc}
\func{wxDC* }{GetPrintDC}{\void}
Returns the device context created by the print dialog, if any.
When this function has been called, the ownership of the device context
is transferred to the application, so it must then be deleted
explicitly.
\membersection{wxPrintDialog::ShowModal}\label{wxprintdialogshowmodal}
\func{int}{ShowModal}{\void}
Shows the dialog, returning wxID\_OK if the user pressed OK, and wxID\_CANCEL
otherwise. After this function is called, a device context may
be retrievable using \helpref{wxPrintDialog::GetPrintDC}{wxprintdialoggetprintdc}.
\section{\class{wxPrintDialogData}}\label{wxprintdialogdata}
This class holds information related to the visual characteristics of wxPrintDialog.
It contains a wxPrintData object with underlying printing settings.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/cmndata.h>
\wxheading{See also}
\helpref{Printing framework overview}{printingoverview},
\helpref{wxPrintDialog}{wxprintdialog},
\helpref{wxPrintDialog Overview}{wxprintdialogoverview}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxPrintDialogData::wxPrintDialogData}\label{wxprintdialogdatactor}
\func{}{wxPrintDialogData}{\void}
Default constructor.
\func{}{wxPrintDialogData}{\param{wxPrintDialogData\&}{ dialogData}}
Copy constructor.
\func{}{wxPrintDialogData}{\param{wxPrintData\&}{ printData}}
Construct an object from a print dialog data object.
\membersection{wxPrintDialogData::\destruct{wxPrintDialogData}}\label{wxprintdialogdatadtor}
\func{}{\destruct{wxPrintDialogData}}{\void}
Destructor.
\membersection{wxPrintDialogData::EnableHelp}\label{wxprintdialogdataenablehelp}
\func{void}{EnableHelp}{\param{bool }{flag}}
Enables or disables the `Help' button.
\membersection{wxPrintDialogData::EnablePageNumbers}\label{wxprintdialogdataenablepagenumbers}
\func{void}{EnablePageNumbers}{\param{bool }{flag}}
Enables or disables the `Page numbers' controls.
\membersection{wxPrintDialogData::EnablePrintToFile}\label{wxprintdialogdataenableprinttofile}
\func{void}{EnablePrintToFile}{\param{bool }{flag}}
Enables or disables the `Print to file' checkbox.
\membersection{wxPrintDialogData::EnableSelection}\label{wxprintdialogdataenableselection}
\func{void}{EnableSelection}{\param{bool }{flag}}
Enables or disables the `Selection' radio button.
\membersection{wxPrintDialogData::GetAllPages}\label{wxprintdialogdatagetallpages}
\constfunc{bool}{GetAllPages}{\void}
Returns true if the user requested that all pages be printed.
\membersection{wxPrintDialogData::GetCollate}\label{wxprintdialogdatagetcollate}
\constfunc{bool}{GetCollate}{\void}
Returns true if the user requested that the document(s) be collated.
\membersection{wxPrintDialogData::GetFromPage}\label{wxprintdialogdatagetfrompage}
\constfunc{int}{GetFromPage}{\void}
Returns the {\it from} page number, as entered by the user.
\membersection{wxPrintDialogData::GetMaxPage}\label{wxprintdialogdatagetmaxpage}
\constfunc{int}{GetMaxPage}{\void}
Returns the {\it maximum} page number.
\membersection{wxPrintDialogData::GetMinPage}\label{wxprintdialogdatagetminpage}
\constfunc{int}{GetMinPage}{\void}
Returns the {\it minimum} page number.
\membersection{wxPrintDialogData::GetNoCopies}\label{wxprintdialogdatagetnocopies}
\constfunc{int}{GetNoCopies}{\void}
Returns the number of copies requested by the user.
\membersection{wxPrintDialogData::GetPrintData}\label{wxprintdialogdatagetprintdata}
\func{wxPrintData\&}{GetPrintData}{\void}
Returns a reference to the internal wxPrintData object.
\membersection{wxPrintDialogData::GetPrintToFile}\label{wxprintdialogdatagetprinttofile}
\constfunc{bool}{GetPrintToFile}{\void}
Returns true if the user has selected printing to a file.
\membersection{wxPrintDialogData::GetSelection}\label{wxprintdialogdatagetselection}
\constfunc{bool}{GetSelection}{\void}
Returns true if the user requested that the selection be printed (where 'selection' is
a concept specific to the application).
\membersection{wxPrintDialogData::GetToPage}\label{wxprintdialogdatagettopage}
\constfunc{int}{GetToPage}{\void}
Returns the {\it to} page number, as entered by the user.
\membersection{wxPrintDialogData::IsOk}\label{wxprintdialogdataisok}
\constfunc{bool}{IsOk}{\void}
Returns true if the print data is valid for using in print dialogs.
This can return false on Windows if the current printer is not set, for example.
On all other platforms, it returns true.
\membersection{wxPrintDialogData::SetCollate}\label{wxprintdialogdatasetcollate}
\func{void}{SetCollate}{\param{bool }{flag}}
Sets the 'Collate' checkbox to true or false.
\membersection{wxPrintDialogData::SetFromPage}\label{wxprintdialogdatasetfrompage}
\func{void}{SetFromPage}{\param{int }{page}}
Sets the {\it from} page number.
\membersection{wxPrintDialogData::SetMaxPage}\label{wxprintdialogdatasetmaxpage}
\func{void}{SetMaxPage}{\param{int }{page}}
Sets the {\it maximum} page number.
\membersection{wxPrintDialogData::SetMinPage}\label{wxprintdialogdatasetminpage}
\func{void}{SetMinPage}{\param{int }{page}}
Sets the {\it minimum} page number.
\membersection{wxPrintDialogData::SetNoCopies}\label{wxprintdialogdatasetnocopies}
\func{void}{SetNoCopies}{\param{int }{n}}
Sets the default number of copies the user has requested to be printed out.
\membersection{wxPrintDialogData::SetPrintData}\label{wxprintdialogdatasetprintdata}
\func{void}{SetPrintData}{\param{const wxPrintData\& }{printData}}
Sets the internal wxPrintData.
\membersection{wxPrintDialogData::SetPrintToFile}\label{wxprintdialogdatasetprinttofile}
\func{void}{SetPrintToFile}{\param{bool }{flag}}
Sets the 'Print to file' checkbox to true or false.
\membersection{wxPrintDialogData::SetSelection}\label{wxprintdialogdatasetselection}
\func{void}{SetSelection}{\param{bool}{ flag}}
Selects the 'Selection' radio button. The effect of printing the selection depends on how the application
implements this command, if at all.
\membersection{wxPrintDialogData::SetSetupDialog}\label{wxprintdialogdatasetsetupdialog}
\func{void}{SetSetupDialog}{\param{bool }{flag}}
Determines whether the dialog to be shown will be the Print dialog
(pass false) or Print Setup dialog (pass true).
This function has been deprecated since version 2.5.4.
\membersection{wxPrintDialogData::SetToPage}\label{wxprintdialogdatasettopage}
\func{void}{SetToPage}{\param{int }{page}}
Sets the {\it to} page number.
\membersection{wxPrintDialogData::operator $=$}\label{wxprintdialogdataassign}
\func{void}{operator $=$}{\param{const wxPrintData\&}{ data}}
Assigns print data to this object.
\func{void}{operator $=$}{\param{const wxPrintDialogData\&}{ data}}
Assigns another print dialog data object to this object.
\section{\class{wxPrinter}}\label{wxprinter}
This class represents the Windows or PostScript printer, and is the vehicle through
which printing may be launched by an application. Printing can also
be achieved through using of lower functions and classes, but
this and associated classes provide a more convenient and general
method of printing.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/print.h>
\wxheading{See also}
\helpref{Printing framework overview}{printingoverview},
\helpref{wxPrinterDC}{wxprinterdc},
\helpref{wxPrintDialog}{wxprintdialog},
\helpref{wxPrintout}{wxprintout},
\helpref{wxPrintPreview}{wxprintpreview}.
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxPrinter::wxPrinter}\label{wxprinterctor}
\func{}{wxPrinter}{\param{wxPrintDialogData* }{data = NULL}}
Constructor. Pass an optional pointer to a block of print
dialog data, which will be copied to the printer object's local data.
\wxheading{See also}
\helpref{wxPrintDialogData}{wxprintdialogdata},
\helpref{wxPrintData}{wxprintdata}
\membersection{wxPrinter::CreateAbortWindow}\label{wxprintercreateabortwindow}
\func{void}{CreateAbortWindow}{\param{wxWindow* }{parent}, \param{wxPrintout* }{printout}}
Creates the default printing abort window, with a cancel button.
\membersection{wxPrinter::GetAbort}\label{wxprintergetabort}
\func{bool}{GetAbort}{\void}
Returns true if the user has aborted the print job.
\membersection{wxPrinter::GetLastError}\label{wxprintergetlasterror}
\func{static wxPrinterError}{GetLastError}{\void}
Return last error. Valid after calling \helpref{Print}{wxprinterprint},
\helpref{PrintDialog}{wxprinterprintdialog} or
\helpref{wxPrintPreview::Print}{wxprintpreviewprint}. These functions
set last error to {\bf wxPRINTER\_NO\_ERROR} if no error happened.
Returned value is one of the following:
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxPRINTER\_NO\_ERROR}}{No error happened.}
\twocolitem{{\bf wxPRINTER\_CANCELLED}}{The user cancelled printing.}
\twocolitem{{\bf wxPRINTER\_ERROR}}{There was an error during printing.}
\end{twocollist}
\membersection{wxPrinter::GetPrintDialogData}\label{wxprintergetprintdialogdata}
\func{wxPrintDialogData\&}{GetPrintDialogData}{\void}
Returns the \helpref{print data}{wxprintdata} associated with the printer object.
\membersection{wxPrinter::Print}\label{wxprinterprint}
\func{bool}{Print}{\param{wxWindow *}{parent}, \param{wxPrintout *}{printout}, \param{bool }{prompt=true}}
Starts the printing process. Provide a parent window, a user-defined wxPrintout object which controls
the printing of a document, and whether the print dialog should be invoked first.
Print could return false if there was a problem initializing the printer device context
(current printer not set, for example) or the user cancelled printing. Call
\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed
information about the kind of the error.
\membersection{wxPrinter::PrintDialog}\label{wxprinterprintdialog}
\func{wxDC*}{PrintDialog}{\param{wxWindow *}{parent}}
Invokes the print dialog. If successful (the user did not press Cancel
and no error occurred), a suitable device context will be returned
(otherwise NULL is returned -- call
\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed
information about the kind of the error).
The application must delete this device context to avoid a memory leak.
\membersection{wxPrinter::ReportError}\label{wxprinterreporterror}
\func{void}{ReportError}{\param{wxWindow *}{parent}, \param{wxPrintout *}{printout}, \param{const wxString\& }{message}}
Default error-reporting function.
\membersection{wxPrinter::Setup}\label{wxprintersetup}
\func{bool}{Setup}{\param{wxWindow *}{parent}}
Invokes the print setup dialog. Note that the setup dialog is obsolete from
Windows 95, though retained for backward compatibility.
\section{\class{wxPrinterDC}}\label{wxprinterdc}
A printer device context is specific to MSW and Mac, and allows access to any
printer with a Windows or Macintosh driver. See \helpref{wxDC}{wxdc} for further
information on device contexts, and \helpref{wxDC::GetSize}{wxdcgetsize} for
advice on achieving the correct scaling for the page.
\wxheading{Derived from}
\helpref{wxDC}{wxdc}\\
\helpref{wxObject}{wxdc}
\wxheading{Include files}
<wx/dcprint.h>
\wxheading{See also}
\helpref{Printing framework overview}{printingoverview},
\helpref{wxDC}{wxdc}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxPrinterDC::wxPrinterDC}\label{wxprinterdcctor}
\func{}{wxPrinterDC}{\param{const wxPrintData\& }{printData}}
Constructor. Pass a \helpref{wxPrintData}{wxprintdata} object with information
necessary for setting up a suitable printer device context. This
is the recommended way to construct a wxPrinterDC. Make sure you
specify a reference to a \helpref{wxPrintData}{wxprintdata} object,
not a pointer - you may not even get a warning if you pass a pointer
instead.
\func{}{wxPrinterDC}{\param{const wxString\& }{driver}, \param{const wxString\& }{device}, \param{const wxString\& }{output},
\param{const bool }{interactive = true}, \param{int }{orientation = wxPORTRAIT}}
Constructor. With empty strings for the first three arguments, the default printer dialog is
displayed. {\it device} indicates the type of printer and {\it output}
is an optional file for printing to. The {\it driver} parameter is
currently unused. Use the {\it Ok} member to test whether the
constructor was successful in creating a usable device context.
This constructor is deprecated and retained only for backward compatibility.
\membersection{wxPrinterDC::GetPaperRect}\label{wxprinterdcgetpaperrect}
\func{wxRect}{wxPrinterDC::GetPaperRect}{}
Return the rectangle in device coordinates that corresponds to the full paper
area, including the nonprinting regions of the paper. The point (0,0) in device
coordinates is the top left corner of the page rectangle, which is the printable
area on MSW and Mac. The coordinates of the top left corner of the paper
rectangle will therefore have small negative values, while the bottom right
coordinates will be somewhat larger than the values returned by
\helpref{wxDC::GetSize}{wxdcgetsize}.
\section{\class{wxPrintout}}\label{wxprintout}
This class encapsulates the functionality of printing out an application
document. A new class must be derived and members overridden to respond to calls
such as OnPrintPage and HasPage and to render the print image onto an associated
\helpref{wxDC}{wxdc}. Instances of this class are passed to wxPrinter::Print or
to a wxPrintPreview object to initiate printing or previewing.
Your derived wxPrintout is responsible for drawing both the preview image and
the printed page. If your windows' drawing routines accept an arbitrary DC as an
argument, you can re-use those routines within your wxPrintout subclass to draw
the printout image. You may also add additional drawing elements within your
wxPrintout subclass, like headers, footers, and/or page numbers. However, the
image on the printed page will often differ from the image drawn on the screen,
as will the print preview image -- not just in the presence of headers and
footers, but typically in scale. A high-resolution printer presents a much
larger drawing surface (i.e., a higher-resolution DC); a zoomed-out preview
image presents a much smaller drawing surface (lower-resolution DC). By using
the routines FitThisSizeToXXX() and/or MapScreenSizeToXXX() within your
wxPrintout subclass to set the user scale and origin of the associated DC, you
can easily use a single drawing routine to draw on your application's windows,
to create the print preview image, and to create the printed paper image, and
achieve a common appearance to the preview image and the printed page.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/print.h>
\wxheading{See also}
\helpref{Printing framework overview}{printingoverview},
\helpref{wxPrinterDC}{wxprinterdc},
\helpref{wxPrintDialog}{wxprintdialog},
\helpref{wxPageSetupDialog}{wxpagesetupdialog},
\helpref{wxPrinter}{wxprinter},
\helpref{wxPrintPreview}{wxprintpreview}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxPrintout::wxPrintout}\label{wxprintoutctor}
\func{}{wxPrintout}{\param{const wxString\& }{title = "Printout"}}
Constructor. Pass an optional title argument - the current filename would be a good idea. This will appear in the printing list
(at least in MSW)
\membersection{wxPrintout::\destruct{wxPrintout}}\label{wxprintoutdtor}
\func{}{\destruct{wxPrintout}}{\void}
Destructor.
\membersection{wxPrintout::GetDC}\label{wxprintoutgetdc}
\func{wxDC *}{GetDC}{\void}
Returns the device context associated with the printout (given to the printout at start of
printing or previewing). This will be a wxPrinterDC if printing under Windows or Mac,
a wxPostScriptDC if printing on other platforms, and a wxMemoryDC if previewing.
\membersection{wxPrintout::GetPageInfo}\label{wxprintoutgetpageinfo}
\func{void}{GetPageInfo}{\param{int *}{minPage}, \param{int *}{maxPage}, \param{int *}{pageFrom}, \param{int *}{pageTo}}
Called by the framework to obtain information from the application about minimum
and maximum page values that the user can select, and the required page range to
be printed. By default this returns 1, 32000 for the page minimum and maximum
values, and 1, 1 for the required page range.
If {\it minPage} is zero, the page number controls in the print dialog will be disabled.
\pythonnote{When this method is implemented in a derived Python class,
it should be designed to take no parameters (other than the self
reference) and to return a tuple of four integers.
}
\perlnote{When this method is overridden in a derived class,
it must not take any parameters, and returns a 4-element list.
}
\membersection{wxPrintout::GetPageSizeMM}\label{wxprintoutgetpagesizemm}
\func{void}{GetPageSizeMM}{\param{int *}{w}, \param{int *}{h}}
Returns the size of the printer page in millimetres.
\pythonnote{This method returns the output-only parameters as a tuple.}
\perlnote{In wxPerl this method takes no arguments and returns a
2-element list {\tt ( w, h )}}
\membersection{wxPrintout::GetPageSizePixels}\label{wxprintoutgetpagesizepixels}
\func{void}{GetPageSizePixels}{\param{int *}{w}, \param{int *}{h}}
Returns the size of the printer page in pixels, called the \em{page rectangle}.
The page rectangle has a top left corner at (0,0) and a bottom right corner at
(w,h). These values may not be the same as the values returned from
\helpref{wxDC::GetSize}{wxdcgetsize}; if the printout is being used for
previewing, a memory device context is used, which uses a bitmap size reflecting
the current preview zoom. The application must take this discrepancy into
account if previewing is to be supported.
\pythonnote{This method returns the output-only parameters as a tuple.}
\perlnote{In wxPerl this method takes no arguments and returns a
2-element list {\tt ( w, h )}}
\membersection{wxPrintout::GetPaperRectPixels}\label{wxprintoutgetpaperrectpixels}
\func{wxRect}{GetPaperRectPixels}{}
Returns the rectangle that corresponds to the entire paper in pixels, called the
\em{paper rectangle}. This distinction between paper rectangle and page
rectangle reflects the fact that most printers cannot print all the way to the
edge of the paper. The page rectangle is a rectangle whose top left corner is at
(0,0) and whose width and height are given by
\helpref{wxDC::GetPageSizePixels}{wxprintoutgetpagesizepixels}. On MSW and Mac,
the page rectangle gives the printable area of the paper, while the paper
rectangle represents the entire paper, including non-printable borders. Thus,
the rectangle returned by GetPaperRectPixels will have a top left corner whose
coordinates are small negative numbers and the bottom right corner will have
values somewhat larger than the width and height given by
\helpref{wxDC::GetPageSizePixels}{wxprintoutgetpagesizepixels}. On other
platforms and for PostScript printing, the paper is treated as if its entire
area were printable, so this function will return the same rectangle as the page
rectangle.
\membersection{wxPrintout::GetPPIPrinter}\label{wxprintoutgetppiprinter}
\func{void}{GetPPIPrinter}{\param{int *}{w}, \param{int *}{h}}
Returns the number of pixels per logical inch of the printer device context.
Dividing the printer PPI by the screen PPI can give a suitable scaling factor
for drawing text onto the printer. Remember to multiply this by a scaling factor
to take the preview DC size into account. Or you can just use the
FitThisSizeToXXX() and MapScreenSizeToXXX routines below, which do most of the
scaling calculations for you.
\pythonnote{This method returns the output-only parameters as a tuple.}
\perlnote{In wxPerl this method takes no arguments and returns a
2-element list {\tt ( w, h )}}
\membersection{wxPrintout::GetPPIScreen}\label{wxprintoutgetppiscreen}
\func{void}{GetPPIScreen}{\param{int *}{w}, \param{int *}{h}}
Returns the number of pixels per logical inch of the screen device context.
Dividing the printer PPI by the screen PPI can give a suitable scaling factor
for drawing text onto the printer. If you are doing your own scaling, remember
to multiply this by a scaling factor to take the preview DC size into account.
\membersection{wxPrintout::GetTitle}\label{wxprintoutgettitle}
\func{wxString}{GetTitle}{\void}
Returns the title of the printout
\pythonnote{This method returns the output-only parameters as a tuple.}
\perlnote{In wxPerl this method takes no arguments and returns a
2-element list {\tt ( w, h )}}
\membersection{wxPrintout::HasPage}\label{wxprintouthaspage}
\func{bool}{HasPage}{\param{int}{ pageNum}}
Should be overridden to return true if the document has this page, or false
if not. Returning false signifies the end of the document. By default,
HasPage behaves as if the document has only one page.
\membersection{wxPrintout::IsPreview}\label{wxprintoutispreview}
\func{bool}{IsPreview}{\void}
Returns true if the printout is currently being used for previewing.
\membersection{wxPrintout::FitThisSizeToPaper}\label{wxprintoutfitthissizetopaper}
\func{void}{FitThisSizeToPaper}{\param{const wxSize\& }{imageSize}}
Set the user scale and device origin of the wxDC associated with this wxPrintout
so that the given image size fits entirely within the paper and the origin is at
the top left corner of the paper. Note that with most printers, the region
around the edges of the paper are not printable so that the edges of the image
could be cut off. Use this if you're managing your own page margins.
\membersection{wxPrintout::FitThisSizeToPage}\label{wxprintoutfitthissizetopage}
\func{void}{FitThisSizeToPage}{\param{const wxSize\& }{imageSize}}
Set the user scale and device origin of the wxDC associated with this wxPrintout
so that the given image size fits entirely within the page rectangle and the
origin is at the top left corner of the page rectangle. On MSW and Mac, the page
rectangle is the printable area of the page. On other platforms and PostScript
printing, the page rectangle is the entire paper. Use this if you want your
printed image as large as possible, but with the caveat that on some platforms,
portions of the image might be cut off at the edges.
\membersection{wxPrintout::FitThisSizeToPageMargins}\label{wxprintoutfitthissizetopagemargins}
\func{void}{FitThisSizeToPageMargins}{\param{const wxSize\& }{imageSize}, \param{const wxPageSetupDialogData\& }{pageSetupData}}
Set the user scale and device origin of the wxDC associated with this wxPrintout
so that the given image size fits entirely within the page margins set in the
given wxPageSetupDialogData object. This function provides the greatest
consistency across all platforms because it does not depend on having access to
the printable area of the paper. Note that on Mac, the native wxPageSetupDialog
does not let you set the page margins; you'll have to provide your own mechanism,
or you can use the Mac-only class wxMacPageMarginsDialog.
\membersection{wxPrintout::MapScreenSizeToPaper}\label{wxprintoutmapscreensizetopaper}
\func{void}{MapScreenSizeToPaper}{}
Set the user scale and device origin of the wxDC associated with this wxPrintout
so that the printed page matches the screen size as closely as possible
and the logical origin is in the top left corner of the paper rectangle.
That is,
a 100-pixel object on screen should appear at the same size on the printed page. (It
will, of course, be larger or smaller in the preview image, depending on the zoom
factor.) Use this if you want WYSIWYG behavior, e.g., in a text editor.
\membersection{wxPrintout::MapScreenSizeToPage}\label{wxprintoutmapscreensizetopage}
\func{void}{MapScreenSizeToPage}{}
This sets the user scale of the wxDC assocated with this wxPrintout to the same
scale as \helpref{MapScreenSizeToPaper}{wxprintoutmapscreensizetopaper} but sets
the logical origin to the top left corner of the page rectangle.
\membersection{wxPrintout::MapScreenSizeToPageMargins}\label{wxprintoutmapscreensizetopagemargins}
\func{void}{MapScreenSizeToPageMargins}{\param{const wxPageSetupDialogData\& }{pageSetupData}}
This sets the user scale of the wxDC assocated with this wxPrintout to the same
scale as
\helpref{MapScreenSizeToPageMargins}{wxprintoutmapscreensizetopagemargins} but
sets the logical origin to the top left corner of the page margins specified by
the given wxPageSetupDialogData object.
\membersection{wxPrintout::MapScreenSizeToDevice}\label{wxprintoutmapscreensizetodevice}
\func{void}{MapScreenSizeToDevice}{}
Set the user scale and device origin of the wxDC associated with this wxPrintout
so that one screen pixel maps to one device pixel on the DC. That is, the user
scale is set to (1,1) and the device origin is set to (0,0). Use this if you
want to do your own scaling prior to calling wxDC drawing calls, for example, if
your underlying model is floating-point and you want to achieve maximum drawing
precision on high-resolution printers. (Note that while the underlying drawing
model of Mac OS X is floating-point, wxWidgets's drawing model scales from integer
coordinates.) You can use the GetLogicalXXXRect() routines below to obtain the
paper rectangle, page rectangle, or page margins rectangle to perform your own scaling.
\membersection{wxPrintout::GetLogicalPaperRect}\label{wxprintoutgetlogicalpaperrect}
\func{wxRect}{GetLogicalPaperRect}{}
Return the rectangle corresponding to the paper in the associated wxDC's
logical coordinates for the current user scale and device origin.
\membersection{wxPrintout::GetLogicalPageRect}\label{wxprintoutgetlogicalpagerect}
\func{wxRect}{GetLogicalPageRect}{}
Return the rectangle corresponding to the page in the associated wxDC's
logical coordinates for the current user scale and device origin.
On MSW and Mac, this will be the printable area of the paper. On other platforms
and PostScript printing, this will be the full paper rectangle.
\membersection{wxPrintout::GetLogicalPageMarginsRect}\label{wxprintoutgetlogicalpagemarginsrect}
\func{wxRect}{GetLogicalPageMarginsRect}{\param{const wxPageSetupDialogData\& }{pageSetupData}}
Return the rectangle corresponding to the page margins specified by the given
wxPageSetupDialogData object in the associated wxDC's logical coordinates for the
current user scale and device origin. The page margins are specified
with respect to the edges of the paper on all platforms.
\membersection{wxPrintout::SetLogicalOrigin}\label{wxprintoutsetlogicalorigin}
\func{void}{SetLogicalOrigin}{\param{wxCoord }{x}, \param{wxCoord }{y}}
Set the device origin of the associated wxDC so that the current logical point
becomes the new logical origin.
\membersection{wxPrintout::OffsetLogicalOrigin}\label{wxprintoutoffsetlogicalorigin}
\func{void}{OffsetLogicalOrigin}{\param{wxCoord }{xoff}, \param{wxCoord }{yoff}}
Shift the device origin by an amount specified in logical coordinates.
\membersection{wxPrintout::OnBeginDocument}\label{wxprintoutonbegindocument}
\func{bool}{OnBeginDocument}{\param{int}{ startPage}, \param{int}{ endPage}}
Called by the framework at the start of document printing. Return false from
this function cancels the print job. OnBeginDocument is called once for every
copy printed.
The base wxPrintout::OnBeginDocument {\it must} be called (and the return value
checked) from within the overridden function, since it calls wxDC::StartDoc.
\pythonnote{If this method is overridden in a Python class then the
base class version can be called by using the method
{\tt base\_OnBeginDocument(startPage, endPage)}. }
\membersection{wxPrintout::OnEndDocument}\label{wxprintoutonenddocument}
\func{void}{OnEndDocument}{\void}
Called by the framework at the end of document printing. OnEndDocument
is called once for every copy printed.
The base wxPrintout::OnEndDocument {\it must} be called
from within the overridden function, since it calls wxDC::EndDoc.
\membersection{wxPrintout::OnBeginPrinting}\label{wxprintoutonbeginprinting}
\func{void}{OnBeginPrinting}{\void}
Called by the framework at the start of printing. OnBeginPrinting is called once for every
print job (regardless of how many copies are being printed).
\membersection{wxPrintout::OnEndPrinting}\label{wxprintoutonendprinting}
\func{void}{OnEndPrinting}{\void}
Called by the framework at the end of printing. OnEndPrinting
is called once for every print job (regardless of how many copies are being printed).
\membersection{wxPrintout::OnPreparePrinting}\label{wxprintoutonprepareprinting}
\func{void}{OnPreparePrinting}{\void}
Called once by the framework before any other demands are made of the
wxPrintout object. This gives the object an opportunity to calculate the
number of pages in the document, for example.
\membersection{wxPrintout::OnPrintPage}\label{wxprintoutonprintpage}
\func{bool}{OnPrintPage}{\param{int}{ pageNum}}
Called by the framework when a page should be printed. Returning false cancels
the print job. The application can use wxPrintout::GetDC to obtain a device
context to draw on.
\section{\class{wxPrintPreview}}\label{wxprintpreview}
Objects of this class manage the print preview process. The object is passed
a wxPrintout object, and the wxPrintPreview object itself is passed to
a wxPreviewFrame object. Previewing is started by initializing and showing
the preview frame. Unlike wxPrinter::Print, flow of control returns to the application
immediately after the frame is shown.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/print.h>
\wxheading{See also}
\overview{Printing framework overview}{printingoverview},
\helpref{wxPrinterDC}{wxprinterdc},
\helpref{wxPrintDialog}{wxprintdialog},
\helpref{wxPrintout}{wxprintout},
\helpref{wxPrinter}{wxprinter},
\helpref{wxPreviewCanvas}{wxpreviewcanvas},
\helpref{wxPreviewControlBar}{wxpreviewcontrolbar},
\helpref{wxPreviewFrame}{wxpreviewframe}.
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxPrintPreview::wxPrintPreview}\label{wxprintpreviewctor}
\func{}{wxPrintPreview}{\param{wxPrintout* }{printout}, \param{wxPrintout* }{printoutForPrinting},
\param{wxPrintData* }{data=NULL}}
Constructor. Pass a printout object, an optional printout object to be
used for actual printing, and the address of an optional
block of printer data, which will be copied to the print preview object's
print data.
If {\it printoutForPrinting} is non-NULL, a {\bf Print...} button will be placed on the
preview frame so that the user can print directly from the preview interface.
Do not explicitly delete the printout objects once this destructor has been
called, since they will be deleted in the wxPrintPreview constructor.
The same does not apply to the {\it data} argument.
Test the Ok member to check whether the wxPrintPreview object was created correctly.
Ok could return false if there was a problem initializing the printer device context
(current printer not set, for example).
\membersection{wxPrintPreview::\destruct{wxPrintPreview}}\label{wxprintpreviewdtor}
\func{}{\destruct{wxPrinter}}{\void}
Destructor. Deletes both print preview objects, so do not destroy these objects
in your application.
\membersection{wxPrintPreview::GetCanvas}\label{wxprintpreviewgetcanvas}
\func{wxPreviewCanvas* }{GetCanvas}{\void}
Gets the preview window used for displaying the print preview image.
\membersection{wxPrintPreview::GetCurrentPage}\label{wxprintpreviewgetcurrentpage}
\func{int}{GetCurrentPage}{\void}
Gets the page currently being previewed.
\membersection{wxPrintPreview::GetFrame}\label{wxprintpreviewgetframe}
\func{wxFrame *}{GetFrame}{\void}
Gets the frame used for displaying the print preview canvas
and control bar.
\membersection{wxPrintPreview::GetMaxPage}\label{wxprintpreviewgetmaxpage}
\func{int}{GetMaxPage}{\void}
Returns the maximum page number.
\membersection{wxPrintPreview::GetMinPage}\label{wxprintpreviewgetminpage}
\func{int}{GetMinPage}{\void}
Returns the minimum page number.
\membersection{wxPrintPreview::GetPrintout}\label{wxprintpreviewgetprintout}
\func{wxPrintout *}{GetPrintout}{\void}
Gets the preview printout object associated with the wxPrintPreview object.
\membersection{wxPrintPreview::GetPrintoutForPrinting}\label{wxprintpreviewgetprintoutforprinting}
\func{wxPrintout *}{GetPrintoutForPrinting}{\void}
Gets the printout object to be used for printing from within the preview interface,
or NULL if none exists.
\membersection{wxPrintPreview::IsOk}\label{wxprintpreviewisok}
\func{bool}{Ok}{\void}
Returns true if the wxPrintPreview is valid, false otherwise. It could return false if there was a
problem initializing the printer device context (current printer not set, for example).
\membersection{wxPrintPreview::PaintPage}\label{wxprintpreviewpaintpage}
\func{bool}{PaintPage}{\param{wxPreviewCanvas *}{canvas}, \param{wxDC& }{dc}}
This refreshes the preview window with the preview image.
It must be called from the preview window's OnPaint member.
The implementation simply blits the preview bitmap onto
the canvas, creating a new preview bitmap if none exists.
\membersection{wxPrintPreview::Print}\label{wxprintpreviewprint}
\func{bool}{Print}{\param{bool }{prompt}}
Invokes the print process using the second wxPrintout object
supplied in the wxPrintPreview constructor.
Will normally be called by the {\bf Print...} panel item on the
preview frame's control bar.
Returns false in case of error -- call
\helpref{wxPrinter::GetLastError}{wxprintergetlasterror} to get detailed
information about the kind of the error.
\membersection{wxPrintPreview::RenderPage}\label{wxprintpreviewrenderpage}
\func{bool}{RenderPage}{\param{int }{pageNum}}
Renders a page into a wxMemoryDC. Used internally by wxPrintPreview.
\membersection{wxPrintPreview::SetCanvas}\label{wxprintpreviewsetcanvas}
\func{void}{SetCanvas}{\param{wxPreviewCanvas* }{window}}
Sets the window to be used for displaying the print preview image.
\membersection{wxPrintPreview::SetCurrentPage}\label{wxprintpreviewsetcurrentpage}
\func{void}{SetCurrentPage}{\param{int}{ pageNum}}
Sets the current page to be previewed.
\membersection{wxPrintPreview::SetFrame}\label{wxprintpreviewsetframe}
\func{void}{SetFrame}{\param{wxFrame *}{frame}}
Sets the frame to be used for displaying the print preview canvas
and control bar.
\membersection{wxPrintPreview::SetPrintout}\label{wxprintpreviewsetprintout}
\func{void}{SetPrintout}{\param{wxPrintout *}{printout}}
Associates a printout object with the wxPrintPreview object.
\membersection{wxPrintPreview::SetZoom}\label{wxprintpreviewsetzoom}
\func{void}{SetZoom}{\param{int}{ percent}}
Sets the percentage preview zoom, and refreshes the preview canvas
accordingly.
|