Gadoutline.library is intended to provide you with a means of
describing the general layout of your GUI in a
and take care of the details of determining the exact
placement of the individual elements of the display and the drudgery
of creating and managing all of the gadgets. In addition, it
- A very generalized mechanism for tracking the state of all
of its gadgets to support automatic resizing and closing and opening
of a window without loss of context.
- Automatic hotkey support.
- A vector based drawing module that can be used for everything from
drawing frames around groups of gadgets, to creating custom images
for BOOPSI gadgets, to adding complex
to a window.
- The ability to transparently use both GadTools and
BOOPSI gadgets, and to use new GadTools and BOOPSI gadgets without
having to write a single line of code.
Included with version 3 of the library will be a Postscript file
which is a tutorial on using the library
(WARNING: this file is about 1 meg),
new improved example programs,
and an additional link library (with source) for supporting multi-window
applications and standard event handling, menu and gadget actions,
preferences settings and more.
A Brief Overview
The library draws its name from the primary data structure used to
describe the entire gadget layout - a ULONG array 'outline' which is
composed of individual 'commands.' A command is used to define a
single element of the display - a gadget, the wrapper around a group
of gadgets, or an image - and additional 'control' commands are used
to control how groups are organized, provide additional information to
the library, and mark the end of the array. This array is an entirely
static structure; the library only uses it to determine the dynamic
data which is needed by the layout and after that it is never
referenced again. This brings a number of important consequences:
- An application almost never refers to the elements of the
outline in terms of pointers. While ultimately all of the
commands are referenced as normal pointers to C structures, the
application almost entirely refers to the commands and their
associated gadgets in terms of an ID code which is assigned to
the command. Every command must have either a unique ID code,
or the special "none" code of 0, and everything from assigning
hotkeys to setting a gadget's attributes uses this unique ID
code to determine which command is being refered to.
- Almost all of the information needed to create a gadget is
localized into one place in the outline array, making it much
easier to see what a gadget actually is. In addition, the layout
of the gadgets is primarily determined by their position in the
array, so it is relatively easy to understand their
relationship to the rest of the window. Moving the layout
around is as easy as using cut and paste in your text editor.
- Defining connections between objects no longer requires
absolute pointers to them. Instead, you simply include the
command ID along with the rest of the definition of your
gadget, and the library takes care of resolving the pointer when
the gadget is actually created.
- All of the tags used to define the orginal layout are
dynamically tracked by the library as the gadgets are changed
and your program makes changes, so that the layout and all of its
objects can be restored to their previous state even when closing
a window and opening it on a new screen. And because all of
the library's state tracking is based on the object's tags, new
kinds of gadgets are automatically tracked by the library.
The new version of the library now fully supports localization through
an extension to its internal "translation" hook, and using this hook
it is even possible for the caller to
design a method of removing all absolute memory references within the
static outline so that it could, for example, be loaded off disk when
needed by the application.