The Definitive Guides to the X Window System Volume Four I I I X Toolkit Intrinsics Programming Manual OSF/Motif Edition by Adrian Nye and Tim O'Reilly O'Reilly & Associates, Inc. I III,AI,Y ('()PY Volume Four X Toolkit Intrinsics Programming Manual OSF/Motif 1.1 Edition for X11, Release 4 by Adrian Nye and Tim O'Reilly O'Reilly & Associates, Inc. X Protocol Reference Manual, R-4 Release, 500 pages Describes the X Network Protocol which underlies all software for Version l I of the X Window System. Xlib Programming Manual, R-4 Release, 672 pages Xlib Reference Manual, R-4 Release, 792 pages Complete programming and reference guides to the X library (Xlib), the lowest level of programming interface to X. g Window System User's Guide, R-4 Release Orients the new user to window system concepts, provides detailed tutorials for many client programs, and explains how to customize the X environment. Standard Edition, 752 pages Motif Edition, 734 pages X Toolkit Intrinsics Programming Manual, R-4 Release Complete guide to programming with Xt Intrinsics, the library of C language routines that facilitate the design of user interfaces, with reusable components called widgets. Standard Edition, 624 pages Motif Edition, 666 pages X Toolkit Intrinsics Reference Manual, R-4 Release, 776 pages Complete programmer's reference for the X Toolkit. Motif Programming Manual, Motif 1.1, 1032 pages Complete guide to programming for the Motif graphical ...
The Definitive Guides
to the X Window System
Volume Four
I I I
X Toolkit Intrinsics
Programming Manual
OSF/Motif Edition
by Adrian Nye and Tim O'Reilly
O'Reilly & Associates, Inc.
I III,AI,Y ('()PY
Volume Four
X Toolkit Intrinsics
Programming Manual
OSF/Motif 1.1 Edition
for X11, Release 4
by Adrian Nye and Tim O'Reilly
O'Reilly & Associates, Inc.
X Protocol Reference Manual, R-4 Release, 500 pages
Describes the X Network Protocol which underlies all software for Version l I of
the X Window System.
Xlib Programming Manual, R-4 Release, 672 pages
Xlib Reference Manual, R-4 Release, 792 pages
Complete programming and reference guides to the X library (Xlib), the lowest
level of programming
interface to X.
g Window System User's Guide, R-4 Release
Orients the new user to window system concepts, provides detailed tutorials for
many client programs, and
explains how to customize the X environment.
Standard Edition, 752 pages
Motif Edition, 734 pages
X Toolkit Intrinsics Programming Manual, R-4 Release
Complete guide to programming with Xt Intrinsics, the library of C language
routines that facilitate the design
of user interfaces, with reusable components called widgets.
Standard Edition, 624 pages
Motif Edition, 666 pages
X Toolkit Intrinsics Reference Manual, R-4 Release, 776 pages
Complete programmer's reference for the X Toolkit.
Motif Programming Manual, Motif 1.1, 1032 pages
Complete guide to programming for the Motif graphical user interface.
XView Programming Manual, XView Version 3.0, 768 pages
XView Reference Manual, 266 pages
Complete information on programming with XView, an easy-to-use toolkit that is
widely available.
The X Window System in a Nutshell, R-3 and R-4 Release, 380 pages A single-volume quick reference that is an indispensable companion to the
series.
Contact us for a catalog of our books, for orders, or for more information.
O'Reilly & Associates, Inc.
632 Petaluma Avenue, Sebastopol CA 95472
(800) 338-6887 US/Canada 707-829-0515 overseas/local 707-829-0104 Fax
Table of Contents
Page
Preface ........................................................................
............................................................. xxv
Summary of
Contents .......................................................................
......................................... xxv
Assumptions ....................................................................
.......................................................... xxvi
Related
Documents ......................................................................
............................................ xxvi
How to Use This
Manual .........................................................................
............................... xxvii
Font Conventions Used in This
.......... xxx
Request for
Comments .......................................................................
....................................... xxx
Bulk Sales
Information ....................................................................
........................................ xxxi
Obtaining the X Window System
Software .......................................................................
..... xxxi
Obtaining
Motif ..........................................................................
.............................................. xxxi
Obtaining the Example
Programs .......................................................................
..................... xxxi
Acknowledgments ................................................................
................................................... xxxii
1 Introduction to the X Window
System .................................................................. 3
1.1 The Server and
Client .........................................................................
.................................... 7
1.2 The Software
Hierarchy ......................................................................
................................... 9
1.3 Event-driven
PrOgramming ....................................................................
.............................. 11
1.4 The Window
Manager .......................................................................................................... 12
1.5 Extensions to
X ..............................................................................
....................................... 13
2 Introduction to the X Toolkit and
Motif ............................................................ 17
2.1 Programming with
Widgets ........................................................................
......................... 17
2.1.1 About Widget
Sets ...........................................................................
.............................. 20
2.1.2 Widget Classes and
Instances ......................................................................
................. 22
2.1.3 Widget Configurability with
Resources ......................................................................
. 25
2.1.4 Widget
Independence ...................................................................
................................. 27
2.1.5 Widget-Application
Interaction ....................................................................
............... 29
2.1.6 Xt and Object-oriented Programming
(OOP) .............................................................. 32
2.1.6.1 The
Object .........................................................................
........................................ 32
2.1.6.2
Methods ........................................................................
............................................. 33
2.1.6.3
Messages .......................................................................
............................................ 33
2.1.6.4
Encapsulation ..................................................................
.......................................... 33
2.2 Structure of Motif
Applications ...................................................................
....................... 34
2.3 A Simple X Toolkit
Application ....................................................................
...................... 35
2.3.1 The
Code ...........................................................................
............................................. 36
2.3.2 Compiling the
....................... 39
2.3.3 The App-defaults
File ...........................................................................
........................ 39
2.3.4 To Hardcode or Not to
Hardcode .......................................................................
.......... 43
2.4 Connecting Widgets to Application
Code ..........................................................................
44 2.4.1
Callbacks ......................................................................
.................................................. 45
2.5 More About
Resources ......................................................................
................................... 49
2.5.1 Setting and Getting Resources from the
Application ................................................. 49
2.5.1.1 Setting Resources with the Varargs
Interfaces ....................................................... 50
2.5.1.2 Setting Resources with the ArgList
Interfaces ....................................................... 51
2.5.1.3 Getting a Resource
Value ..........................................................................
.............. 53
2.5.2 Core
........................................ 54
2.5.3 Other Inherited
Resources ......................................................................
...................... 57
2.6 Advice on X
Programming ....................................................................
.............................. 60
3 More Techniques for Using
Widgets .................................................................... 63
3.1 Using Composite
Widgets ........................................................................
........................... 63
3.1.1 Setting Resources for an Instance
Hierarchy .............................................................. 66
3.1.2 Geometry Management in
Practice .......................................................................
....... 67
3.2 Using Constraint
............................ 71
3.3 The Standard Motif Instance
Hierarchy ......................................................................
........ 74
3.3.1 Motif Widget Creation
Routines .......................................................................
........... 75
3.3.2 Building a Main
Window .........................................................................
..................... 75
3.4 Using
Popups .........................................................................
............................................... 78
3.4.1 Creating a Basic
Menu ...........................................................................
....................... 79
3.4.2 Creating a Basic Dialog
Box ............................................................................
............ 81
3.4.3 Popup Window
Hierarchy ......................................................................
....................... 85
3.5 More About
Callbacks ......................................................................
................................... 86
3.5.1 Passing Data to Callback Functions ......................................................................
.......
87
3.5.1.1 The client_data
Argument .......................................................................
................ 87
3.5.1.2 The call_data
.................... 89
3.5.2 Callback
Lists ..........................................................................
...................................... 90
3.6 Application