Preface
XView (X Window-System-based Visual/Integrated Environment for Workstations) is a
user-interface toolkit to support interactive, graphics-based applications running under the X
Window System. This toolkit, developed by Sun Microsystems, Inc., is derived from earlier
toolkits for the SunView windowing system. With over 2000 SunView applications in the
workstation market, there are many programmers already familiar with the SunView applica-
tion programmer’s interface (API).
XView has many advantages for programmers developing new applications in X, such as a
mature and proven API based on the development experience of SunView programmers. It
features an object-oriented style interface that is straightforward and simple to learn.
Like any X toolkit, XView provides a set of pre-built, user-interface objects such as can-
vases, scrollbars, menus, and control panels. The appearance and functionality of these
objects follow the OPEN LOOK Graphical User Interface (GUI) specification. Jointly devel-
oped by Sun Microsystems and AT&T as the graphical user interface standard for System V
Release 4, OPEN LOOK provides users with a simple, consistent, and efficient interface for
performing tasks within an application.
XView is based upon Xlib, the lowest level of the X Window System available to the pro-
grammer. While developing XView user interfaces does not require Xlib programming expe-
rience, there are good reasons for learning more about Xlib, especially if your application
renders graphics.
Please Read This Section!
This manual provides a basic introduction to developing applications using the XView
Toolkit. You do not need any knowledge of SunView, and prior experience with the X Win-
dow System is helpful, but also not required. Nonetheless, like any complex system, a pro-
grammer needs to know a lot to program effectively in XView.
For each functional area in XView, there are chapters that present the basic concepts and sug-
gest some common ways to implement and use a particular function. Also addressed are
some snags to watch out for when implementing certain combinations of functions. Care was
taken to keep the content of the chapters brief and to the point. Simple and straightforward
functions are not discussed in depth.
Preface
Preface xxxiii
The XView Reference Manual is a companion to this manual. It contains complete descrip-
tions for all of the XView attributes and procedures, as well as additional reference material.
The XView Programming Manual has been updated to cover XView Version 3, and includes
several appendices providing compatibility information for previous XView versions.
XView Version 3 contains many features not available in previous versions, including: a
notice package, a selection package and a drag and drop package. The new Version 3 pack-
ages are presented in the corresponding chapters in this manual.
If you can’t figure out how to accomplish a task because it is not documented here, don’t
despairthat does not mean it cannot be done. Some features in XView are not addressed in
this bookespecially the more advanced ones. You are encouraged to experiment with the
toolkit and discover new ways of using XView.
How to Use This Manual
The chapters in the book are designed to be read sequentially. However, that is not a strong
requirement. Reading ahead probably won’t affect your understanding of the material,
although later chapters might reference earlier material.
The following paragraphs briefly describe the contents of this book:
Chapter 1, XView and the X Window System, provides a conceptual overview of the X
Window System, the role of the XView Toolkit, and the
OPEN LOOK graphi-
cal user interface. It provides a general introduction to basic X terminology,
but it does not go into great detail about X.
Chapter 2, The XView Programmer’s Model, provides an overview of XView as an
object-oriented programming system. The programmer creates and modifies
objects that implement the OPEN LOOK interface. This chapter also dis-
cusses windows as objects that receive events. It introduces callback func-
tions as the method of registering application-specific event handlers.
Chapter 3, Creating XView Applications, begins from the application developer’s point
of view and explains the basic elements of an XView application. It
describes what is involved in initializing XView and creating XView objects
such as frames and subwindows.
Chapter 4, Frames, explains how to create window frames. There are two basic types of
frames: base frames and command frames. Each application has at least one
base frame that manages subwindows, panels, and other objects. It presents
the routines used to create and manage frames.
Chapter 5, Canvases and Openwin, presents canvases as the most basic type of subwin-
dow or window pane. It presents the canvas model, which permits a drawing
surface larger than what is visible in the canvas subwindow.
Chapter 6, Handling Input, explains how events are handled by X, the Notifier, and
XView objects.
xxxiv XView Programming Manual
Chapter 7, Panels, explains a variety of OPEN LOOK controls that are implemented as
items on a control panel. It demonstrates how to create and use buttons,
check boxes, choices, lists, messages, toggles, text items , and sliders. A set
of panel attributes controls the behavior in common with all panel items.
There are also item-specific attributes.
Chapter 8, Text Subwindows, describes how to create a text subwindow and how to use
its text editing features.
Chapter 9, TTY Subwindows, describes the tty subwindow that performs terminal emula-
tion functions.
Chapter 10, Scrollbars, covers the creation and use of scrollbars. A scrollbar is a window
attached to another window, such as a canvas or text subwindow or a panel.
The scrollbar package only manages the scrollbar; the application must
gauge the impact of scrolling on its windows.
Chapter 11, Menus, explains how to implement various sorts of pop-up menus.
Chapter 12, Notices, explains how pop-up windows serve as notices or dialog boxes.
Chapter 13, Cursors, shows various OPEN LOOK pointers and demonstrates their use.
Chapter 14, Icons, describes the use of bitmap images as application icons. When an
application is closed, or iconified, the application is represented on the screen
as an icon.
Chapter 15, Nonvisual Objects, describes objects that do not contain windows: Server,
Screen, and Fullscreen.
Chapter 16, Fonts, describes how to load and use fonts from the X server.
Chapter 17, Resources, describes the implications of X resources for an XView applica-
tion. Resources allow individual users to control and customize their envi-
ronment.
Chapter 18, Selections, discusses how XView applications communicate with other appli-
cations, including window managers and applications that are not OPEN
LOOK-compliant. It shows how XView provides for selections according to
the Inter-Client Communication Conventions Manual.
Chapter 19, Drag and Drop, discusses how XView applications implement dragging and
dropping, where data is transferred by selecting an item and moving it to
another workspace location. This is one method XView provides for applica-
tions to communicate with other applications.
Chapter 20, The Notifier, describes the Notifier and advanced event handling. It
describes the relationship of the Notifier and X to the host operating system.
Chapter 21, Color, discusses issues concerning color in windows and other XView
objects.
Chapter 22, Internationalization, discusses the internationalization features of XView.
Chapter 23, Help Facilities, discusses the help mechanism available in XView packages.
Preface
Preface xxxv
Chapter 24, Error Recovery, discusses error handling in XView packages.
Chapter 25, XView Internals, discusses the internals to the XView packages and intro-
duces the concepts involved in writing your own packages.
Appendix A, The Selection Service, describes the selection service which provides compa-
tibility with older versions of XView that did not have a SELECTION Pack-
age.
Appendix B, Notices, describes the notice procedure notice_prompt() which pro-
vides compatibility with older versions of XView that did not have a NOTICE
Package.
Appendix C, Mouseless Model Keyboard Mappings, presents the mouseless model key-
board mappings.
Appendix D, XView Version 3.2 Additions, describes the changes and additions for XView
Version 3.2, including the File Chooser documentation.
Appendix E, OPEN LOOK User Interface Compliance, discusses XView’s compliance with
the OPEN LOOK GUI Functional Specification.
Appendix F, Example Programs, presents supplementary programs.
Assumptions
Readers should be proficient in the C programming language, although examples are pro-
vided for infrequently used features of the language that are necessary or useful when pro-
gramming with X. In addition, general familiarity with the principles of raster graphics is
helpful. Finally, if you do not understand how to use Xlib routines to render graphics, then
writing useful programs might be difficult, although you should be able to build OPEN LOOK
user interfaces easily.
Font Conventions Used in This Manual
Italic is used for:
UNIX pathnames, filenames, program names, user command names, and options
for user commands.
New terms where they are introduced.
Typewriter Font is used for:
Anything that would be typed verbatim into code, such as examples of source
code and text on the screen.
xxxvi XView Programming Manual
XView packages.*
The contents of include files, such as structure types, structure members, sym-
bols (defined constants and bit flags), and macros.
XView and Xlib functions.
Names of subroutines of the example programs.
Italic Typewriter Font
is used for:
Arguments to XView functions, since they could be typed in code as shown but
are arbitrary.
Helvetica Italics
are used for:
Titles of examples, figures, and tables.
Boldface is used for:
Chapter and section headings.
Related Documents
The C Programming Language by B. W. Kernighan and D. M. Ritchie
The following documents are included on the X11 source tape and are also available from
Sun Microsystems, Inc. and Addison-Wesley Publishing Company, Inc.:
OPEN LOOK Graphical User Interface Functional Specification
OPEN LOOK Graphical User Interface Style Guide
The following books in the X Window System series from O’Reilly and Associates, Inc. are
currently available:
Volume Zero — X Protocol Reference Manual
Volume One — Xlib Programming Manual
Volume Two — Xlib Reference Manual
Volume Three — X Window System User’s Guide
Volume Four — X Toolkit Intrinsics Programming Manual
Volume Five — X Toolkit Intrinsics Reference Manual
Volume Six — Motif Programming Manual
Quick Reference The X Window System in a Nutshell
*When referring to all members of a particular package, such as CANVAS, the notation CANVAS_* will be used.
This should not be interpreted as a C-language pointer construct.
Preface
Preface xxxvii

Get Volume 7A: XView Programming Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.