The OSF/Motif Programmer's Guide describes how to use the OSF/Motif[tm] application programming interface to create Motif[tm] applications. The book gives an overview of the architecture of the Motif widget set, explains features of the Motif toolkit, and presents a model and examples for constructing Motif applications.
This document is written for designers and developers of Motif programs. It does not provide sufficient information to develop new Motif widgets, although widget developers need to be familiar with the facilities and the issues discussed in this book.
This document assumes that the reader is familiar with the American National Standards Institute (ANSI) C programming language. It also assumes that the reader has a general understanding of the X Window System, the Xlib library, and the X Toolkit Intrinsics (Xt).
This is Revision 1.2 of this document. It applies to Release 1.2 of the OSF/Motif software system.
The purpose of this guide is to explain how to write application programs using the Motif toolkit. After reading this book, you should have a general understanding of the Motif toolkit and the Motif widget set and should be able to write applications that use them. This guide is not intended to explain how to develop new classes of widgets.
This document is organized into 16 chapters and two appendixes:
Chapter 1, "Introduction," introduces the book and gives an overview of the X Window System, Xlib, Xt, and Motif.
Chapter 2, "The Motif Programming Model," summarizes the structure of the Motif widget hierarchy and discusses general principles for writing Motif programs.
Chapter 3, "Structure of a Motif Program," explains the structure and general elements of a Motif application.
Chapter 4, "Structure of a Program Using UIL and MRM," describes the structure of a program that uses the User Interface Language (UIL) and Motif Resource Manager (MRM).
Chapter 5, "Basic Controls," discusses most of the primitive widgets that form the building blocks of a Motif application.
Chapter 6, "Menus and Options," describes how to use the RowColumn widget to build menus, radio boxes, and check boxes.
Chapter 7, "Dialogs," describes the widgets most appopriate for conducting dialogs with the user.
Chapter 8, "Text," explains the Motif Text and TextField widgets, which provide general display and editing of text.
Chapter 9, "Scrolling, Panes, and Frames," discusses composite widgets commonly used to contain other widgets in the application.
Chapter 10, "Managing Geometry," discusses the process of negotiating the layout of widgets and describes the layout-management policies of particular Motif widgets.
Chapter 11, "Internationalization," is a guide to internationalizing applications and providing text, font, and other information that is specific to particular language environments.
Chapter 12, "Color and Pixmaps," explains how Motif uses colors and pixmaps and how an application can provide its own.
Chapter 13, "Input, Focus, and Keyboard Navigation," discusses issues in handling input, including keyboard focus and traversal, translations, and actions.
Chapter 14, "Graphics and Text in a DrawingArea," describes DrawingArea, a general-purpose widget for displaying graphics and handling user input at a low level.
Chapter 15, "Drag and Drop," is an extensive discussion of the Motif drag and drop interface, with which the user transfers data by manipulating iconic representations with the pointer.
Chapter 16, "Interclient Communication," discusses communication between an application and other clients, including the Motif Window Manager (MWM), by means of resources, selections, protocols, and properties.
Appendix A, "The Widget Meta-Language Facility," describes the Widget Meta-Language (WML) facility, which generates portions of the UIL compiler to support new widget sets.
Appendix B, "Drag and Drop Example Program," is an extended example program using the drag and drop interface.
For additional information about OSF/Motif, refer to the following documents:
The OSF/Motif Programmer's Reference provides detailed reference information for programmers writing Motif applications.
The Application Enviroment Specification (AES) — User Enviroment Volume defines a stable set of routines for creating user interface applications.
The OSF/Motif Style Guide explains the principles of user interface design for application developers.
The OSF/Motif User's Guide explains how to interact with OSF/Motif applications.
For additional information about Xlib and Xt, refer to the following X Window System documents:
Xlib—C Language X Interfaceis the specification for Xlib.
X Toolkit Intrinsics—C Language Interfaceis the specification for Xt.
This document uses the following typographic conventions:
Bold | Bold words or characters represent system elements that an application or user must use literally, such as functions, data types, commands, flags, and pathnames. Bold words also indicate the first use of a term included in the glossary. | |
Italic | Italic words or characters represent variable values and arguments that an application or user must supply. | |
Constant width |
| |
< > | Angle brackets enclose the name of a key on the keyboard. | |
ComponentName |
|
Because not all keyboards are the same, it is difficult to specify keys that are correct for every manufacturer's keyboard. To solve this problem, this guide describes keys using a virtual key mechanism. The term virtual implies that the keys as described do not necessarily correspond to a fixed set of actual keys. Instead, virtual keys are linked to actual keys by means of virtual bindings. A given virtual key may be bound to different physical keys for different keyboards.
See Chapter 13, "Input, Focus, and Keyboard Navigation," of this book for information on the mechanism for binding virtual keys to actual keys. For details see the VirtualBindings(3X) reference page in the OSF/Motif Programmer's Reference. Since not all keyboards are the same, it is difficult to specify keys that are correct for every manufacturer's keyboard. To solve this problem, this guide describes keys using a model keyboard mechanism. Wherever keyboard input is specified, the keys are indicated by the engraving they have on the OSF/Motif model keyboard. The model keyboard does not correspond directly to any existing keyboard; rather, it assumes a keyboard with an ideal set of keys.
In addition to the standard letter, number, and character keys, the OSF/Motif model keyboard is composed of the following special keys:
The special printing characters </>,<\>,and <!>
The standard modifier keys <Ctrl>,<Alt>,and <Shift>
Ten function keys <F1> through <F10>
The arrow keys <Up arrow>,<Down arrow>,<Left arrow>,and <Right arrow>
<Backspace>
<Cancel>
<Delete>
<End>
<Escape>
<Help>
Either <Home>,<Begin> or both
<Insert>
<Menu>
<PageDown>
<PageUp>
<Return>
<Space>
<Tab>
The OSF/Motif model keyboard also contains the following optional keys, which, although useful, either are not necessary or may be created by combinations of other keys:
<CapsLock>
<Copy>
<Cut>
<Enter>
<ModeSwitch>
<NumLock>
<PageLeft>
<PageRight>
<Paste>
<ScrollLock>
<Select>
<Undo>
Throughout this guide, behavior is described in terms of model keyboard keys. When a behavior takes advantage of an optional key from the model keyboard, it is also described in terms of the required special keys. Each of the keys described on the OSF/Motif model keyboard must be available either as specified or using other keys or key combinations if the specified key is unavailable. A few of the more important alternative key bindings are described here.
If <Cancel> does not exist, <Escape> can be used in its place.
If <Help> does not exist, <F1> can be used in its place.
If <Menu> does not exist, <Shift> <F10> can be used in its place.
If <F10> does not exist, <Shift> <Menu> can be used in its place.
If <Home> or <Begin> does not exist, <Alt> <Left arrow> can be used in its place.
If <End> does not exist, <Alt> <Right arrow> can be used in its place
Wherever <Select> and <Space> can be used for a selection action, <Ctrl> <Space> can be used as well.