12.07.2015 Views

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

Athena Widget Set - C Language Interface - X Consortium ... - X.Org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using <strong>Widget</strong>s6. When the argument list is set up, create the widget with the XtCreateManaged-<strong>Widget</strong> function. For further information, see Section 2.2 and the X Toolkit Intrinsics- C <strong>Language</strong> <strong>Interface</strong>.7. If the widget has any callback routines, set by the XtNcallback argument or theXtAddCallback function, declare these routines within the application.8. After creating the initial widget hierarchy, windows must be created for eachwidget by calling XtRealize<strong>Widget</strong> on the top level widget.9. Most applications now sit in a loop processing events using XtAppMainLoop ,for example:10.XtCreateManaged<strong>Widget</strong>(name, class, parent, args, num_args);XtRealize<strong>Widget</strong>(shell);XtAppMainLoop(app_context);11.For information about this function, see the X Toolkit Intrinsics - C <strong>Language</strong><strong>Interface</strong>.12.Link your application with libXaw (the <strong>Athena</strong> widgets), libXmu (miscellaneousutilities), libXt (the X Toolkit Intrinsics), libSM (Session Management), libICE(Inter-Client Exchange), libXext (the extension library needed for the shape extensioncode which allows rounded Command buttons), and libX11 (the core Xlibrary). The following provides a sample command line:13.cc -o application application.c \-lXaw \-lXmu \-lXt \\-lSM \-lICE \-lXext \-lX11Changing Resource ValuesThe Intrinsics support two methods of changing the default resource values; the resourcemanager, and an argument list passed into XtCreate<strong>Widget</strong>. While resourcesvalues will get updated no matter which method you use, the two methods provideslightly different functionality.Resource ManagerArgument ListsThis method picks up resource definitions described in Xlib- C <strong>Language</strong> <strong>Interface</strong> from many different locations at runtime. The locations most important to the application programmerare the fallback resources and the app-defaults file, (see XToolkit Intrinsics - C <strong>Language</strong> <strong>Interface</strong> for the complete list).Since these resource are loaded at run time, they can be overriddenby the user, allowing an application to be customized tofit the particular needs of each individual user. These valuescan also be modified without the need to rebuild the application,allowing rapid prototyping of user interfaces. Applicationprogrammers should use resources in preference to hard-codedvalues whenever possible.The values passed into the widget at creation time via an argumentlist cannot be modified by the user, and allow no opportunityfor customization. It is used to set resources that cannotbe specified as strings (e.g. callback lists) or resources thatshould not be overridden (e.g. window depth) by the user.16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!