Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xmredisplaywidget(3) [hpux man page]

XmRedisplayWidget(library call) 										   XmRedisplayWidget(library call)

NAME
XmRedisplayWidget -- Synchronously activates the expose method of a widget to draw its content SYNOPSIS
#include <Xm/Xm.h> voidXmRedisplayWidget( Widgetwidget); DESCRIPTION
This function is a convenience routine that hides the details of the Xt internals to the application programmer by calling the expose method of the given widget with a well formed Expose event and Region corresponding to the total area of the widget. If the widget doesn't have an Expose method, the function does nothing. This is primarily used in the context of X Printing if the programming model chosen by the application is synchronous; 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. XmRedisplayWidget doesn't clear the widget window prior to calling the expose method, since this is handled by calls to XpStartPage . widget The widget to redisplay. RETURN VALUE
None. ERRORS
/WARNINGS Not applicable EXAMPLES
In the following, a simple application wants to print the content of a multi-page text widget (similar to dtpad). PrintOKCallback(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)); } Of course, one could change the above code to include it in a fork() 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: Boolean 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); } SEE ALSO
XmPrintSetup(3), XmPrintShell(3) XmRedisplayWidget(library call)

Check Out this Related Man Page

XmPrintToFile(library call)											       XmPrintToFile(library call)

NAME
XmPrintToFile -- Retrieves and saves data that would normally be printed by the X Print Server. SYNOPSIS
#include <Xm/Print.h> XtEnumXmPrintToFile( Display*dpy, Stringfilename, XPFinishProcfinish_proc, XtPointerclient_data); DESCRIPTION
XmPrintToFile hides the details of X display connection and XpGetDocumentData to the Motif application programmer. This function is a convenience routine that hides the details of the X and Xp internals to the application programmer by calling the XpGet- DocumentData function with appropriate save and finish callbacks. This is used in the context of X Printing when the user has specified the "print-to-file" option from a regular Print Setup Dialog box. XmPrintToFile first tries to open the given filename for writing and returns False if it can't. Else, it uses XpGetDocumentData, giving it a save proc that writes the data received in the file and a finish proc that closes the file or removes it on an unsuccessful termination. It calls finish_proc at that point, passing it the argument received from the Xp layer (status == XPGetDocFinished means the file is valid and was closed, otherwise the file was removed). XmPrintToFile is non-blocking; if it returns successfully, it just means the file was opened successfully, not that all the data was received. dpy Print display connection. filename Name of the file to put the print data in. finish_proc Called when all the data has been received. client_data Passed with the finish_proc. RETURN VALUE
Returns False if the filename could not be created or opened for writing, True otherwise. ERRORS
/WARNINGS Not applicable EXAMPLES
A typical OK callback from a DtPrintSetupBox: PrintOKCallback(widget...) /*-------------*/ { int save_data = XPSpool; pshell = XmPrintSetup (widget, pbs->print_screen, "Print", NULL, 0); XtAddCallback(pshell, XmNstartJobCallback, startJobCB, data); if (pbs->destination == DtPRINT_TO_FILE) save_data = XPGetData; /* start job must precede XpGetDocumentData in XmPrintToFile */ XpStartJob(XtDisplay(pshell), save_data); XFlush(XtDisplay(pshell)); /* maintain the sequence between startjob and getdocument */ /* setup print to file */ if (pbs->destination == DtPRINT_TO_FILE) XmPrintToFile(XtDisplay(pshell), pbs->dest_info, FinishPrintToFile, NULL); } } static void startJobCB(Widget, XtPointer call_data, XtPointer client_data) { print(p); /* rendering happens here */ XpEndJob(XtDisplay(p->print_shell)); /* clean up */ XtDestroyWidget(p->print_shell); XtCloseDisplay(XtDisplay(p->print_shell)); } SEE ALSO
XmPrintSetup(3), XmPrintShell(3), XmRedisplayWidget(3), XmPrintPopupPDM(3) XmPrintToFile(library call)
Man Page