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
|
'\" 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" "library call"
.SH "NAME"
\fBXmPrintShell\fR \(em a shell widget class used for printing in Motif
.SH "SYNOPSIS"
.PP
.nf
#include <Xm/Print\&.h>
\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
|