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
|
'\" 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" "library call"
.SH "NAME"
\fBXmRedisplayWidget\fP \(em Synchronously activates the \fBexpose\fP method of a widget to draw its content
.SH "SYNOPSIS"
.PP
.nf
#include <Xm/Xm\&.h>
\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
|