1XmRedisplayWidget(library call)                XmRedisplayWidget(library call)
2
3
4

NAME

6       XmRedisplayWidget — Synchronously activates the expose method of a wid‐
7       get to draw its content
8

SYNOPSIS

10       #include <Xm/Xm.h>
11       voidXmRedisplayWidget(
12       Widgetwidget);
13

DESCRIPTION

15       This function is a convenience routine that hides the details of the Xt
16       internals to the application programmer by calling the expose method of
17       the given widget with a well formed Expose event and Region correspond‐
18       ing  to  the  total  area  of the widget. If the widget doesn't have an
19       Expose method, the function does nothing.
20
21       This is primarily used in the context of X Printing if the  programming
22       model  chosen  by  the  application is synchronous; that is, it doesn't
23       rely of X Print events for the driving of page layout but wants to com‐
24       pletely control the sequence of rendering requests.
25
26       XmRedisplayWidget  doesn't clear the widget window prior to calling the
27       expose method, since this is handled by calls to XpStartPage .
28
29       widget    The widget to redisplay.
30

RETURN VALUE

32       None.
33

ERRORS/WARNINGS

35       Not applicable
36

EXAMPLES

38       In the following, a simple application wants to print the content of  a
39       multi-page text widget (similar to dtpad).
40
41       PrintOKCallback(print_dialog...)
42       /*-------------*/
43       {
44           pshell = XmPrintSetup (print_dialog, pbs->print_screen,
45                                          "Print", NULL, 0);
46
47           XpStartJob(XtDisplay(pshell), XPSpool);
48
49           /**** here I realize the shell, get its size, create my widget
50            hierarchy: a bulletin board, and then a text widget,
51            that I stuff with the video text widget buffer */
52
53           /* get the total number of pages to print */
54           XtVaGetValues(ptext, XmNrows, &prows,
55                                XmNtotalLines, n_lines, NULL);
56           n_pages = n_lines / prows;
57
58           /***** now print the pages in a loop */
59
60           for (cur_page=0; cur_page != n_pages; cur_page++) {
61
62                      XpStartPage(XtDisplay(pshell), XtWindow(pshell), False);
63                      XmRedisplayWidget(ptext);  /* do the drawing */
64                      XpEndPage(XtDisplay(pshell));
65
66               XmTextScroll(ptext, prows);  /* get ready for next page */
67           }
68
69           /***** I'm done */
70           XpEndJob(XtDisplay(pshell));
71
72       }
73
74       Of  course,  one  could change the above code to include it in a fork()
75       branch so that the main program is not blocked while printing is  going
76       on. Another way to achieve a "print-in-the-background" effect is to use
77       an Xt workproc. Using the same sample application, that gives us:
78
79       Boolean
80       PrintOnePageWP(XtPointer npages) /* workproc */
81       /*-------------*/
82       {
83           static int cur_page = 0;
84           cur_page++;
85
86           XpStartPage(XtDisplay(pshell), XtWindow(pshell), False);
87           XmRedisplayWidget(ptext);  /* do the drawing */
88           XpEndPage(XtDisplay(pshell));
89
90           XmTextScroll(ptext, prows);  /*  get ready for next page */
91
92           if (cur_page == n_pages) { /***** I'm done */
93               XpEndJob(XtDisplay(pshell));
94
95               XtDestroyWidget(pshell);
96               XtCloseDisplay(XtDisplay(pshell));
97           }
98
99           return (cur_page == n_pages);
100       }
101
102       PrintOKCallback(...)
103       /*-------------*/
104       {
105           pshell = XmPrintSetup (widget, pbs->print_screen,
106                                          "Print", NULL, 0);
107
108           XpStartJob(XtDisplay(pshell), XPSpool);
109
110           /**** here I get the size of the shell, create my widget
111                 hierarchy: a bulletin board, and then a text widget,
112                         that I stuff with the video text widget buffer */
113
114           /* get the total number of pages to print */
115           /* ... same code as above example */
116
117           /***** print the pages in the background */
118           XtAppAddWorkProc(app_context, PrintOnePageWP, n_pages);
119       }
120

SEE ALSO

122       XmPrintSetup(3), XmPrintShell(3)
123
124
125
126                                               XmRedisplayWidget(library call)
Impressum