DTPRINTSETUPBOX(3)
π NAME π
DtPrintSetupBox β application print setup widget. (library call, bestie β¨)
β¨ SYNOPSIS β¨
Caret#include &<Dt/Print.h>
π¦ DESCRIPTION π¦
okay so DtPrintSetupBox is a widget that is typically the initial window used to set various options prior to printing from an application. It is designed primarily for use by applications that utilize the X Print Service. However, it can also be used by applications employing other printing methods. π
DtPrintSetupBox is organized based on generic print options and application-specific print options. The sections are clearly demarcated with separators to set off the generic section from the application-specific section(s). By utilizing the DtNworkAreaLocation resource, the application developer can choose to utilize an area above the generic section, below the generic section, or both above and below the generic section. π«Ά
The four default buttons (Print, Setup, Cancel, and Help) are considered generic buttons. Applications can create additional pushbuttons as children of DtPrintSetupBox. These buttons will be laid out following the Print button. π
The Printer Name combo box contains the X printer specifier of the printer to be used for the print job. The X printer specifier is an identifier that uniquely identifies an X printer. The format of this specifier is printerName@host: display. π
πΈ Descendants πΈ
DtPrintSetupBox creates the descendants shown in the following list. An application can use XtNameToWidget to gain access to the named descendant. In addition, a user or an application can use the descendant name when specifying resource values. π
BottomWorkAreaSeparatorβ class:XmSeparatorGadget; identity: separator above the bottom work area.ButtonSeparatorβ class:XmSeparatorGadget; identity: separator above the pushbuttons.Cancelβ class:XmPushButtonGadget; identity: Cancel button.Copiesβ class:XmSimpleSpinBox; identity: SpinBox containing the number of copies.CopiesLabelβ class:XmLabelGadget; identity: label for the Copies SpinBox.DescriptionLabelβ class:XmLabelGadget; identity: label for the printer description.FileNameβ class:XmTextField; identity: file name field.FileNameCheckBoxβ class:XmRowColumn; identity: check box (includes label) for file name field.Helpβ class:XmPushButtonGadget; identity: Help button.Infoβ class:XmPushButtonGadget; identity: printer information button.Nameβ class:XmComboBox; identity: printer name.NameLabelβ class:XmLabelGadget; identity: label for the printer name field.Printβ class:XmPushButtonGadget; identity: Print button.SelectFileβ class:XmPushButtonGadget; identity: Select File button.SelectPrinterβ class:XmPushButtonGadget; identity: Select Printer button.Setupβ class:XmPushButtonGadget; identity: Setup button.TopWorkAreaSeparatorβ class:XmSeparatorGadget; identity: separator below the top work area.
π Classes π
DtPrintSetupBox inherits behavior and resources from the Core, Composite, Constraint, XmManager, and XmBulletinBoard superclasses. π
- The class pointer is
dtPrintSetupBoxWidgetClass. - The class name is
DtPrintSetupBox.
π Resources π
The following list is the whole resource table, and yes, every single one is here, bestie π
DtNcancelCallbackβ class/type:DtCCancelCallback/XtCallbackList; access:C; default value:NULL.DtNclosePrintDisplayCallbackβ class/type:DtCCloseDisplayCallback/XtCallbackList; access:C; default value:NULL.DtNcopiesβ class/type:DtCCopies/int; access:CSG; default value:1.DtNdescriptionβ class/type:DtCDescription/XmString; access:CSG; default value:dynamic.DtNfileNameβ class/type:DtCPrintToFileName/String; access:CSG; default value:NULL.DtNgetAttributesCallbackβ class/type:DtCGetAttributesCallback/XtCallbackList; access:C; default value:NULL.DtNminimizeButtonsβ class/type:DtCminimizeButtons/Boolean; access:CSG; default value:False.DtNprintCallbackβ class/type:DtCPrintCallback/XtCallbackList; access:C; default value:NULL.DtNprintDestinationβ class/type:DtCPrintDestination/XtEnum; access:CSG; default value:DtPRINT_TO_PRINTER.DtNprinterInfoProcβ class/type:DtCPrinterInfoProc/DtPrintSetupProc; access:CSG; default value:dynamic.DtNprinterNameβ class/type:DtCPrinter/String; access:CSG; default value:dynamic.DtNprintSetupModeβ class/type:DtCPrintSetupMode/XtEnum; access:CG; default value:DtPRINT_SETUP_XP.DtNselectFileProcβ class/type:DtCSelectFileProc/DtPrintSetupProc; access:CSG; default value:default procedure.DtNselectPrinterProcβ class/type:DtCSelectPrinterProc/DtPrintSetupProc; access:CSG; default value:dynamic.DtNsetAttributesCallbackβ class/type:DtCSetAttributesCallback/XtCallbackList; access:C; default value:NULL.DtNsetupProcβ class/type:DtCSetupProc/DtPrintSetupProc; access:CSG; default value:dynamic.DtNsetupProcβ class/type:DtCSetupProc/DtPrintSetupProc; access:CSG; default value:dynamic. (yes, it is listed twice in the original table, so here it is twice π)DtNverifyPrinterProcβ class/type:DtCVerifyPrinterProc/DtPrintSetupProc; access:CSG; default value:dynamic.DtNworkAreaLocationβ class/type:DtCworkAreaLocation/XtEnum; access:CSG; default value:DtWORK_AREA_BOTTOM.
The DtPrintSetupBox resources are defined as follows:
DtNcancelCallbackβ specifies the list of callbacks that is called when theCancelbutton is activated. The callback reason isDtPRINT_CR_CANCEL. πDtNclosePrintDisplayCallbackβ when the value of theDtNprintSetupModeresource isDtPRINT_SETUP_XP,DtPrintSetupBoxwill manage the X printing display connection and print context. As such,DtNclosePrintDisplayCallbackis provided to allow an application to perform any desired processing (such as destroying windows created on the print display) beforeDtPrintSetupBoxdestroys the current print context and closes the current print display connection. This callback list will not be called if the value of theDtNprintSetupModeresource is anything other thanDtPRINT_SETUP_XP. The callback reason isDtPRINT_CR_CLOSE_PRINT_DISPLAY. β¨DtNcopiesβ the number of copies of the document to print. This is a spin box into which the user may enter a positive integer. π’DtNdescriptionβ a description of the printer as provided by the system administrator.DtNfileNameβ specifies the name of the destination file. Setting this resource will update the value of theFile Nametext field.DtNgetAttributesCallbackβ specifies the list of callbacks that is called wheneverDtPrintSetupBoxreceives anXPAttributeNotifyevent, or immediately after a new X printer connection is established. This callback list will only be called if the value of theDtNprintSetupModeresource isDtPRINT_SETUP_XP. This callback is intended to be used by applications that utilize X Print Service attributes directly. These applications will be interested in changes made to the printing attributes byDtPrintSetupBoxor by other processes, such as the Print Dialog Manager (PDM). One of two callback reason codes will be set for this callback. The two reasons are of particular interest to applications that elect to present information in their GUI based on X Print Service attributes. The following indicates how such applications should respond to each code:DtPRINT_CR_GET_STATIC_ATTRIBUTESβ the application should update only those controls that cannot be modified by the user. This reason is set in response to encountering a new set of attributes as the result ofDtPrintSetupBoxestablishing a new X printer connection. Additionally, subsequent immediate action to be taken byDtPrintSetupBoxwill result in theDtNsetAttributesCallbacklist being called followed by either theDtNprintCallbacklist or theDtNsetupProc. If the application were to update dynamic GUI controls within thisDtNgetAttributesCallback, any input the user provided would be overridden by the printer defaults in the resulting print job or setup dialog. πDtPRINT_CR_GET_ATTRIBUTESβ the application should update all static and dynamic controls. This reason is set in response toDtPrintSetupBoxreceiving anXpAttributeNotifyevent, or if a new X printer connection was established as the result of the user activating thePrinter Infobutton. π₯
DtNminimizeButtonsβ if false, sets the dimensions of all of the buttons at the bottom of the widget to the width of the widest button and the height of the tallest button. If true, the dimensions of the buttons are not altered. πDtNprintCallbackβ specifies the list of callbacks that is called when thePrintbutton is activated. The callback reason isDtPRINT_CR_PRINT. This callback is used to initiate the print job. πDtNprintDestinationβ indicates where the print output should be directed. Valid values for this resource are:DtPRINT_TO_FILEβ direct print output to a file. The destination file name is indicated by theDtNfileNameresource. Setting this value will cause thePrint To Filecheckbox to be selected, enable theFile Nametext field, and enable theSelect Filebutton. πDtPRINT_TO_PRINTERβ direct print output to a printer. The destination printer is indicated by theDtNprinterNameresource. Setting this value will cause thePrint To Filecheckbox to be deselected, disable theFile Nametext field, and disable theSelect Filebutton. π¨οΈ
π
DtNprinterInfoProc π
Okay bestie, so this resource specifies the procedure that will be used to present printer information when the Printer Information button gets activated. The printer selection dialog presented by the default DtNselectPrinterProc will also call this procedure in response to activation of its Printer Information button.
If the value of the DtNprintSetupMode resource is DtPRINT_SETUP_XP, a default procedure that presents a printer information dialog is used. For other values of DtNprintSetupMode, the default value of DtNprinterInfoProc is NULL.
Typically, this procedure does not update DtPrintSetupBox resources nor X Print Service attributes. The return value of this procedure is ignored by DtPrintSetupBox. However, it is recommended that the procedure follow the conventions presented in the "DtPrintSetupProc" section to ensure future compatibility. π«Ά
πΈ DtNprinterName πΈ
This one is literally the name of the printer to send the print job to. π
If the value of the DtNprintSetupMode resource is DtPRINT_SETUP_XP, setting this resource will update the Printer Name field based on the value of the XpPrinterNameMode XRM resource. See the "EXTERNAL INFLUENCES" section in this man page for more information. If the value of the DtNprintSetupMode resource is DtPRINT_SETUP_PLAIN, setting this resource will update the value of the Printer Name text field with the value of this resource.
β¨ DtNprintSetupMode β¨
This resource instructs the widget as to whether or not it is being used in an application that utilizes the X Print Service. If so, then the widget will manage the X printing display connection and print context, and provide defaults for a number of X printing operations, such as printer selection and information dialogs, and printer verification. Refer to individual resource descriptions to determine if and how they are affected by the value of this resource. Valid values for this resource are:
DtPRINT_SETUP_PLAINβ This widget will be used by an application that performs its own print document format generation and print job submission.DtPRINT_SETUP_XPβ This widget will be used by an application that utilizes the X Print Service to perform print document format generation and print job submission.
π DtNselectFileProc π
This resource specifies the procedure that will be used in response to activation of the Select File button. The default value for this resource is a pointer to a procedure which will invoke an XmFileSelectionBox dialog to select a file name. Slay, file picker behavior. π
If the user cancels the file selection dialog, no DtPrintSetupBox components will be updated. If the user selects a file name, the file name will be set as the value for the DtNfileName resource. This procedure communicates the newly selected file name to DtPrintSetupBox by setting the DtNfileName resource.
Since the default procedure presents a File Selection Dialog, the resource is actually set after the procedure returns, due to the asynchronous nature of widgets and callbacks. The return value of this procedure is ignored by DtPrintSetupBox. However, it is recommended that the procedure follow the conventions presented in the "DtPrintSetupProc" section to ensure future compatibility.
π¦ DtNselectPrinterProc π¦
This resource specifies the procedure that will be used in response to activation of the Select Printer button. If the value of the DtNprintSetupMode resource is DtPRINT_SETUP_XP, a default procedure that invokes a DtPrinterSelectionDialog is used. If the user cancels the printer selection dialog no DtPrintSetupBox components will be updated. If the user selects a printer, the printer will be set as the value for the DtNprinterName resource.
This procedure communicates the newly selected printer name to DtPrintSetupBox by setting the DtNprinterName resource. Since the default procedure presents a Printer Selection Dialog, the resource is actually set after the procedure returns, due to the asynchronous nature of widgets and callbacks. Ngl, async callbacks really be doing the most. π
If the value of the DtNprintSetupMode resource is anything other than DtPRINT_SETUP_XP, the default value of DtNselectPrinterProc is NULL.
The return value of this procedure is ignored by DtPrintSetupBox. However, it is recommended that the procedure follow the conventions presented in the "DtPrintSetupProc" section to ensure future compatibility.
π DtNsetAttributesCallback π
This resource specifies the list of callbacks that is called whenever DtPrintSetupBox is about to perform an operation that will utilize X Print Service attributes. This callback list will only be called if the value of the DtNprintSetupMode resource is DtPRINT_SETUP_XP.
This callback is intended to be used by applications that utilize X Print Service attributes directly. This callback provides these applications with a chance to set attributes whenever a subsequent DtPrintSetupBox operation will utilize the current set of attributes (for example, prior to calling the DtNprintCallback list).
The callback reason is DtPRINT_CR_SET_ATTRIBUTES. Iconic. π
β DtNsetupProc β
This resource specifies the procedure that will be used in response to activation of the Setup button. If the value of the DtNprintSetupMode resource is DtPRINT_SETUP_XP, a default procedure is provided that will call XpNotifyPDM in order to present the setup dialog provided by the Print Dialog Manager.
If the value of the DtNprintSetupMode resource is anything other than DtPRINT_SETUP_XP, the default value of DtNsetupProc is NULL.
This procedure typically updates X Print Service attributes, and does not set any DtPrintSetupBox resources.
The return value of this procedure is ignored by DtPrintSetupBox. However, it is recommended that the procedure follow the conventions presented in the "DtPrintSetupProc" section to ensure future compatibility.
π₯ DtNverifyPrinterProc π₯
This resource specifies the procedure that will be used to verify the current value of the DtNprinterName resource before any operation requiring a valid printer is performed. If the current value of the DtNprinterName resource is NULL, this procedure will set a default printer as the value of the DtNprinterName resource.
If this procedure provides a default printer name, or a fully qualified X printer name, it should communicate the new name to DtPrintSetupBox by setting the DtNprinterName resource before returning.
If the value of the DtNprintSetupMode resource is DtPRINT_SETUP_XP, a default procedure will be set as the value of the DtNverifyPrinterProc resource. This default procedure will verify the X printer, and establish a print display connection and print context for the printer. The procedure communicates the new print display and context to DtPrintSetupBox by updating the print_data->print_display and print_data->print_context elements of the callback structure prior to returning.
If the value of the DtNprintSetupMode resource is anything other than DtPRINT_SETUP_XP, the default value of DtNverifyPrinterProc is NULL.
If the value of the DtNverifyPrinterProc resource is NULL, the printer name is always considered valid.
If this procedure determines the printer name is valid or sets a valid printer name (and X printer connection information), it should return DtPRINT_SUCCESS. If the printer name is invalid or no valid default can be determined, this procedure should return DtPRINT_FAILURE. Vibe check: success or failure, no in-between. π
π DtNworkAreaLocation π
Indicates how to position work area children within the DtPrintSetupBox. Possible values are:
DtWORK_AREA_BOTTOMβ A single work area child may be added, and will be placed below the generic controls and above the pushbuttons at the bottom of the window. A managed separator will be placed between the work area and the generic controls. This is the default.DtWORK_AREA_TOPβ A single work area child may be added, and will be placed above the generic controls and below the top of the window. A managed separator will be placed between the work area and the generic controls.DtWORK_AREA_TOP_AND_BOTTOMβ Two work area children may be added. The first work area created will become the top work area, positioned with a separator as forDtWORK_AREA_TOP, and the second will become the bottom work area, positioned with a separator as forDtWORK_AREA_BOTTOM.
β οΈ The effect of adding more work area children than indicated by the value of DtNworkAreaLocation is undefined. Bestie, do not test this unless you enjoy chaos. π
π± Inherited Resources π±
DtPrintSetupBox inherits resources from the XmBulletinBoard, XmManager, Constraint, Composite, and Core superclasses. Refer to the reference pages for these superclasses for inherited resources and their descriptions. Family tree behavior, fr fr. π«Ά
π Callback And Procedure Resource Information π
Okay so DtPrintSetupBox defines a whole new structure, DtPrintSetupData, and it gets passed to callbacks and procedure resource values. For callbacks only, it also defines a callback structure, DtPrintSetupCallbackStruct. And bestie, not every field in these structures is valid for every callback or procedure. For callbacks, the app has to look at the reason field first and use only the structure members valid for that particular reason. For each procedure, the app should only reference structure members that are defined as valid for that particular procedure. The DtPrintSetupData and DtPrintSetupCallbackStruct structures are defined like this:
typedef struct
{
String printer_name;
Display *print_display;
XPContext print_context;
XtEnum destination;
String dest_info;
} DtPrintSetupData;
printer_nameβ contains the current value of theDtNprinterNameresource.print_displayβ ifDtNprintSetupModeisDtPRINT_SETUP_XP, this holds a pointer to theDisplaystructure for the current X Printer. For other values ofDtNprintSetupMode, this field isNULL.print_contextβ ifDtNprintSetupModeisDtPRINT_SETUP_XP, this holds the print context handle for the current X Printer. For other values ofDtNprintSetupMode, this field isNULL.destinationβ contains the current value of theDtNprintDestinationresource.dest_infoβ additional info about the print destination as indicated by thedestinationfield.- If
destinationisDtPRINT_TO_FILE, this field contains the name of the file to print to. - If
destinationisDtPRINT_TO_PRINTER, this field contains the name of the currently selected printer as determined by the current value of theXpPrinterNameModeresource. This is useful for display within dialogs displaying print status, etc. because it is the printer name as presented to the user inDtPrintSetupBox.
- If
typedef struct
{
int reason;
XEvent *event;
DtPrintSetupData *print_data;
} DtPrintSetupCallbackStruct;
reasonβ indicates why the callback was invoked.eventβ points to theXEventthat triggered the callback. It can beNULL.print_dataβ points to aDtPrintSetupDatastructure containing additional callback information.
So for each callback reason, here are the valid members of DtPrintSetupCallbackStruct / DtPrintSetupData β no guessing, bestie:
DtPRINT_CR_CANCELβ valid fields:reason,event.DtPRINT_CR_CLOSE_PRINT_DISPLAYβ valid fields:reason,printer_name,print_display,print_context.DtPRINT_CR_GET_ATTRIBUTESβ valid fields:reason,event,printer_name,print_display,print_context.DtPRINT_CR_GET_STATIC_ATTRIBUTESβ valid fields:reason,event,printer_name,print_display,print_context.DtPRINT_CR_PRINTβ valid fields:reason,event,printer_name,print_display,print_context,destination,dest_info.DtPRINT_CR_SET_ATTRIBUTESβ valid fields:reason,event,printer_name,print_display,print_context.
And for each procedure resource, these are the valid DtPrintSetupData members:
DtNprinterInfoProcβ valid fields:printer_name,print_display,print_context.DtNselectFileProcβ valid fields:destination,dest_info.DtNsetupProcβ valid fields:printer_name,print_display,print_context.DtNverifyPrinterProcβ valid fields:printer_name,print_display,print_context.
π Translations π
DtPrintSetupBox inherits translations from XmBulletinBoard. Slay, inherited behavior.
πͺ Virtual Bindings πͺ
The bindings for virtual keys are implementation-dependent. For info about bindings for virtual buttons and keys, see VirtualBindings(3).
π EXTERNAL INFLUENCES π
This section specifies application resources and environment variables that will influence the behavior of DtPrintSetupBox. If a given resource is defined, it has precedence over the corresponding environment variable. And there is no corresponding environment variable for the XpPrinterNameMode resource. Noted. π
ποΈ XRM Application Resources ποΈ
XpPrinterβ this variable defines the default destination X Printer Specifier forDtPrintSetupBox. If the specifier is just aprinterName, thehost:displayportion of the specifier is obtained by checking if the X Server to which the client application is connected is an X Print Server managingprinterName. Otherwise, the first server in theXpServerListorXPSERVERLISTthat manages the printer will be used. If the:displaynumber is omitted,:0is assumed.
Example:
Dtmail*XpPrinter: laser_1@callisto:6
XpPrinterNameModeβ this resource indicates how an X Printer Specifier shall be shown in the Printer Name combo box text. Valid values are:DtSHORT_NAMEβ display only theprinterNameportion of the X Printer Specifier.DtMEDIUM_NAMEβ display the printer name as a combination of theprinterNameand thehostportions of the X Printer Specifier with an intervening "at" (@) symbol. For example:
printer@host
DtLONG_NAMEβ display the fully qualified X Printer Specifier. For example:
printer@host:6
If this resource is not specified, DtPrintSetupBox assumes a default of DtSHORT_NAME.
XpPrinterListβ this resource defines the initial set of X Printer Specifiers shown in the Printer Name combo box list. The resource value is a whitespace-delimited list of partially or fully specified X Printer Specifiers. When the user selects a specifier from this list, if the specifier is just aprinterName, thehost:displayportion of the specifier is obtained by checking if the X Server to which the client application is connected is an X Print Server managingprinterName. Otherwise the first server in theXpServerListorXPSERVERLISTthat manages the printer will be used. If the:displaynumber is omitted,:0is assumed.
Example:
*xpPrinterList: laser laser2@argon:3 laser7@xenon
XpServerListβ this resource contains a list of X Print Server specifiers. Each entry in the list is of the formhost:display, and is separated from other entries by whitespace.DtPrintSetupBoxuses this list to fully qualify partial X Printer Specifiers consisting of just theprinterName.
Example:
*.XpServerList: hanz:6 franz:6 ahnold:6
πΏ Environment Variables πΏ
PDPRINTER,LPDEST,PRINTERβ if theXPRINTERenvironment variable and theXpPrinterresource are not specified,DtPrintSetupBoxchecks the environment variables (in order)PDPRINTER,LPDEST, andPRINTERto obtain aprinterNamethat can be used to generate an X Printer Specifier to use for the default X Printer shown in the Printer Name combo box text field. Thehost:displayportion of the specifier is obtained by checking if the X Server to which the client application is connected is an X Print Server managingprinterName. If not, the list of X Print Servers specified in theXpServerListorXPSERVERLISTis queried, until the first X Printer with a matchingprinterNameis found.XPRINTERβ the specification of theXPRINTERenvironment variable is the same as theXpPrinterresource.XPRINTERLISTβ the specification of theXPRINTERLISTenvironment variable is the same as theXpPrinterListresource.XPSERVERLISTβ the specification of theXPSERVERLISTenvironment variable is the same as theXpServerListresource.
π» EXAMPLES π»
Sample code can be found in the /proj/cde/examples/dtprint directory. Go look, bestie β¨
π SEE ALSO π
DtPrintSetupProc(3)DtCreatePrintSetupDialog(3)DtPrintSetupProc(3)DtPrinterSelectionDialog(3)
And that's the whole page, bestie π β signing off from the DtPrintSetupBox(library call) page. The footer metadata situation is just that source tag, with no separate version or date printed here, so that's all the footer tea we've got. Periodt. π
β¨
π¦ where this page comes from
- nixos 26.05: cde 2.5.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms