List of Examples

| Table of Contents | List of Figures | List of Examples | List of Tables |

Example 2-1. xhello.c: a minimal "hello, world" application
Example 2-2. XHello: the app-defaults file
Example 2-3. xgoodbye.c: complete code
Example 2-4. XGoodbye: the app-defaults file
Example 2-5. Using XtVaSetValues to set a widget resource
Example 2-6. Using XtSetValues to set a widget resource
Example 2-7. Code fragment to set multiple resources of a widget
Example 2-8. Code fragment to get a widget resource using XtVaGetValues
Example 2-9. Code fragment to get a widget resource using XtGetValues
Example 2-10. Alternate resource settings for xgoodbye
Example 3-1. xrowcolumn.c: complete code
Example 3-2. XRowColumn: app-defaults file
Example 3-3. xform: constraint resource settings added
Example 3-4. xmainwindow.c: code for implementing standard Motif screen layout
Example 3-5. Adding a File menu to an existing menubar
Example 3-6. xmainwindow: creating a Help button and Help dialog box
Example 3-7. XMainWindow: setting help text in the app-defaults file
Example 3-8. Passing a single value to a callback function
Example 3-9. Passing a pointer to a structure to a callback function
Example 3-10. ANSI non-conformant callback function definition
Example 3-11. The XmPushButtonCallbackStruct structure
Example 3-12. Initializing a callback list
Example 3-13. xbitmap: getting application resources
Example 3-14. The resource list for xbitmap4
Example 3-15. Calling XtGetApplicationResources and checking values
Example 3-16. xbitmap: specifying command-line options
Example 3-17. The R4 varargs interface to creating a widget
Example 3-18. An argument list
Example 3-19. Using an argument list in widget creation
Example 3-20. Setting the argument list with XtSetArg
Example 3-21. Incorrectly setting the argument list with XtSetArg
Example 4-1. xbitmap1: complete code
Example 4-2. XBitmap1: app-defaults file
Example 4-3. xbitmap2: implementing small pixmaps with DrawingArea widgets
Example 4-4. xbitmap2: creating pixmaps and GCs
Example 4-5. xbitmap2: the CellToggled routine
Example 4-6. xbitmap2: the RedrawSmallPicture routine
Example 4-7. xbitmap2: writing a bitmap file
Example 4-8. xbitmap3.c: adding a feature to a Primitive widget
Example 4-9. An XtActionProc with widget and event arguments
Example 4-10. A simple translation table
Example 4-11. A complex translation table
Example 4-12. XBitmap3: specifying translations in the app-defaults file
Example 4-13. Code fragment: specifying translations in the program
Example 4-14. A translation table with action parameters
Example 4-15. xbitmap4: implementing the bitmap editor from the application
Example 5-1. xcomstring.c: code to use multiple fonts in a compound string
Example 5-2. xcomstring: app-defaults file
Example 5-3. The .c file for a simple UIL application
Example 5-4. The .uil file for a simple UIL application
Example 6-1. BitmapEdiP.h: the class part and class record
Example 6-2. BitmapEdiP.h: the instance part and instance record
Example 6-3. BitmapEdiP.h: declaring the external class record
Example 6-4. BitmapEdit.c: include files
Example 6-5. BitmapEdit's resource list
Example 6-6. Setting the resource list into the class structure
Example 6-7. The default translation table and the actions table
Example 6-8. Translations in the Core class record
Example 6-9. BitmapEdit.c: function type declarations
Example 6-10. BitmapEdit.c: initialization of Core class record
Example 6-11. BitmapEdit.c: declaring the class record pointer
Example 6-12. BitmapEdit.c: inheriting a self-contained method
Example 6-13. Inheriting by invoking the superclass method from a widget method
Example 6-14. BitmapEdit.h: complete public header file
Example 7-1. The initialize method
Example 7-2. Creating GCs from the initialize method
Example 7-3. The expose method
Example 7-4. The set_values method
Example 7-5. BitmapEdit: the resize method
Example 7-6. The XtWidgetGeometry structure
Example 7-7. BitmapEdit: the query_geometry method
Example 7-8. The destroy method
Example 7-9. BitmapEdit: action routines
Example 8-1. Installing accelerators in an application
Example 8-2. Specifying the XtNaccelerators resource from the app-defaults file
Example 8-3. Conflicting translations and accelerators
Example 8-4. Installing accelerators from both command widgets
Example 8-5. Accelerators resource settings for two widgets
Example 9-1. Using an event hander to pop up a popup menu
Example 9-2. Registering an event handler, and the handler function itself
Example 9-3. Adding a nonmaskable event handler
Example 9-4. Casting the event structure by declaring action routine arguments
Example 9-5. Handling multiple event types in an action routine
Example 9-6. Getting file input with XtAppAddInput
Example 9-7. Reading stdin from an Xt application
Example 9-8. xtetris: registering a timeout and the timeout function
Example 9-9. xtetris: calling XtRemoveTimeOut
Example 9-10. Registering an Xt work procedure
Example 9-11. A work procedure to create a popup widget
Example 9-12. Skeleton of a custom main loop
Example 10-1. Three resources defined by the Motif Primitive widget
Example 10-2. The resource file XMail-color.
Example 10-3. An app-defaults file for the Spanish language
Example 10-4. A user defaults file for color and monochrome screens
Example 10-5. Setting fallback resources in XtAppInitialize
Example 10-6. A sample merged resource database
Example 10-7. Sample resource database with eliminated entries and components
Example 10-8. Resource database after final elimination of entries and components
Example 10-9. Resource database finalists in original form
Example 10-10. A resource definition converting an integer to a pixmap
Example 10-11. A resource definition using XmRImmediate
Example 10-12. A resource definition using XmRCallProc
Example 10-13. An example of an XtResourceDefaultProc
Example 10-14. Registering a type converter
Example 10-15. Adding a converter with arguments
Example 10-16. Manually invoking a type converter
Example 10-17. A simple type converter
Example 10-18. Testing for a special-case default value
Example 10-19. Simplified get_values_hook method of the AsciiSrc subpart of the Text widget
Example 11-1. Setting the XmNinput resource of a Shell widget
Example 11-2. Creating an icon pixmap, and setting XmNiconPixmap
Example 11-3. BitmapEdit: actions that highlight selection
Example 11-4. BitmapEdit: getting the atom for a widget-specific target type
Example 11-5. BitmapEdit: action to paste a selection
Example 11-6. BitmapEdit: converting the selection value
Example 11-7. BitmapEdit: pasting selection in requestor_callback function
Example 11-8. BitmapEdit: the lose_ownership_proc
Example 11-9. BitmapEdit: initializing Xmu's atom caching mechanism in the initialize method
Example 11-10. BitmapEdit: converting standard targets in the convert_proc
Example 12-1. ScrollBox: the set_values method
Example 12-2. ScrollBox: the resize method
Example 12-3. ScrollBox: the query_geometry method
Example 12-4. ScrollBox: private routine to lay out child widgets
Example 12-5. A basic change_managed method
Example 12-6. A simple geometry_manager method
Example 12-7. Form: the Core resource list
Example 12-8. Form: constraint resource list
Example 12-9. Form: constraint data structure
Example 12-10. Form: class structure initialization
Example 12-11. Form: the Constraint initialize method
Example 12-12. Form: the class_part_init method
Example 12-13. Form: the geometry_manager method
Example 12-14. Form: private functions: RefigureLocations and the layout method
Example 12-15. Form: the LayoutChild private function
Example 12-16. Form: the resize method
Example 12-17. Form: the change_managed method
Example 12-18. Form: the query_geometry method
Example 12-19. Form: the public function for delaying calls to change_managed
Example 13-1. Creating, placing, and popping up a popup menu
Example 13-2. Adding a cascading submenu
Example 13-3. xmenu1: complete code
Example 13-4. XMenu1: the app-defaults file
Example 13-5. xmenu2: code to place pulldown menu
Example 13-6. XMenu2: translation portion of the app-defaults file
Example 13-7. xmenu5: actions that place, pop up, and pop down main menus and submenus
Example 13-8. XMenu5: translation portion of app-defaults file
Example 13-9. xmenu7: using the SimpleMenu widget and its children
Example 13-10. XMenu7: app-defaults file
Example 13-11. Sme gadget: class part and complete class structure declaration
Example 13-12. Sme gadget: instance part and complete instance structure declaration
Example 13-13. SimpleMenu: expose method calling gadget children's expose methods
Example 13-14. SimpleMenu: resize method
Example 13-15. SimpleMenu: the Notify action routine
Example 13-16. SimpleMenu.c: Setting accepts_objects in the Composite extension structure
Example 14-1. How to invoke XtAppErrorMsg (from AsciiSrc.c)
Example 14-2. Common fields in a class extension record
Example 14-3. Adding editres support in an application
Example 14-4. Establishing the locale in an Xt application
Example B-1. Sample fonts.alias file
Example B-2. a portion of the fonts.dir file in /usr/lib/X11/fonts/100dpi
Example B-3. Listing scalable fonts
Example B-4. Finding derived instances of scalable fonts
Example B-5. Font name patterns that don't match scaled fonts.
Example B-6. Determining if a font is scalable
Example B-7. Loading a derived instance of a scalable font
Example E-1. BitmapEdit: complete widget code
Example E-2. BitmapEdiP.h: complete private header file
Example E-3. BitmapEdit.h: complete public header file
Example E-4. xbitmap5: complete application code