Foreword
Author: Jeroen van der Zijp

The FOX Toolkit

Foreword.

FOX stands for Free Objects for X. It is a C++ based class library for building Graphical User Interfaces. Initially, it was developed for LINUX, but the scope of this project has in the course of time become somewhat more ambitious. Current aims are to make FOX completely platform independent, and thus programs written against the FOX library will be only a compile away from running on a variety of platforms.

The idea of designing and implementing something like FOX started in spring '97. In the course of using several different systems, ranging from OSF Motif, NeXTstep, MS Windows, and Intergraph's System 5, the author has developed some conception of what the ideal GUI toolkit was supposed to look like. After a couple of false starts, and some experimentation with various ideas under different platforms, FOX was born.
Because it draws from so many sources, most experienced GUI programmers will probably recognize a few of the underlying concepts; but only FOX brings all these together in one integrated system.

Some of the ideas and concepts underlying the FOX system are listed below:

- Ease of Development. Developing Graphical User Interfaces is a fairly complicated process. FOX reduces the burden on the developer significantly:

- Orthogonality. A few powerfull concepts that can be recombined in many intuitive ways is preferable to a hodge-podge of ad-hoc solutions. In a well designed orthogonal toolkit, the developer will be able to transfer knowledge gained from one scenario to another.

- Consistency. Consistent naming of member functions, consistent ordering of arguments and default parameters, as well as consistent behaviour of each Widget makes the system much more easy to learn.

- Conciseness. Every line of code not written is a correct one. So minimizing the number of lines of code to accomplish the job is a Good Thing. FOX helps with this by being able to create and initialize most Widgets with a single line of code. The C++ capability for default parameters to arguments is heavily used, and a lot of glue code to cement Widgets to each other is eliminated completely by the ability of FOX Widgets to send messages to each other.

- C++ Based. Since FOX is completely written in C++ from the ground up, developers can easily augment the basic toolkit with their own Widgets. Since FOX is not a wrapper around some legacy toolkit, these third-party Widgets are full citizens in the FOX system. Many GUI toolkits have been written before the advent of C++. Some toolkits have subsequently been repackaged into C++ wrapper libraries, to give the C++ programmer the feel of working with a C++ based toolkit. However, this approach denies users some of the benefits of C++, such as derivation and overloading to induce new behaviour, as the basic functionality is not really implemented in C++.

- Modern GUI Features. FOX provides a rich set of Widgets, and moreover, this set is easily extensible by application programmers. In the core system, several basic facilities are supported which are part and parcel of current GUI development:

- Icons and Images. FOX provides easy to use facilities for creating icons and images. Resources such as Icons and Images can be compiled into the application, and may be instantiated as needed. FOX supports both GIF and BMP image formats.
- A Registry, or persistent settings database whereby applications can save certain parameters such as recent file list, customizations, and so on.

- Tool Tips. Controls in FOX support Tool Tips or Balloon Help. When the user hovers the cursor over a button or other control, a small yellow window appears near the cursor with further information detailing the button operation.

- Status Line Help. Besides Tool Tips, FOX also supports additional help on the status line for each Control. The Status Line typically displays more extensive help information about the Control the cursor is over than a Tool Tip.

- Tab Books. Ever more sophisticated applications need considerable more screen real-estate. With Tab Books, several panels of GUI Widgets may be placed on top of each other and flipped over, similar to browsing through file folders.

- Tree Lists. Many applications need to present hierarchically organized information to a user. The FOX Tree List provides a concise view of a hierarchy, allowing users to open and close sublists with the click of a mouse.

- Multiple Document Interface (MDI) Widgets. FOX supports both Single Document Interface applications as well as Multiple Document Interface applications, by providing convenient Widget sets for this purpose.

- 3D OpenGL Widgets. FOX supports simple, as well as advanced 3D Widgets which make it easy for developers to get started writing 3D enabled applications.

- Drag and Drop. FOX supports Drag and Drop using XDND. Using drag & drop, a user can move data objects from one Widget to another, even between applications running on different machines.

- Selection. FOX supports the transfer of data between Widgets (possibly in different applications) through the X Selection mechanism.
- Clipboard Support. Ability to transfer arbitrary data structures between programs via cut & paste, even between programs running on different machines.

- Timers, Idle Processing. FOX supports both scheduled timers, i.e. pseudo-events that will cause some action to happen in the future, as well as Idle Processing, or background actions that execute while no activity is performed by the user.
- WYSIWYG Rendering. FOX's device context classes provide abstract rendering facilities which allow a single rendering code to produce output to an [user extensible] variety of output devices.
- Facilities to watch network sockets, pipes, and other i/o channels.

- GUI Updating. FOX makes it easy to keep the graphical user interface consistent with your application data structures using a unique facility called GUI Updating. In essence, the FOX Controls such as Buttons, Sliders, and so on will continuously interrogate the application and change their state; for example, from enabled to disabled, checked to unchecked, pressed or unpressed, etc.

- Target/Message Based. FOX is a target/message based system, in that all GUI events or actions are ultimately translated into messages sent between objects. As FOX Widgets are also objects, glue-code which would normally have to be written by the developer can often be eliminated by simply making one FOX Widget directly the target of another. In some cases, these messages may even be bi-directional.

- Platform Independence. Applications using FOX are not dependent directly on X-Windows. As all platform-dependencies are completely hidden from view by the FOX System (applications don't even include X-Windows header files!!), such applications will be easily ported to other platforms, simply by recompiling.

Copyright © 1997,2001 Jeroen van der Zijp, All Rights Reserved.