Volume 6A: Motif Programming Manual

Book description

The Motif Programming Manual is a source for complete, accurate, and insightful guidance on Motif application programming. There is no other book that covers the ground as thoroughly or as well as this one. The book has been updated to Motif 1.2, but is still usable with Motif 1.1.The Motif Programming Manual describes how to write applications using the Motif toolkit from the Open Software Foundation (OSF). The book goes into detail on every Motif widget class, with useful examples that will help programmers to develop their own code. Anyone doing Motif programming who doesn't want to have to figure it out on their own needs this book.In addition to information on Motif, the book is full of tips about programming in general and about user interface design.Contents include:

  • An introduction to the Motif programming model, how it is based on the X Toolkit Intrinsics, and how it differs from them.
  • Chapters on each of the Motif widget classes, explaining them in depth, with useful examples that will help you to improve your own code. For example, the chapter on menus shows how to develop utility functions that generalize and simplify menu creation. All of the code shown in the book is available free of charge over the Internet or via UUCP.
  • Coverage of the drag-and-drop mechanism for transferring data. Two extensive examples show how to implement custom drag source and drop site functionality in a Motif application.
  • A tutorial on UIL. The chapters on UIL describe all of the techniques used to create an interface with this prototyping tool. The numerous examples cover the basics and explore ways to use UIL to facilitate rapid prototyping.
The book assumes competence with the C programming language, as well as familiarity with fundamental X Window System concepts. The Motif Programming Manual is not only the most comprehensive guide to writing applications with Motif, it is an integral part of the most widely used series of books on X as a whole. It complements and builds upon the earlier books in the X Window System Series from O'Reilly & Associates, as well as on OSF's own Motif Style Guide. Best when paired with Volume 6B, Motif Reference Manual.

Table of contents

  1. Motif Programming Manual (1/2)
  2. Motif Programming Manual (2/2)
  3. 1 Preface
    1. 1.1 The Plot
    2. 1.2 Assumptions
    3. 1.3 How This Book Is Organized
    4. 1.4 Related Documents
    5. 1.5 Conventions Used in This Book
    6. 1.6 Obtaining Motif
    7. 1.7 Obtaining the Example Programs
      1. 1.7.1 FTP
      2. 1.7.2 FTPMAIL
      3. 1.7.3 BITFTP
      4. 1.7.4 UUCP
      5. 1.7.5 Copyright
      6. 1.7.6 Compiling the Example Programs
    8. 1.8 Notes on Z-Mail
    9. 1.9 Acknowledgments
    10. 1.10 We'd Like to Hear From You
  4. 2 Introduction to Motif
    1. 2.1 A True Story
    2. 2.2 Basic User-interface Concepts
    3. 2.3 What Is Motif?
    4. 2.4 Designing User Interfaces
  5. 3 The Motif Programming Model
    1. 3.1 Basic X Toolkit Terminology and Concepts
    2. 3.2 The Xm and Xt Libraries
    3. 3.3 Programming With Xt and Motif
      1. 3.3.1 Header Files
      2. 3.3.2 Setting the Language Procedure
      3. 3.3.3 Initializing the Toolkit
      4. 3.3.4 Creating Widgets
      5. 3.3.5 Setting and Getting Widget Resources
      6. 3.3.6 Event Handling for Widgets
      7. 3.3.7 The Event Loop
    4. 3.4 Summary
  6. 4 Overview of the Motif Toolkit
    1. 4.1 The Motif Style
    2. 4.2 Application Controls
      1. 4.2.1 The Primitive Widget Class
      2. 4.2.2 Gadgets
    3. 4.3 Application Layout
      1. 4.3.1 The Manager Widget Class
      2. 4.3.2 Geometry Management
      3. 4.3.3 Gadget Management
      4. 4.3.4 Keyboard Traversal
    4. 4.4 Putting Together a Complete Application
      1. 4.4.1 The Main Window
      2. 4.4.2 Menus
      3. 4.4.3 The Window Manager
      4. 4.4.4 Dialogs
      5. 4.4.5 Pixmaps
      6. 4.4.6 Color
    5. 4.5 Changes in Motif 1.2
      1. 4.5.1 General Toolkit Changes
      2. 4.5.2 Specific Widget Changes
      3. 4.5.3 Changes to the Example Programs
    6. 4.6 Summary
  7. 5 The Main Window
    1. 5.1 Creating a MainWindow
    2. 5.2 The MenuBar
      1. 5.2.1 Creating a PulldownMenu
      2. 5.2.2 SimpleMenu Callback Routines
      3. 5.2.3 A Sample Application (1/2)
      4. 5.2.3 A Sample Application (2/2)
    3. 5.3 The Command and Message Areas
    4. 5.4 Using Resources
    5. 5.5 Summary
    6. 5.6 Exercises
  8. 6 Introduction to Dialogs
    1. 6.1 The Purpose of Dialogs
    2. 6.2 The Anatomy of a Dialog
    3. 6.3 Creating Motif Dialogs
      1. 6.3.1 Dialog Header Files
      2. 6.3.2 Creating a Dialog
      3. 6.3.3 Setting Resources
      4. 6.3.4 Dialog Management
      5. 6.3.5 Closing Dialogs
      6. 6.3.6 Generalizing Dialog Creation
    4. 6.4 Dialog Resources
      1. 6.4.1 The Default Button
      2. 6.4.2 Initial Keyboard Focus
      3. 6.4.3 Button Sizes
      4. 6.4.4 The Dialog Title
      5. 6.4.5 Dialog Resizing
      6. 6.4.6 Dialog Fonts
    5. 6.5 Dialog Callback Routines
    6. 6.6 Piercing the Dialog Abstraction
      1. 6.6.1 Convenience Routines
      2. 6.6.2 The DialogShell
      3. 6.6.3 Internal Widgets
    7. 6.7 Dialog Modality
      1. 6.7.1 Implementing Modal Dialogs
      2. 6.7.2 Forcing an Immediate Response (1/2)
      3. 6.7.2 Forcing an Immediate Response (2/2)
    8. 6.8 Summary
  9. 7 Selection Dialogs
    1. 7.1 Types of SelectionDialogs
    2. 7.2 SelectionDialogs
      1. 7.2.1 Callback Routines
      2. 7.2.2 Internal Widgets
    3. 7.3 PromptDialogs
    4. 7.4 The Command Widget
    5. 7.5 FileSelectionDialogs
      1. 7.5.1 Creating a FileSelectionDialog
      2. 7.5.2 Internal Widgets
      3. 7.5.3 Callback Routines
      4. 7.5.4 File Searching
    6. 7.6 Summary
  10. 8 Custom Dialogs
    1. 8.1 Modifying Motif Dialogs
      1. 8.1.1 Modifying MessageDialogs
      2. 8.1.2 Modifying SelectionDialogs
    2. 8.2 Designing New Dialogs
      1. 8.2.1 The Shell
      2. 8.2.2 The Manager Child
      3. 8.2.3 The Control Area
      4. 8.2.4 The Action Area
    3. 8.3 Building a Dialog (1/2)
    4. 8.3 Building a Dialog (2/2)
      1. 8.3.1 The Shell
      2. 8.3.2 The Manager Child
      3. 8.3.3 The Control Area
      4. 8.3.4 The Action Area
    5. 8.4 Generalizing the Action Area (1/2)
    6. 8.4 Generalizing the Action Area (2/2)
    7. 8.5 Using a TopLevelShell for a Dialog
    8. 8.6 Positioning Dialogs
    9. 8.7 Summary
  11. 9 Manager Widgets
    1. 9.1 Types of Manager Widgets
    2. 9.2 Creating Manager Widgets
    3. 9.3 The BulletinBoard Widget
      1. 9.3.1 Resources
      2. 9.3.2 Geometry Management
    4. 9.4 The Form Widget
      1. 9.4.1 Form Attachments
      2. 9.4.2 Attachment Offsets
      3. 9.4.3 Position Attachments
      4. 9.4.4 Additional Resources
      5. 9.4.5 Nested Forms
      6. 9.4.6 Common Problems
    5. 9.5 The RowColumn Widget
      1. 9.5.1 Rows and Columns
      2. 9.5.2 Homogeneous Children
      3. 9.5.3 Callbacks
    6. 9.6 The Frame Widget
    7. 9.7 The PanedWindow Widget
      1. 9.7.1 Pane Constraints
      2. 9.7.2 Sashes
    8. 9.8 Keyboard Traversal
      1. 9.8.1 Turning Traversal Off
      2. 9.8.2 Modifying Tab Groups
      3. 9.8.3 Handling Event Translations
      4. 9.8.4 Processing Traversal Manually
    9. 9.9 Summary
  12. 10 ScrolledWindows and ScrollBars
    1. 10.1 The ScrolledWindow Design Model
      1. 10.1.1 The Automatic Scrolling Model
      2. 10.1.2 The Application-defined Scrolling Model
    2. 10.2 Creating a ScrolledWindow
      1. 10.2.1 Automatic Scrolling
      2. 10.2.2 Application-defined Scrolling
      3. 10.2.3 Additional Resources
      4. 10.2.4 An Automatic ScrolledWindow Example
    3. 10.3 Working Directly With ScrollBars
      1. 10.3.1 Resources
      2. 10.3.2 Orientation
      3. 10.3.3 Callback Routines
    4. 10.4 Implementing True Application-defined Scrolling (1/2)
    5. 10.4 Implementing True Application-defined Scrolling (2/2)
    6. 10.5 Working With Keyboard Traversal in ScrolledWindows
    7. 10.6 Summary
    8. 10.7 Exercises
  13. 11 The DrawingArea Widget
    1. 11.1 Creating a DrawingArea Widget
    2. 11.2 Using DrawingArea Callback Functions
      1. 11.2.1 Handling Input Events
      2. 11.2.2 Redrawing a DrawingArea
    3. 11.3 Using Translations on a DrawingArea (1/2)
    4. 11.3 Using Translations on a DrawingArea (2/2)
    5. 11.4 Using Color in a DrawingArea
    6. 11.5 Summary
    7. 11.6 Exercises
  14. 12 Labels and Buttons
    1. 12.1 Labels
      1. 12.1.1 Creating a Label
      2. 12.1.2 Text Labels
      3. 12.1.3 Images as Labels
      4. 12.1.4 Label Sensitivity
      5. 12.1.5 Label Alignment
      6. 12.1.6 Multi-line and Multi-font Labels
    2. 12.2 PushButtons
      1. 12.2.1 PushButton Callbacks
      2. 12.2.2 Multiple Button Clicks
    3. 12.3 ToggleButtons
      1. 12.3.1 Creating ToggleButtons
      2. 12.3.2 ToggleButton Resources
      3. 12.3.3 ToggleButton Pixmaps
      4. 12.3.4 ToggleButton Callbacks
      5. 12.3.5 RadioBoxes
      6. 12.3.6 CheckBoxes
    4. 12.4 ArrowButtons
    5. 12.5 DrawnButtons
    6. 12.6 Summary
    7. 12.7 Exercise
  15. 13 The List Widget
    1. 13.1 Creating a List Widget
    2. 13.2 Using ScrolledLists
    3. 13.3 Manipulating Items
      1. 13.3.1 Adding Items
      2. 13.3.2 Finding Items
      3. 13.3.3 Replacing Items
      4. 13.3.4 Deleting Items
      5. 13.3.5 Selecting Items
      6. 13.3.6 An Example
    4. 13.4 Positioning the List
    5. 13.5 List Callback Routines
      1. 13.5.1 The Default Action
      2. 13.5.2 Browse and Single Selection Callbacks
      3. 13.5.3 Multiple Selection Callback
      4. 13.5.4 Extended Selection Callback
    6. 13.6 Summary
    7. 13.7 Exercises
  16. 14 The Scale Widget
    1. 14.1 Creating a Scale Widget
    2. 14.2 Scale Values
    3. 14.3 Scale Orientation and Movement
    4. 14.4 Scale Callbacks
    5. 14.5 Scale Tick Marks
    6. 14.6 Summary
  17. 15 Text Widgets
    1. 15.1 Interacting With Text Widgets
      1. 15.1.1 Inserting Text
      2. 15.1.2 Selecting Text
    2. 15.2 Text Widget Basics
      1. 15.2.1 The Textual Data
      2. 15.2.2 Single and Multiple Lines
      3. 15.2.3 Scrollable Text (1/2)
      4. 15.2.3 Scrollable Text (2/2)
      5. 15.2.4 Text Positions (1/2)
      6. 15.2.4 Text Positions (2/2)
      7. 15.2.5 Output-only Text
    3. 15.3 Text Clipboard Functions
      1. 15.3.1 Getting the Selection
      2. 15.3.2 Modifying the Selection Mechanisms
    4. 15.4 A Text Editor (1/2)
    5. 15.4 A Text Editor (2/2)
    6. 15.5 Text Callbacks
      1. 15.5.1 The Activation Callback
      2. 15.5.2 Text Modification Callbacks (1/2)
      3. 15.5.2 Text Modification Callbacks (2/2)
      4. 15.5.3 The Cursor Movement Callback
      5. 15.5.4 Focus Callbacks
    7. 15.6 Text Widget Internationalization
      1. 15.6.1 Text Representation
      2. 15.6.2 Text Output
      3. 15.6.3 Text Input
    8. 15.7 Summary
    9. 15.8 Exercises
  18. 16 Menus
    1. 16.1 Menu Types
    2. 16.2 Creating Simple Menus
      1. 16.2.1 Popup Menus
      2. 16.2.2 Cascading Menus
      3. 16.2.3 Option Menus
    3. 16.3 Designing Menu Systems
      1. 16.3.1 Menu Titles
      2. 16.3.2 Menu Items
      3. 16.3.3 Mnemonics
      4. 16.3.4 Accelerators
      5. 16.3.5 The Help Menu
      6. 16.3.6 Sensitivity
      7. 16.3.7 Tear-Off Menus
    4. 16.4 General Menu Creation Techniques
      1. 16.4.1 Building Pulldown Menus
      2. 16.4.2 Building Cascading Menus
      3. 16.4.3 Building Popup Menus (1/2)
      4. 16.4.3 Building Popup Menus (2/2)
      5. 16.4.4 Building Option Menus
    5. 16.5 Summary
    6. 16.6 Exercises
  19. 17 Interacting With the Window Manager
    1. 17.1 Interclient Communication
    2. 17.2 Shell Resources
      1. 17.2.1 Shell Positions
      2. 17.2.2 Shell Sizes
      3. 17.2.3 The Shell's Icon
    3. 17.3 VendorShell Resources
      1. 17.3.1 Window Manager Decorations
      2. 17.3.2 Window Menu Functions
    4. 17.4 Handling Window Manager Messages
      1. 17.4.1 Adding New Protocols
      2. 17.4.2 Saving Application State
    5. 17.5 Customized Protocols
    6. 17.6 Summary
    7. 17.7 Exercises
  20. 18 The Clipboard
    1. 18.1 Simple Clipboard Copy and Retrieval
      1. 18.1.1 Copying Data
      2. 18.1.2 Retrieving Data
      3. 18.1.3 Querying the Clipboard for Data Size
    2. 18.2 Copy by Name
    3. 18.3 Clipboard Data Formats
    4. 18.4 The Primary Selection and the Clipboard
      1. 18.4.1 Clipboard Functions With Text Widgets
      2. 18.4.2 The Owner of the Selection
    5. 18.5 Implementation Issues
    6. 18.6 Summary
  21. 19 Drag and Drop
    1. 19.1 Using Drag and Drop
    2. 19.2 The Drag and Drop Model
      1. 19.2.1 The Drag Source
      2. 19.2.2 The Drop Site
      3. 19.2.3 The Drag Icon
      4. 19.2.4 Protocols
      5. 19.2.5 The Programming Model
    3. 19.3 Customizing Built-in Drag and Drop
      1. 19.3.1 Specifying the Drag Protocol
      2. 19.3.2 Turning Off Drag and Drop Functionality
      3. 19.3.3 Modifying the Visual Effects
    4. 19.4 Working With Drag Sources (1/2)
    5. 19.4 Working With Drag Sources (2/2)
      1. 19.4.1 Creating a Drag Source
      2. 19.4.2 Starting the Drag
      3. 19.4.3 Converting the Data
      4. 19.4.4 Modifying an Existing Drag Source
      5. 19.4.5 Providing Custom Drag-over Visuals
      6. 19.4.6 Cleaning Up
    6. 19.5 Working With Drop Sites (1/2)
    7. 19.5 Working With Drop Sites (2/2)
      1. 19.5.1 Creating a Drop Site
      2. 19.5.2 Modifying an Existing Drop Site
      3. 19.5.3 Handling the Drop
      4. 19.5.4 Providing Help
      5. 19.5.5 Providing Custom Drag-under Visuals
    8. 19.6 Summary
  22. 20 Compound Strings
    1. 20.1 Internationalized Text Output
    2. 20.2 Creating Compound Strings
      1. 20.2.1 The Simple Case
      2. 20.2.2 Font List Tags
      3. 20.2.3 Compound String Segments
      4. 20.2.4 Multiple-font Strings
    3. 20.3 Manipulating Compound Strings
      1. 20.3.1 Compound String Functions
      2. 20.3.2 Compound String Retrieval
      3. 20.3.3 Compound String Conversion
    4. 20.4 Working With Font Lists
      1. 20.4.1 Creating Font Lists
      2. 20.4.2 Retrieving Font Lists
      3. 20.4.3 Querying Font Lists
    5. 20.5 Rendering Compound Strings
    6. 20.6 Summary
  23. 21 Signal Handling
    1. 21.1 Handling Signals in Xlib
    2. 21.2 Handling Signals in Xt
    3. 21.3 An Example
    4. 21.4 Additional Issues
    5. 21.5 Summary
  24. 22 Advanced Dialog Programming
    1. 22.1 Help Systems
      1. 22.1.1 Multi-level Help
      2. 22.1.2 Context-sensitive Help
    2. 22.2 Working Dialogs
      1. 22.2.1 Using Work Procedures
      2. 22.2.2 Using Timers
      3. 22.2.3 Processing Events
      4. 22.2.4 Updating the Display
      5. 22.2.5 Avoiding Forks
    3. 22.3 Dynamic Message Symbols
    4. 22.4 Summary
  25. 23 Introduction to UIL
    1. 23.1 Overview of UIL and Mrm
      1. 23.1.1 Using UIL and Mrm
      2. 23.1.2 Advantages and Disadvantages of UIL
    2. 23.2 The
    3. 23.3 Describing an Interface With UIL
      1. 23.3.1 Starting and Ending a Module
      2. 23.3.2 Specifying Module-wide Options
      3. 23.3.3 Include Files
      4. 23.3.4 Adding Comments
      5. 23.3.5 Overview of UIL Language Syntax
      6. 23.3.6 Sections of a UIL Module
    4. 23.4 Compiling the UIL Module
    5. 23.5 Structure of an Mrm Application
      1. 23.5.1 Initializing the Application
      2. 23.5.2 Creating the Interface
      3. 23.5.3 Displaying the Interface
    6. 23.6 Summary
  26. 24 Using the UIL Compiler
    1. 24.1 Compiler Options
      1. 24.1.1 Output File
      2. 24.1.2 Include Path
      3. 24.1.3 Generate Listing
      4. 24.1.4 Set Locale
      5. 24.1.5 Suppress Warnings
      6. 24.1.6 Machine Listing
      7. 24.1.7 Use WML Description
    2. 24.2 Errors, Warnings, and Informational Messages
      1. 24.2.1 Severe Error Messages
      2. 24.2.2 Regular Error Messages
      3. 24.2.3 Warning Messages
      4. 24.2.4 Informational Messages
    3. 24.3 Summary
  27. 25 Creating a User Interface With UIL
    1. 25.1 Viewing UIL Examples
    2. 25.2 Defining and Creating Widgets
      1. 25.2.1 Specifying Widget Attributes (1/2)
      2. 25.2.1 Specifying Widget Attributes (2/2)
      3. 25.2.2 Sharing Widgets Among Modules
      4. 25.2.3 The Widget Creation Process
    3. 25.3 Defining and Fetching Values
      1. 25.3.1 Sharing Values Between Modules
      2. 25.3.2 Fetching Values
      3. 25.3.3 Numeric Values
      4. 25.3.4 Text-related Values (1/2)
      5. 25.3.4 Text-related Values (2/2)
      6. 25.3.5 Colors
      7. 25.3.6 Pixmaps
      8. 25.3.7 Widget Classes
      9. 25.3.8 Keysyms
      10. 25.3.9 Translation Tables
    4. 25.4 Working With Callbacks
    5. 25.5 Using Lists
    6. 25.6 Exporting Application Data
      1. 25.6.1 Declaring Identifiers in UIL
      2. 25.6.2 Exporting Identifiers From Application Code
    7. 25.7 Summary
  28. 26 Building an Application With UIL
    1. 26.1 Defining the User Interface
      1. 26.1.1 The Main Application Window
      2. 26.1.2 The Menu System
      3. 26.1.3 Dialog Boxes
    2. 26.2 Creating the Application (1/2)
    3. 26.2 Creating the Application (2/2)
      1. 26.2.1 Widget IDs
      2. 26.2.2 Callbacks
      3. 26.2.3 The Error Dialog
    4. 26.3 Summary
  29. 27 Advanced UIL Programming
    1. 27.1 Using Non-Motif Widgets
      1. 27.1.1 The Widget Creation Procedure
      2. 27.1.2 Widget Include Files
      3. 27.1.3 Creating User-defined Widgets
    2. 27.2 Organizing UIL Modules
      1. 27.2.1 Using Separate Modules
      2. 27.2.2 Organizing Within a Module
      3. 27.2.3 Supporting Internationalization
      4. 27.2.4 Organizing With Include Files
      5. 27.2.5 Creating Reusable Components
    3. 27.3 Specifying Resource Values
      1. 27.3.1 Resource Name Checking
      2. 27.3.2 Resource Type Checking
      3. 27.3.3 Resource Type Support
      4. 27.3.4 Callback Specifications
      5. 27.3.5 Wildcard Specification
      6. 27.3.6 User Customization
      7. 27.3.7 Dynamic Updating
      8. 27.3.8 Guidelines for Setting Resources
    4. 27.4 Using Lists Effectively
      1. 27.4.1 Specifying Common Resources
      2. 27.4.2 Reusing Components
    5. 27.5 Prototyping an Interface With UIL
      1. 27.5.1 Managing Widgets
      2. 27.5.2 Creating Widgets
    6. 27.6 Summary
  30. 28 Additional Example Programs
    1. 28.1 A Postcard Interface for Mail
    2. 28.2 A Bitmap Display Utility (1/2)
    3. 28.2 A Bitmap Display Utility (2/2)
    4. 28.3 A Memo Calendar (1/2)
    5. 28.3 A Memo Calendar (2/2)

Product information

  • Title: Volume 6A: Motif Programming Manual
  • Author(s): David Brennan, Dan Heller, Paula Ferguson
  • Release date: September 1993
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596000431