'\" t .\" PrtShell.sgm /main/12 1996/10/25 10:33:08 cdedoc $ .de P! .fl \!!1 setgray .fl \\&.\" .fl \!!0 setgray .fl \" force out current output buffer \!!save /psv exch def currentpoint translate 0 0 moveto \!!/showpage{}def .fl \" prolog .sy sed -e 's/^/!/' \\$1\" bring in postscript file \!!psv restore . .de pF .ie \\*(f1 .ds f1 \\n(.f .el .ie \\*(f2 .ds f2 \\n(.f .el .ie \\*(f3 .ds f3 \\n(.f .el .ie \\*(f4 .ds f4 \\n(.f .el .tm ? font overflow .ft \\$1 .. .de fP .ie !\\*(f4 \{\ . ft \\*(f4 . ds f4\" ' br \} .el .ie !\\*(f3 \{\ . ft \\*(f3 . ds f3\" ' br \} .el .ie !\\*(f2 \{\ . ft \\*(f2 . ds f2\" ' br \} .el .ie !\\*(f1 \{\ . ft \\*(f1 . ds f1\" ' br \} .el .tm ? font underflow .. .ds f1\" .ds f2\" .ds f3\" .ds f4\" .ta 8n 16n 24n 32n 40n 48n 56n 64n 72n .TH "XmPrintShell" 3 .SH "NAME" \fBXmPrintShell\fR \(em a shell widget class used for printing in Motif .SH "SYNOPSIS" .PP .nf #include \fBBoolean \fBXmIsPrintShell\fP\fR( \fBWidget\fR); .fi .SH "DESCRIPTION" .PP The \fBXmPrintShell\fP provides the Motif application programmer with an Xt widget oriented API to some of the X Print resources and a callback to drive the pagination\&. .PP The \fBXmPrintShell\fP provides a simple callback to handle the pagination logic, and a set of resources to get and set common printer attributes\&. .PP If not created on an \fBXPrint\fP connection, \fBXmPrintShell\fP behaves as a regular applicationShell\&. .PP The \fBXmPrintShell\fP also initializes the \fBXp\fP extension event handling mechanism, by registering an extension selector that calls \fBXpSelectInput\fP and event dispatcher for print and attributes \fBXp\fP events, so applications can use \fBXtInsertEventTypeHandler\fP to register their own handler with the \fBXp\fP events\&. .SS "Arguments" .PP No \fBXmCreate\fP function is provided, since this is a toplevel shell, most likely created thru some \fBXt\fP shell creation routine or \fBXmPrintSetup\fP\&. .SS "Classes" .PP \fBXmPrintShell\fP is a subclass of \fBApplicationShell\fP; it inherits behavior, resources and traits from all its superclasses\&. The class pointer is \fBXmPrintShellWidgetClass\fP\&. .SS "New Resources" .TS tab(); cw(1.3) sw(1.3) sw(1.3) sw(1.0) sw(0.5) lw(1.3) lw(1.3) lw(1.3) lw(1.0) lw(0.5). \fBXmPrintShell Resource Set\fP \fBName\fP\fBClass\fP\fBType\fP\fBDefault\fP\fBAccess\fP \fBXmNstartJobCallback\fP\fBXmCCallback\fP\fBXtCallbackList\fP\fBNULL\fP\fBCSG\fP \fBXmNendJobCallback\fP\fBXmCCallback\fP\fBXtCallbackList\fP\fBNULL\fP\fBCSG\fP \fBXmNpageSetupCallback\fP\fBXmCCallback\fP\fBXtCallbackList\fP\fBNULL\fP\fBCSG\fP \fBXmNminX\fP\fBXmCMinX\fP\fBDimension\fP\fBdynamic\fP\fBG\fP \fBXmNminY\fP\fBXmCMinY\fP\fBDimension\fP\fBdynamic\fP\fBG\fP \fBXmNmaxX\fP\fBXmCMaxX\fP\fBDimension\fP\fBdynamic\fP\fBG\fP \fBXmNmaxY\fP\fBXmCMaxY\fP\fBDimension\fP\fBdynamic\fP\fBG\fP \fBXmNdefaultPixmapResolution\fP\fBXmCDefaultPixmapResolution\fP\fBunsigned short\fR\fB100\fP\fBCSG\fP \fBXmNpdmNotificationCallback\fP\fBXmCCallback\fP\fBXtCallbackList\fP\fBNULL\fP\fBCSG\fP .TE .IP "\fIXmNstartJobCallback\fP" 10 Specifies the callback driving the beginning of rendering\&. It is safe for an application to start rendering after this callback has been activated\&. \fBXpStartJob\fP must be called to trigger this callback\&. .IP "\fIXmNendJobCallback\fP" 10 Specifies the callback driving the end of rendering\&. Notify the client that all rendering has been processed (whether on print-to-file or regular spool)\&. \fBXpEndJob\fP is called by the print shell to trigger this callback\&. .IP "\fIXmNpageSetupCallback\fP" 10 Specifies the callback driving the page layout\&. It is safe for an app to start rendering from this callback even if the \fBXmNstartJobCallback\fP is not used\&. .IP "\fIXmNminX, XmNminY, XmNmaxX, XmNmaxY\fP" 10 Specify the imageable area of the page in the current print context\&. \fBXmPrintShell\fP also maintains a proper size at all times by updating its own widget dimension whenever an attribute, such as resolution or orientation, changes\&. It is sized in its \fBInitialize\fP routine so that the application can rely on a proper size before the first \fBStartPage\fP call is issued\&. .IP "\fIXmNdefaultPixmapResolution\fP" 10 Indicates the resolution in dpi (dot per inch) of the image files read and converted by Motif for the widget descendants of this shell\&. It is used to determine a scaling ratio to be applied to pixmap created thru regular pixmap/icon conversion of the following Widget resources: .RS .IP " \(bu" 6 \fBXmLabel\fP\&.label*Pixmap, \fBXmIconG\fP\&.*IconPixmap \fBXmToggleB\fP\&.selectPixmap, \fBXmPushBG\fP\&.armPixmap, \fBXmIconG\fP\&.*IconMask, \fBXmMessageBox\fP\&.symbolPixmap, \fBXmContainer\fP\&.*StatePixmap, \&.\&.\&. .IP " \(bu" 6 Leaving out the pixmap resources being used for tiling (XmNhighlightPixmap, XmNtopShadowPixmap, XmNbottomShadowPixmap, XmNbackgroundPixmap, \&.\&.\&.) .RE .IP "\fIXmNpdmNotificationCallback\fP" 10 A callback notifying the application about the status of the PDM (see XmPrintPopupPDM)\&. A XmPrintShellCallbackStruct is used, with reason: .RS .IP " \(bu" 6 \fBXmCR_PDM_NONE\fP: no PDM available on this display for the named selection (provided in detail) .IP " \(bu" 6 \fBXmCR_PDM_START_VXAUTH\fP : the PDM is not authorized to connect to the video display\&. .IP " \(bu" 6 \fBXmCR_PDM_START_PXAUTH\fP : the PDM is not authorized to connect to the print display\&. .IP " \(bu" 6 \fBXmCR_PDM_UP\fP : the PDM is up and running .IP " \(bu" 6 \fBXmCR_PDM_OK\fP : the PDM has exited with OK status .IP " \(bu" 6 \fBXmCR_PDM_CANCEL\fP : the PDM has exited with CANCEL .IP " \(bu" 6 \fBXmCR_PDM_START_ERROR\fP : the PDM cannot start due to some error (usually logged) .IP " \(bu" 6 \fBXmCR_PDM_EXIT_ERROR\fP : the PDM has exited with an error .RE .SS "Callback Information" .PP The \fBXmNstartJobCallback\fP, \fBXmNendJobCallback,\fP \fBXmNpageSetupCallback\fP and \fBXmNpdmNotificationCallback\fP operate on a \fBXmPrintShellCallbackStruct\fP, which is defined as follow: .PP .nf \f(CWtypedef struct { int reason; /* XmCR_START_JOB, XmCR_END_JOB, XmCR_PAGE_SETUP, XmCR_PDM_* */ XEvent *event; XPContext print_context; Boolean last_page; /* in_out */ XtPointer detail; } XmPrintShellCallbackStruct;\fR .fi .PP .SS "Additional Behavior" .PP The \fBlast_page\fP field is only meaningful when the reason is \fBXmCR_PAGE_SETUP\fP\&. .PP The page setup callback is called with \fBlast_page\fP \fBFalse\fP to notify the application that it has to get its internal layout state ready for the next page\&. Typically, a widget based application will change the content of a \fBLabel\fP showing the page number, or scroll the content of the \fBText\fP widget\&. .PP When the application has processed its last page, it should set the \fBlast_page\fP field in the callback struct to \fBTrue\fP\&. The callback will be called a last time after that with \fBlast_page\fP \fBFalse\fP to notify the application that it can safely clean-up its internal state (e\&.g\&., destroy widgets)\&. .PP No drawing should occur from within the callback function in the application, this is an Exposure event-driven programming model where widgets render themselves from their expose methods\&. .PP The print shell calls \fBXpStartPage\fP after the \fBpageSetupCallback\fP returns, and \fBXpEndPage\fP upon reception of \fBStartPageNotify\fP\&. .SH "ERRORS/WARNINGS" .PP \fBXmPrintShell\fP can generate the following warnings: .IP " \(bu" 6 \fBNot connected to a valid X Print Server: behavior undefined\&.\fP .IP " \(bu" 6 \fBAttempt to set an invalid resolution on a printer: %s\fP .IP " \(bu" 6 \fBAttempt to set an invalid orientation on a printer: %s\fP .SH "RETURN VALUE" .PP Not applicable .SH "EXAMPLES" .PP .nf \f(CWPrintOnePageCB(Widget pshell, XtPointer npages, /*----------*/ XmPrintSetPageCBStruct psp) { static int cur_page = 0; cur_page++; if (! psp->last_page && curPage > 1) /* no need to scroll for the first page */ { XmTextScroll(ptext, prows); /* get ready for next page */ } else { /**** I\&'m done */ XtDestroyWidget(pshell); XtCloseDisplay(XtDisplay(pshell)); } if (cur_page == (int) n_pages) psp->last_page = True; } PrintOKCallback(\&.\&.\&.) /*-------------*/ { pshell = XmPrintSetup (widget, pbs->print_screen, "Print", NULL, 0); XpStartJob(XtDisplay(pshell), XPSpool); /**** here I get the size of the shell, create my widget hierarchy: a bulleting board, and then a text widget, that I stuff with the video text widget buffer */ /* get the total number of pages to print */ /* same code as previous example to get n_pages */ /**** set up my print callback */ XtAddCallback(pshell, XmNpageSetUpCallback, PrintOnePageCB, n_pages); }\fR .fi .PP .PP Examples of \fBXmNdefaultPixmapResolution\fP usage: .IP " \(bu" 6 An application reuses the same image sources it uses for the video interface, in XBM, XPM, PNG or JPEG, to layout on its printed pages\&. In this case, scaling is seamless\&. .PP .nf \f(CW ! icon\&.xpm is 30x30 pixels app*dialog\&.pushb\&.labelPixmap:icon\&.xpm ! print is 400dpi app\&.print*form\&.lab\&.labelPixmap:icon\&.xpm ! 120x120 pixels on the paper (auto scaling)\fR .fi .PP .IP " \(bu" 6 An application provides a new set of image files, for a given printer resolution (say 300)\&. It doesn\&'t want automatic scaling by the toolkit for that resolution, it wants scaling based on these 300dpi images for higher resolution\&. It creates its print shell inside using the name "printHiRes" and adds the following in its resource file: .PP .nf \f(CW app\&.printHiRes\&.defaultPixmapResolution:300 ! icon300\&.xpm is 120x120 pixels app\&.printHiRes*form\&.lab\&.labelPixmap:icon300\&.xpm ! 120x120 pixels on the paper (no scaling)\fR .fi .PP .PP This way a printer resolution of 600 will result in a scale of a 300 dpi image by 2 (dpi=600 divided by base=300), while a printer resolution of 150 (using default print shell name "print") will use the 100 dpi icon scaled by 1\&.5 (dpi=150 divided by default base=100)\&. .SH "SEE ALSO" .PP \fBXmPrintSetup\fP(3), \fBXmRedisplayWidget\fP(3), \fBXmPrintToFile\fP(3), \fBXmPrintPopupPDM\fP(3) .\" created by instant / docbook-to-man, Sun 22 Dec 1996, 20:27