Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xmprintsetup(3) [centos man page]

XmPrintSetup(library call)												XmPrintSetup(library call)

NAME
XmPrintSetup -- setup and create a Print Shell widget SYNOPSIS
#include <Xm/Print.h> Widget XmPrintSetup( Widget video_widget, Screen *print_screen, String print_shell_name, ArgList args, Cardinal num_args); DESCRIPTION
A function that does the appropriate setting and creates a realized XmPrintShell that it returns to the caller. This function hides the details of the Xt to set up a valid print shell heirarchy for the application. It is also meant to encourage consistency in the way appli- cations root their print widget hierarchy. print_screen must belong to a Display connection that has already been initialized with Xt. The video_widget is used to get at the application context, application name and class, and argc/argv stored on the applicationShell that roots this widget. If no applicationShell is found, NULL argv/argc are used. XmPrintSetup then creates an unrealized ApplicationShell with the same name and class as the one given by the video display, on the print display and on the print screen specified. An XmPrintShell is then created as a child of this toplevel shell, using XtCreatePopupShell, with the name print_shell_name, and using the args provided. It then realizes and maps the print shell, using XtPopup with XtGrabNone. This way, application resource files and users can specify print specific attributes using the following syntax (if print_shell_name is "Print"): Dtpad.Print*textFontList: somefont *Print*background:white *Print*highlightThickness:0 video_widget A video widget to fetch app video data from. print_screen A print screen on the print display - specifies the screen onto which the new shell is created. print_shell_name Specifies the name of the XmPrintShell created on the X Print server. args Specifies the argument list from which to get the resources for the XmPrintShell. num_args Specifies the number of arguments in the argument list. RETURN VALUE
The id the XmPrintShell widget created on the X Print Server connection, or NULL if an error has occured. ERRORS
/WARNINGS None. EXAMPLES
From the OK callback and the SetUp callback of the primary print dialog widget: static void printOKCB(Widget, XtPointer call_data, XtPointer client_data) { AppPrint *p = (AppPrint *) client_data; DtPrintSetupCallbackStruct *pbs = (XmPrintCallbackStruct *) call_data; /* connect if not already done. the print dialog callback always provides valid printer name, print display and screen already initialized: XpInitContext called */ */ p->print_shell = XmPrintSetup (widget, pbs->print_screen, "Print", NULL, 0); ... } SEE ALSO
XmPrintShell(3), XmRedisplayWidget(3), XmPrintToFile(3), XmPrintPopupPDM(3) XmPrintSetup(library call)

Check Out this Related 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)
Man Page