Programming with Motif™About this Book This book is a detailed introduction to programming with the OSF /MotifI'M graphical user interface. It is an introduction in that it does not require the reader to have experience programming in the X Window environment. It is detailed in that it teaches you how to use the interface components provided by Motif in a complex application. Although it contains a great deal of reference material, it is not meant as an authoritative reference - that is the job of the OSF/Motif Programmer's Reference, which uses over 900 pages in the process. Instead, this book provides its reference material in a practical, "how to" manner and allows the reader to use the Programmer's Reference effectively. The target reader is an experienced C programmer and user of the X Window System under the UNIX operating system. 'the reader should be familiar with the tools provided by UNIX for the compilation and testing of programs; while this book does examine the process by which a Motif program is compiled, it does not explain that process. It also assumes that the reader is familiar with "x" terms such as 'pointer' and 'display'. |
Contents
An Introduction To Motif Mechanism not Policy | 1 |
Enter Motif | 2 |
The Layers of X | 3 |
The Widget What Is a Widget? | 5 |
Widgets as Objects | 7 |
Widget Instance Tree | 10 |
Widget Resources What Are Resources? | 11 |
Resource Tables | 12 |
Find | 314 |
Message Boxes | 325 |
XmMessageBox | 327 |
XmMessageBox Resources | 328 |
XmMessageBox Convenience Functions | 330 |
Cant Find Alert | 331 |
Grabbing and Assigning Input Focus | 334 |
Lists Overview | 337 |
A Short Note on Resource Naming Conventions | 13 |
Format of a Resource Specification | 16 |
Sample Resource File | 17 |
Setting Resources by Class | 19 |
The Resource not Set | 20 |
How Many Resource Files Could One Program Use? | 21 |
Setting Resources from the Command Line | 22 |
Setting Resources Programmatically | 23 |
HardWiring Resource Values | 25 |
Writing A Motif Program The Widget Data Type | 27 |
A Program Template | 32 |
Header Files | 33 |
Compilation of a Motif Program | 35 |
A Short Note About Program Size | 36 |
What About Standard IO? | 37 |
XmLabel Overview | 39 |
XmLabel Resources | 40 |
Hello World | 42 |
Setting a Labels Font | 44 |
The XmString Data Type | 48 |
Setting labelString Programmatically | 51 |
Using XmLabel with Pictures | 53 |
Managers Overview | 57 |
An Overview | 58 |
Management Revisited | 59 |
The unitType Resource | 62 |
XmBulletinBoard | 65 |
XmBulletinBoard Examples | 68 |
XmRowColumn | 73 |
XmRowColumn Examples | 80 |
XmPanedWindow | 87 |
Three Labels and a Paned Window | 91 |
XmForm | 92 |
XmForm Examples | 101 |
Buttons Overview | 107 |
Inheritance | 108 |
Press Here | 112 |
XmArrowButton | 114 |
XmArrowButton Example | 115 |
XmToggleButton | 117 |
XmToggleButton Examples | 122 |
Events and Callbacks Overview | 125 |
Handling X Events | 127 |
Mouse Tracker | 135 |
Callbacks | 142 |
Button Callbacks | 145 |
Press Here | 146 |
Actions | 148 |
Translations | 151 |
Multibutton Pushbutton | 159 |
XmPushButton Default Translations | 162 |
Keyboard Input Overview | 165 |
Keyboard Events | 166 |
Traversal | 167 |
Three Tab Groups | 169 |
XmText | 172 |
XmText Resources | 173 |
XmText Callbacks | 179 |
XmText Default Translations | 182 |
XmText Convenience Functions | 185 |
Memo Pad | 190 |
Entry Fields | 192 |
Scrolled Text | 197 |
Creating a Scrolled Text Widget | 198 |
Scrolled Text Resources | 199 |
File Browser | 200 |
Scrollbars Overview | 205 |
XmScrolledWindow | 207 |
XmScrolledWindow Resources | 208 |
Creating and Initializing a Scrolled Window | 211 |
Scrolling RowColumn | 212 |
XmScrollBar | 215 |
XmScrollBar Resources | 216 |
XmScrollBar Callbacks | 219 |
Getting and Setting a Scrollbars Values Programmatically | 221 |
XmScale | 224 |
XmScale Resources | 225 |
XmScale Callbacks | 228 |
XmScale Example | 229 |
The Motif Look Overview | 233 |
XmMainWindow | 235 |
XmMainWindow Convenience Functions | 237 |
XmSeparator | 238 |
XmSeparator Resources | 239 |
XmSeparator Example | 241 |
XmFrame | 243 |
XmFrame Resources | 244 |
Labels in Frames | 246 |
The New Standard Program Template | 248 |
A Sample Application | 254 |
Menus Overview | 261 |
XmCascadeButton Resources | 262 |
XmCascadeButton Callbacks | 263 |
XmRowColumn Menu Resources | 264 |
XmRowColumn Callbacks | 266 |
The Menu Bar | 267 |
The Standard Motif Menu Bar | 269 |
Adding a Menu Bar to the Editor | 272 |
XmMenuShell and a Menu Panes Instance Tree | 276 |
Adding PullDown Menus to the Editor | 278 |
Mnemonics | 282 |
Menu Accelerators | 285 |
Cascading PullDowns | 287 |
Cascading PullDown Example | 288 |
PopUp Menus | 289 |
Color Selection Menu | 290 |
Option Menus | 294 |
XmRowColumn Resources Specific to Option Menus | 295 |
Font Family and Size | 297 |
Menu Summary | 300 |
Dialogs Overview | 305 |
Dialog Design and Components | 306 |
XmDialogShell | 307 |
XmDialogShell Resources | 308 |
Dialog Management and Unmanagement | 310 |
Building and Using a Dialog | 313 |
XmList Resources | 339 |
XmList Callbacks | 342 |
XmList Convenience Functions | 344 |
EMail Address Selection | 347 |
Scrolled List | 351 |
Scrolled List Resources | 352 |
Scrolling EMail Addresses | 353 |
XmSelectionBox | 354 |
XmSelectionBox Resources | 355 |
XmSelectionBox Callbacks | 359 |
Creating and Using a Selection Box | 360 |
EMail Addresses | 361 |
XmFileSelectionBox | 363 |
XmFileSelectionBox Resources | 365 |
Creating And Using XmFileSelectionBox | 366 |
OpenSave As | 368 |
XmCommand | 379 |
XmCommand Resources | 380 |
XmCommand Convenience Functions | 382 |
XmCommand Example | 384 |
Using Xlib With Motif Overview | 387 |
Color in a Digital World | 389 |
The Standard Xlib Parameters | 391 |
The Graphics Context | 393 |
XmDrawingArea | 401 |
XmDrawingArea Resources | 402 |
XmDrawingArea Callbacks | 403 |
Doodle | 406 |
Resources Revisited Overview | 427 |
CommandLine Options | 432 |
Resource Converters | 436 |
Writing a Converter | 444 |
Quarks | 452 |
Using Converters Outside the Resource Manager | 455 |
The Conversion Cache | 459 |
Application Resources | 460 |
Interclient Communication Overview | 467 |
Timeouts | 474 |
WorkProcs | 478 |
Sending Events Between Clients | 482 |
Atoms | 485 |
Window Properties | 487 |
Window Manager Protocols | 493 |
Selection | 502 |
The Clipboard | 513 |
Adding Cut Copy and Paste to the Text Editor | 521 |
XmText Direct Clipboard Interface | 530 |
ISO Latin 1 Character Set | 533 |
Widget Class Summary Overview | 535 |
Composite | 536 |
Core | 537 |
OuerrideShell | 538 |
TopLevelShell | 539 |
WMShell | 540 |
XmArrowButton | 541 |
XmBulletinBoard | 542 |
XmCascadeButton | 543 |
XmDialogShell | 544 |
XmDrawnButton | 545 |
XmForm | 546 |
XmFrame | 547 |
XmList | 548 |
XmMain Window | 549 |
XmMenuShell | 550 |
XmPanedWindow | 551 |
XmPrimitiue | 552 |
XmPushButton | 553 |
XmRowColumn | 554 |
XmScale | 555 |
XmScrollBar | 556 |
XmScrolledWindow | 557 |
XmSelectionBox | 558 |
XmSeparator | 559 |
XmText | 560 |
XmToggleButton | 561 |
X Event Reference Overview | 563 |
Event Masks | 565 |
XEvent | 567 |
XAnyEvent | 570 |
ButtonPress ButtonRelease | 571 |
CirculateNotify | 573 |
CirculateRequest | 574 |
ClientMessage | 575 |
ColormapNotify | 577 |
ConfigureNotify | 578 |
ConfigureRequest | 580 |
CreateNotify | 583 |
DestroyNotify | 584 |
EnterNotify LeaveNotify | 585 |
Expose | 588 |
Focusln FocusOut | 589 |
GraphicsExpose NoExpose | 592 |
GravityNotify | 594 |
KeymapNotify | 595 |
KeyPress KeyRelease | 596 |
MapNotify UnmapNotify | 598 |
MappingNotify | 600 |
MapRequest | 601 |
MotionNotify | 602 |
PropertyNotify | 605 |
ReparentNotify | 606 |
ResizeRequest | 607 |
SelectionClear | 608 |
SelectionNotify | 609 |
SelectionRequest | 611 |
VisibilityNotify | 613 |
Changes In X And Motif Overview | 615 |
From XI1 Release 3 to Release 4 | 618 |
From XI1 Release 4 to Release 5 | 622 |
Where To Go For More Information Overview | 625 |
Mailing ListsNetNews | 627 |
The FAQs | 628 |
Getting this Books Sample Programs | 629 |
Glossary | 631 |
655 | |
Other editions - View all
Common terms and phrases
a.out application shell appshell argc argv atom Boolean XmRBoolean buffer caddr_t call_data callback cascade button child client client_data clipboard color colormap compound string Constraint contains TRUE converter created data type default value dialog box display entry field event handler event was sent example Figure focus font Function prototype header file ICCCM identified input insertion point int XmRInt interface invoked keyboard label menu bar menu choice menu pane Motif program Notify Open Software Foundation parameter pixels Pixmap pointer button position printf Program and resource protocol prototyped in Listing provides pull-down menu pushbutton resource file resource specifications root window row-column scrollbar scrolled window selection send_event server specifies tab group text editor text widget typedef struct unsigned char widget class width window manager workproc Xlib XmBulletinBoard XmCreateLabel XmForm XmLabel XmList XmManager XmPrimitive XmRowColumn XmScale XmScrollBar XmScrolledWindow XmSelectionBox XmString XmText XtAddCallback XtInitialize XtMainLoop XtManageChild XtRealizeWidget