# Introduction to FLTK

This manual describes the Fast Light Tool Kit ("FLTK") version 2.0, a C++ Graphical User Interface (GUI) toolkit for UNIX and Microsoft Windows. Each of the chapters in this manual is designed as a tutorial for using FLTK, while the appendices provide a convenient reference for all FLTK widgets, functions, and operating system interfaces.

The Fast Light Tool Kit ("FLTK", pronounced "fulltick") is a LGPL'd C++ graphical user interface toolkit for X (UNIX®), OpenGL®, and Microsoft® Windows® NT 4.0, 95, or 98. It was originally developed by Mr. Bill Spitzak and is currently maintained by a small group of developers across the world with a central repository in the US.

## Copyrights and Trademarks

FLTK is ©1998-2003 by Bill Spitzak and others. Use and distribution of FLTK is governed by the FLTK Library License (which is the GNU Library General Public License with an exception added that allows you to distribute statically-linked programs using the library without providing source code to the program or the library).

UNIX is a registered trademark of the X Open Group, Inc. Microsoft and Windows are registered trademarks of Microsoft Corporation. OpenGL is a registered trademark of Silicon Graphics, Inc.

## Features

FLTK was designed to be statically linked. This was done by splitting it into many small objects and desigining it so that functions that are not used do not have pointers to them in the parts that are used, and thus do not get linked in. This allows you to make an easy-to-install program, or to modify FLTK to the exact requirements of your application, without worrying about bloat. FLTK works fine as a shared library, though, and has started being included on Linux distributions.

Here are some of the core features unique to FLTK:

- sizeof(fltk::Widget) == 60.
- The "core" (the "hello" program compiled & linked with a static FLTK library using gcc on a 486 and then stripped) is 82K.
- The FLUID program (which includes every widget) is 352k.
- Written directly atop Xlib (or WIN32) for maximum speed, and carefully optimized for code size and performance.
- Precise low-level compatability between the X11 and WIN32 version (only about 10% of the code is different).
- Interactive user interface builder program. Output is human-readable and editable C++ source code.
- Support for X11 overlay hardware (emulation if none and under WIN32.)
- Very small & fast portable 2-D drawing library with PostScript style functions, to hide Xlib and WIN32.
- OpenGL/Mesa drawing area widget.
- Support for OpenGL overlay hardware on both X11 and WIN32. Emulation if none.
- Text input fields with Emacs key bindings, X cut & paste, and foreign letter compose!
- Compatibility header file for the GLUT library.
- Compatibility header file for the XForms library.
- Much too much to list here...

## Licensing

FLTK comes with complete free source code. FLTK is ©1998-2003 by Bill Spitzak and others. Use and distribution of FLTK is governed by the FLTK Library License (which is the GNU Library General Public License with an exception added that allows you to distribute statically-linked programs using the library without providing source code to the program or the library). You can use it in commercial software!

## What Does "FLTK" Mean?

FLTK was originally designed to be compatible with the Forms Library written for SGI machines. In that library all the functions and structures started with "fltk::". This naming was extended to all new methods and widgets in the C++ library, and this prefix was taken as the name of the library. It is almost impossible to search for "FL" on the Internet, due to the fact that it is also the abbreviation for Florida. After much debating and searching for a new name for the toolkit, which was already in use by several people, Bill came up with "FLTK", and even a bogus excuse that it stands for "The Fast Light Tool Kit".

## History of FLTK

It has always been Bill's belief that the "operating system" does not have to provide any of what people call "GUI". Toolkits (even FLTK) are not what should be provided, the system only has to provide arbitrary shaped but featureless windows, a powerful set of graphics drawing calls, and a simple, unalterable method of delivering events to the owners of the windows. Much of the design of FLTK is to prove that complex UI ideas could be entirely implemented in a user space toolkit, with no knowledge or support by the system.

Many of the ideas in FLTK were developed on a NeXT (but not using NextStep) in 1987 in a C toolkit Bill called "viewkit". Here he came up with passing events downward in the tree and having the handle routine return a value indicating they used the event, which got rid of the need for "interests" that so complicated Motif and NeWS.

After going to film school for a few years, Bill worked at Sun Microsystems on the (doomed) NeWS project. Here he found an even better and cleaner windowing system, and he reimplemented "viewkit" atop that. NeWS did have an unnecessarily complex method of delivering events which hurt it. But the designers did admit that perhaps the user could write just as good of a button as they could, and officially exposed the lower level interface.

With the death of NeWS Bill realized that he would have to live with X. The biggest problem with X is the "window manager", which means that the toolkit can no longer control the window borders or drag the window around. Indeed far more code is spent trying to talk to window managers than would be needed to draw the borders themselves. (fortunately the problems with X are also replicated on Windows, and thus solving them helped with the porting to Windows).

At Digital Domain Bill discovered another toolkit, "Forms". Forms was similar to his work, but provided many more widgets, since it was used in many real applications, rather then as theoretical work. Several large pieces of software were written using a version of Forms with the menus and file browser replaced with code from viewkit.

The need to switch to OpenGL, a desire to use C++, and the closed-source nature of XForms, all led to a rquirement to rewrite Forms. This produced the first version of FLTK. The conversion to C++ required so many changes it made it impossible to recompile any Forms objects. Since it was incompatible anyway, Bill decided to incorporate his older ideas as much as possible.

Bill received permission to release it for free on the Internet, with the GNU general public license. Response from Internet users indicated that the Linux market dwarfed the SGI and high-speed GL market, so he rewrote it to use X for all drawing, greatly speeding it up on these machines. That is the version you have now.

## Internet Resources

FLTK is available on the 'net in a bunch of locations:

WWW
  http://www.fltk.org
  http://fltk.sourceforge.net
FTP
  ftp://ftp.fltk.org/pub/fltk
  ftp://ftp.easysw.com/pub/fltk
  ftp://ftp.funet.fi/mirrors/ftp.easysw.com/pub/fltk
  ftp.northamerica.net/pub/ESP/fltk
EMail
  fltk@fltk.org [see instructions below]
  fltk-bugs@fltk.org [for reporting bugs]

To send a message to the FLTK mailing list fltk@fltk.org you must first join the list. Non-member submissions are blocked to avoid problems with unsolicited email.

To join the FLTK mailing list, send a message to majordomo@fltk.org with "subscribe fltk" in the message body. A digest of this list is available by subscribing to the "fltk-digest" mailing list.

## Reporting Bugs

To report a bug in FLTK, send an email to fltk-bugs@fltk.org Please include the FLTK version, operating system & version, and compiler that you are using when describing the bug or problem.

For general support and questions, please use the FLTK mailing list at fltk@fltk.org.