PtPrintSel

A widget for selecting printing properties

Class hierarchy:

PtWidgetPtBasicPtContainerPtPrintSel

For more information, see the diagram of the widget hierarchy.

PhAB icon:

PtPrintSel button in PhAB

Public header:

<photon/PtPrintSel.h>

Description:

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.


PtPrintSel


A PtPrintSel widget.

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);

New resources:

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

Note: 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.

Pt_ARG_PRINT_CONTEXT

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.


Note: 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.

Pt_ARG_PRINT_FILE

C type Pt type Default
char * String NULL

The name of the destination file when a document is printed to a file.

Pt_ARG_PRINT_FLAGS

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:

Pt_PRINTSEL_FILE_PANE
Enable the Send to file pane.
Pt_PRINTSEL_NO_COPIES
Disable the Copies widget.
Pt_PRINTSEL_NO_PAGE_RANGE
Disable the Print Range toggle button and the From and To fields.
Pt_PRINTSEL_NO_PRINTSELECT
Disable the printer-name combobox. Physical output goes to the default physical printer whose name is shown.
Pt_PRINTSEL_NO_SELECT_RANGE
Disable the Print Selection toggle button.
Pt_PRINTSEL_PREFERENCES
Enable the Preferences button.
Pt_PRINTSEL_SETTINGS_PANE
Enable the Print Pages, Print Order and Copies panes.

The following flag macros are defined in <PtPrintSel.h>:

Pt_PRINTSEL_ALL_PANES
Pt_PRINTSEL_FILE_PANE | Pt_PRINTSEL_SETTINGS_PANE
Pt_PRINTSEL_DFLT_LOOK
Pt_PRINTSEL_FILE_PANE | Pt_PRINTSEL_SETTINGS_PANE | Pt_PRINTSEL_PREFERENCES

Pt_ARG_PS_LBL_ALL

C type Pt type Default
char * String Print All Pages

The label used for the button used to print all the pages.

Pt_ARG_PS_LBL_COLLATED

C type Pt type Default
char * String Print Collated

The label used for the toggle button used to collate the pages.

Pt_ARG_PS_LBL_COPIES

C type Pt type Default
char * String Copies:

The label for the field for specifying the number of copies.

Pt_ARG_PS_LBL_DOUBLE_SIDED

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.

Pt_ARG_PS_LBL_FILE

C type Pt type Default
char * String File:

The label of the field used to specify the name of the file to print to.

Pt_ARG_PS_LBL_FROM

C type Pt type Default
char * String From:

The label used for the lower end of a range of pages to print.

Pt_ARG_PS_LBL_NAME

C type Pt type Default
char * String Name:

The label for the field that holds the printer's name.

Pt_ARG_PS_LBL_NOT_COLLATED

C type Pt type Default
char * String Print Not Collated

The label for the button that requests noncollated printing.

Pt_ARG_PS_LBL_PREFERENCES

C type Pt type Default
char * String Preferences

The label for the button for choosing print preferences.

Pt_ARG_PS_LBL_PRINT_ORDER

C type Pt type Default
char * String Print Order

The title for the pane for selecting the order in which pages are printed.

Pt_ARG_PS_LBL_PRINT_PAGES

C type Pt type Default
char * String Print Pages

The title of the pane for choosing which pages to print.

Pt_ARG_PS_LBL_RANGE

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.

Pt_ARG_PS_LBL_REVERSED

C type Pt type Default
char * String Print Reversed Order

The label for the button to select printing in reverse order.

Pt_ARG_PS_LBL_SELECTION

C type Pt type Default
char * String Print Selection

The label for the button for printing just the selected pages.

Pt_ARG_PS_LBL_SEND_TO_FILE

C type Pt type Default
char * String Send to file

The title of the pane used to send the output to a file.

Pt_ARG_PS_LBL_SEND_TO_PRINTER

C type Pt type Default
char * String Send to printer

The title of the pane used to send the output to a printer.

Pt_ARG_PS_LBL_TO

C type Pt type Default
char * String To:

The label used for the upper end of a range of pages to print.

Pt_CB_PRINT_PROPS

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:

reason
Pt_CB_PRINT_PROPS
reason_subtype
One of the following:
event
A pointer to a PhEvent_t structure that describes the event that caused the callback to be invoked.
cbdata
A pointer to a PpPrintContext_t structure. For more information, see the Printing chapter of the Photon Programmer's Guide.

These callbacks should return Pt_CONTINUE.

Inherited resources:

If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.

Resource Inherited from Default override
Pt_ARG_ANCHOR_FLAGS PtWidget
Pt_ARG_ANCHOR_OFFSETS PtWidget
Pt_ARG_AREA PtWidget
Pt_ARG_BANDWIDTH_THRESHOLD PtBasic Not used by this class.
Pt_ARG_BASIC_FLAGS PtBasic
Pt_ARG_BEVEL_WIDTH PtWidget
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BEVEL_COLOR PtBasic
Pt_ARG_BEVEL_CONTRAST PtBasic
Pt_ARG_COLOR PtBasic
Pt_ARG_CONTAINER_FLAGS PtContainer &=~Pt_GETS_FOCUS
Pt_ARG_CONTRAST PtBasic
Pt_ARG_CURSOR_COLOR PtWidget
Pt_ARG_CURSOR_OVERRIDE PtContainer
Pt_ARG_CURSOR_TYPE PtWidget
Pt_ARG_DARK_BEVEL_COLOR PtBasic
Pt_ARG_DARK_FILL_COLOR PtBasic
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget Read only
Pt_ARG_EFLAGS PtWidget
Pt_ARG_EXTENT PtWidget
Pt_ARG_FILL_COLOR PtBasic
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget 0
Pt_ARG_HEIGHT PtWidget
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic
Pt_ARG_INLINE_COLOR PtBasic
Pt_ARG_LIGHT_BEVEL_COLOR PtBasic
Pt_ARG_LIGHT_FILL_COLOR PtBasic
Pt_ARG_MARGIN_HEIGHT PtBasic Read only
Pt_ARG_MARGIN_WIDTH PtBasic Read only
Pt_ARG_MAXIMUM_DIM PtWidget
Pt_ARG_MINIMUM_DIM PtWidget
Pt_ARG_OUTLINE_COLOR PtBasic
Pt_ARG_POINTER PtWidget
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget
Pt_ARG_STYLE PtBasic
Pt_ARG_TITLE PtContainer
Pt_ARG_TITLE_FONT PtContainer
Pt_ARG_TRANS_PATTERN PtBasic
Pt_ARG_USER_DATA PtWidget
Pt_ARG_WIDTH PtWidget
Pt_CB_ACTIVATE PtBasic
Pt_CB_ARM PtBasic
Pt_CB_BALLOONS PtContainer
Pt_CB_BLOCKED PtWidget
Pt_CB_CHILD_ADDED_REMOVED PtContainer
Pt_CB_CHILD_GETTING_FOCUS PtContainer
Pt_CB_CHILD_LOSING_FOCUS PtContainer
Pt_CB_DESTROYED PtWidget
Pt_CB_DISARM PtBasic
Pt_CB_DND PtWidget
Pt_CB_FILTER PtWidget
Pt_CB_FILTER PtWidget
Pt_CB_GOT_FOCUS PtBasic
Pt_CB_HOTKEY PtWidget
Pt_CB_IS_DESTROYED PtWidget
Pt_CB_LOST_FOCUS PtBasic
Pt_CB_MENU PtBasic
Pt_CB_OUTBOUND PtWidget
Pt_CB_RAW PtWidget
Pt_CB_REALIZED PtWidget
Pt_CB_REPEAT PtBasic
Pt_CB_RESIZE PtContainer
Pt_CB_UNREALIZED PtWidget

Convenience functions:

The PtPrintSel class defines the following convenience function:

PtPrintSelect()
Display a custom modal dialog for selecting print options
PtPrintSelection()
Display a modal dialog for initiating printing

For more information, see the Photon Library Reference.