
Virtual void handleRawEvent(XEvent * event) When run() receives an event not handled by the Xt dispatch mechanism, it calls the virtual function VkApp::handleRawEvent(): For example, run() can handle events registered for non-widgets (such as a PropertyNotify event on the root window). See “Customizing Event Handling” for more information.Īdditionally, run() supports events not normally handled by the Xt dispatch mechanism. run() also allows for customized event handling. run() calls run_first() to do some internal initialization, and then enters a main loop that dispatches application events, raw X events, and normal Xt events. run() implements the event handling normally supported by XtAppMainLoop() or XtMainLoop(). The VkApp::run() function is ViewKit's main event loop. This is sufficient for setting simple resource values from the command line however, if you want to set application-level variables using either the command line or resource values, you should follow these steps: You can specify additional command-line options to parse by passing an XrmOptionDescRec(3Xt) table as the options argument and specifying the number of entries in the table with the numOptions argument.

The VkApp constructor passes these arguments to XtOpenDisplay(3Xt), which parses the command line according to the standard Xt command-line options, loads recognized options into the application's resource database, and modifies argc and argv to remove all recognized options. The second and third arguments to the VkApp constructor must be pointers to argc and the application's argv array. VkApp also differs from other ViewKit components in that you do not provide a component name in the constructor instead, ViewKit uses the command that you used to invoke your application ( argv) as the component name. This allows you to set the application class name without creating a subclass of VkApp. Note that VkApp differs from other ViewKit components in that you provide the application class name as an argument to the constructor rather than overriding the className() function. The appClassName argument designates the application class name, which is used when loading application resources. VkApp(char * appClassName, int * argc, char ** argv, The following is the syntax of the most frequently used VkApp constructor: This provides easy use of VkApp's facilities and data throughout your program. The header file declares this global variable as follows:Īs a result, the theApplication pointer is available in any file that includes the header file.
When you create an instance of the VkApp class, the constructor assigns a pointer to the VkApp object to the global variable theApplication.
#VIEWKIT SGI BOOK WINDOWS#
ViewKit creates all windows (using the VkSimpleWindow and VkWindow classes described in Chapter 4, “ViewKit Windows”) as popup children of the shell created by VkApp.

ViewKit supports a commonly used multi-shell architecture as described in the book X Window System Toolkit (Asente and Swick, 1990). In all ViewKit applications you must create a single instance of the VkApp class (or a derived class) before instantiating any other ViewKit objects.The VkApp constructor initializes the Xt Intrinsics and creates a shell, which is never visible, to serve as the parent for all of the application's main windows. This information is maintained in the private portion of the class and is available through public access functions. This information includes a pointer to the X Display structure associated with the application's connection to the server the XtAppContext structure required by many Xt functions the application's name and the application's class name. The VkApp class also stores some essential information that can be accessed throughout an application. For example, VkApp provides functions for quitting your application showing, hiding, iconifying, and opening all of the application's windows handling application busy states maintaining product version information and setting the application's cursor shape.

The VkApp class also provides support for other application-level tasks. When you write a ViewKit application, instead of calling Xt functions such as XtAppInitialize(3Xt) and XtAppMainLoop(3Xt), you simply instantiate and use a VkApp object. The primary responsibility of VkApp is to handle the initialization and event-handling operations common to all Xt-based applications. In all of your ViewKit applications you must create a single instance of VkApp or a class derived from VkApp. Unairworthy aircraft for sale.The VkApp class, derived from the VkComponent class, provides facilities required by all ViewKit applications.
