A widget for selecting printing properties
PtWidget → PtBasic → PtContainer → PtPrintSel
For more information, see the diagram of the widget hierarchy.
<photon/PtPrintSel.h>
The PtPrintSel widget lets you select a printer, change its properties, and optionally select a range of pages and the number of copies to print.
The widget has a resource for a print context, Pt_ARG_PRINT_CONTEXT, that you must set to one you've created with PpCreatePC():
PtSetArg(&args[0], Pt_ARG_PRINT_CONTEXT, pc, 0); /* Set some other resources... */ printsel = PtCreateWidget(PtPrintSel, window, nargs, args);
The widget automatically handles all aspects of selecting a printer and also runs the properties application to modify elements in the print context. When you're finished selecting the printer, you can get the modified print context by using PtGetResource() or PtGetResources() to get the widget's print-context resource:
/* The user has finished configuring the print session. */ PtGetResource( printsel, Pt_ARG_PRINT_CONTEXT, &pc, 0);
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_PRINT_CONTEXT | PpPrintContext_t | Struct | NULL |
Pt_ARG_PRINT_FLAGS | unsigned short | Flag | Pt_PRINTSEL_FILE_PANE | Pt_PRINTSEL_SETTINGS_PANE | Pt_PRINTSEL_PREFERENCES |
Pt_ARG_PRINT_FILE | char * | String | NULL |
Pt_ARG_PS_LBL_ALL | char * | String | Print All Pages |
Pt_ARG_PS_LBL_COLLATED | char * | String | Print Collated |
Pt_ARG_PS_LBL_COPIES | char * | String | Copies: |
Pt_ARG_PS_LBL_DOUBLE_SIDED | char * | String | Print Double Sided |
Pt_ARG_PS_LBL_FILE | char * | String | File: |
Pt_ARG_PS_LBL_FROM | char * | String | From: |
Pt_ARG_PS_LBL_NAME | char * | String | Name: |
Pt_ARG_PS_LBL_NOT_COLLATED | char * | String | Print Not Collated |
Pt_ARG_PS_LBL_PREFERENCES | char * | String | Preferences |
Pt_ARG_PS_LBL_PRINT_ORDER | char * | String | Print Order |
Pt_ARG_PS_LBL_PRINT_PAGES | char * | String | Print Pages |
Pt_ARG_PS_LBL_RANGE | char * | String | Print Range |
Pt_ARG_PS_LBL_REVERSED | char * | String | Print Reversed Order |
Pt_ARG_PS_LBL_SELECTION | char * | String | Print Selection |
Pt_ARG_PS_LBL_SEND_TO_FILE | char * | String | Send to file |
Pt_ARG_PS_LBL_SEND_TO_PRINTER | char * | String | Send to printer |
Pt_ARG_PS_LBL_TO | char * | String | To: |
Pt_CB_PRINT_PROPS | PtCallback_t * | Link | NULL |
If you click on the Preferences button, the widget displays the Printer Properties dialog by PtPrintPropSelect(). You can customize this dialog by setting some pseudo-resources. They aren't really widget resources, but you can set them for PtPrintSel as if they were, and the widget passes the settings to PtPrintPropSelect(). For details about these resources, see the Photon Library Reference. |
C type | Pt type | Default |
---|---|---|
PpPrintContext_t | Struct | NULL |
The current Print Context settings. This resource isn't available through PhAB, but you'll need a Print Context in order to do any printing. Use PpCreatePC() to create a Print Context, and PpSetPC() to change its settings.
When you use PtGetResources() to get this resource, you must provide a PpPrintContext_t structure, which is filled in directly with the values of the context. Unlike most calls to PtGetResources(), you aren't given a pointer into the widget's internal memory. |
C type | Pt type | Default |
---|---|---|
char * | String | NULL |
The name of the destination file when a document is printed to a file.
C type | Pt type | Default |
---|---|---|
unsigned short | Flag | Pt_PRINTSEL_FILE_PANE | Pt_PRINTSEL_SETTINGS_PANE | Pt_PRINTSEL_PREFERENCES |
Flags that modify the appearance of the widget:
The following flag macros are defined in <PtPrintSel.h>:
C type | Pt type | Default |
---|---|---|
char * | String | Print All Pages |
The label used for the button used to print all the pages.
C type | Pt type | Default |
---|---|---|
char * | String | Print Collated |
The label used for the toggle button used to collate the pages.
C type | Pt type | Default |
---|---|---|
char * | String | Copies: |
The label for the field for specifying the number of copies.
C type | Pt type | Default |
---|---|---|
char * | String | Print Double Sided |
The label for the toggle button used to choose between single- and double-sided printing.
C type | Pt type | Default |
---|---|---|
char * | String | File: |
The label of the field used to specify the name of the file to print to.
C type | Pt type | Default |
---|---|---|
char * | String | From: |
The label used for the lower end of a range of pages to print.
C type | Pt type | Default |
---|---|---|
char * | String | Name: |
The label for the field that holds the printer's name.
C type | Pt type | Default |
---|---|---|
char * | String | Print Not Collated |
The label for the button that requests noncollated printing.
C type | Pt type | Default |
---|---|---|
char * | String | Preferences |
The label for the button for choosing print preferences.
C type | Pt type | Default |
---|---|---|
char * | String | Print Order |
The title for the pane for selecting the order in which pages are printed.
C type | Pt type | Default |
---|---|---|
char * | String | Print Pages |
The title of the pane for choosing which pages to print.
C type | Pt type | Default |
---|---|---|
char * | String | Print Range |
The label of the button and fields used to select a range of pages for printing.
C type | Pt type | Default |
---|---|---|
char * | String | Print Reversed Order |
The label for the button to select printing in reverse order.
C type | Pt type | Default |
---|---|---|
char * | String | Print Selection |
The label for the button for printing just the selected pages.
C type | Pt type | Default |
---|---|---|
char * | String | Send to file |
The title of the pane used to send the output to a file.
C type | Pt type | Default |
---|---|---|
char * | String | Send to printer |
The title of the pane used to send the output to a printer.
C type | Pt type | Default |
---|---|---|
char * | String | To: |
The label used for the upper end of a range of pages to print.
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks that are invoked when you click on the Preferences button. If this resource isn't set or is set to NULL, clicking the Preferences button displays the Print Properties dialog by invoking the PtPrintPropSelect() convenience function; for more information, see the Photon Library Reference.
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.
The PtPrintSel class defines the following convenience function:
For more information, see the Photon Library Reference.