'\" t .\" RedWidg.sgm /main/9 1996/09/08 20:56:20 rws $ .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 "XmRedisplayWidget" 3 .SH "NAME" \fBXmRedisplayWidget\fP \(em Synchronously activates the \fBexpose\fP method of a widget to draw its content .SH "SYNOPSIS" .PP .nf #include \fBvoid\fBXmRedisplayWidget\fP\fR( \fBWidget\fBwidget\fR\fR); .fi .SH "DESCRIPTION" .PP This function is a convenience routine that hides the details of the Xt internals to the application programmer by calling the \fBexpose\fP method of the given widget with a well formed \fBExpose\fP event and \fBRegion\fP corresponding to the total area of the widget\&. If the widget doesn\&'t have an \fBExpose\fP method, the function does nothing\&. .PP This is primarily used in the context of X Printing if the programming model chosen by the application is \fIsynchronous\fP; that is, it doesn\&'t rely of X Print events for the driving of page layout but wants to completely control the sequence of rendering requests\&. .PP \fBXmRedisplayWidget\fP doesn\&'t clear the widget window prior to calling the \fBexpose\fP method, since this is handled by calls to \fBXpStartPage\fP \&. .IP "\fIwidget\fP" 10 The widget to redisplay\&. .SH "RETURN VALUE" .PP None\&. .SH "ERRORS/WARNINGS" .PP Not applicable .SH "EXAMPLES" .PP In the following, a simple application wants to print the content of a multi-page text widget (similar to \fBdtpad\fP)\&. .PP .nf \f(CWPrintOKCallback(print_dialog\&.\&.\&.) /*-------------*/ { pshell = XmPrintSetup (print_dialog, pbs->print_screen, "Print", NULL, 0); XpStartJob(XtDisplay(pshell), XPSpool); /**** here I realize the shell, get its size, create my widget hierarchy: a bulletin board, and then a text widget, that I stuff with the video text widget buffer */ /* get the total number of pages to print */ XtVaGetValues(ptext, XmNrows, &prows, XmNtotalLines, n_lines, NULL); n_pages = n_lines / prows; /***** now print the pages in a loop */ for (cur_page=0; cur_page != n_pages; cur_page++) { XpStartPage(XtDisplay(pshell), XtWindow(pshell), False); XmRedisplayWidget(ptext); /* do the drawing */ XpEndPage(XtDisplay(pshell)); XmTextScroll(ptext, prows); /* get ready for next page */ } /***** I\&'m done */ XpEndJob(XtDisplay(pshell)); }\fR .fi .PP .PP Of course, one could change the above code to include it in a \fBfork()\fP branch so that the main program is not blocked while printing is going on\&. Another way to achieve a "print-in-the-background" effect is to use an Xt workproc\&. Using the same sample application, that gives us: .PP .nf \f(CWBoolean PrintOnePageWP(XtPointer npages) /* workproc */ /*-------------*/ { static int cur_page = 0; cur_page++; XpStartPage(XtDisplay(pshell), XtWindow(pshell), False); XmRedisplayWidget(ptext); /* do the drawing */ XpEndPage(XtDisplay(pshell)); XmTextScroll(ptext, prows); /* get ready for next page */ if (cur_page == n_pages) { /***** I\&'m done */ XpEndJob(XtDisplay(pshell)); XtDestroyWidget(pshell); XtCloseDisplay(XtDisplay(pshell)); } return (cur_page == n_pages); } 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 bulletin 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 above example */ /***** print the pages in the background */ XtAppAddWorkProc(app_context, PrintOnePageWP, n_pages); }\fR .fi .PP .SH "SEE ALSO" .PP \fBXmPrintSetup\fP(3), \fBXmPrintShell\fP(3) .\" created by instant / docbook-to-man, Sun 22 Dec 1996, 20:28