1 | <HTML> |
---|
2 | <HEAD> |
---|
3 | <TITLE>1 - Introduction to FLTK</TITLE> |
---|
4 | </HEAD> |
---|
5 | <BODY> |
---|
6 | |
---|
7 | <H1 ALIGN="RIGHT"><A NAME="intro">1 - Introduction to FLTK</A></H1> |
---|
8 | |
---|
9 | <P>The Fast Light Tool Kit ("FLTK", pronounced |
---|
10 | "fulltick") is a cross-platform C++ GUI toolkit for |
---|
11 | UNIX®/Linux® (X11), Microsoft® Windows®, and |
---|
12 | MacOS® X. FLTK provides modern GUI functionality without the |
---|
13 | bloat and supports 3D graphics via OpenGL® and its built-in |
---|
14 | GLUT emulation. It was originally developed by Mr. Bill Spitzak |
---|
15 | and is currently maintained by a small group of developers |
---|
16 | across the world with a central repository in the US.</P> |
---|
17 | |
---|
18 | <H2>History of FLTK</H2> |
---|
19 | |
---|
20 | <P>It has always been Bill's belief that the GUI API of all |
---|
21 | modern systems is much too high level. Toolkits (even FLTK) are |
---|
22 | <I>not</I> what should be provided and documented as part of an |
---|
23 | operating system. The system only has to provide arbitrary |
---|
24 | shaped but featureless windows, a powerful set of graphics |
---|
25 | drawing calls, and a simple <I>unalterable</I> method of |
---|
26 | delivering events to the owners of the windows. NeXT (if you |
---|
27 | ignored NextStep) provided this, but they chose to hide it and |
---|
28 | tried to push their own baroque toolkit instead.</P> |
---|
29 | |
---|
30 | <P>Many of the ideas in FLTK were developed on a NeXT (but |
---|
31 | <I>not</I> using NextStep) in 1987 in a C toolkit Bill called |
---|
32 | "views". Here he came up with passing events downward |
---|
33 | in the tree and having the handle routine return a value |
---|
34 | indicating whether it used the event, and the table-driven menus. In |
---|
35 | general he was trying to prove that complex UI ideas could be |
---|
36 | entirely implemented in a user space toolkit, with no knowledge |
---|
37 | or support by the system.</P> |
---|
38 | |
---|
39 | <P>After going to film school for a few years, Bill worked at |
---|
40 | Sun Microsystems on the (doomed) NeWS project. Here he found an |
---|
41 | even better and cleaner windowing system, and he reimplemented |
---|
42 | "views" atop that. NeWS did have an unnecessarily |
---|
43 | complex method of delivering events which hurt it. But the |
---|
44 | designers did admit that perhaps the user could write just as |
---|
45 | good of a button as they could, and officially exposed the lower |
---|
46 | level interface.</P> |
---|
47 | |
---|
48 | <P>With the death of NeWS Bill realized that he would have to |
---|
49 | live with X. The biggest problem with X is the "window |
---|
50 | manager", which means that the toolkit can no longer |
---|
51 | control the window borders or drag the window around.</P> |
---|
52 | |
---|
53 | <P>At Digital Domain Bill discovered another toolkit, |
---|
54 | "Forms". Forms was similar to his work, but provided |
---|
55 | many more widgets, since it was used in many real applications, |
---|
56 | rather then as theoretical work. He decided to use Forms, except |
---|
57 | he integrated his table-driven menus into it. Several very large |
---|
58 | programs were created using this version of Forms.</P> |
---|
59 | |
---|
60 | <P>The need to switch to OpenGL and GLX, portability, and a |
---|
61 | desire to use C++ subclassing required a rewrite of Forms. |
---|
62 | This produced the first version of FLTK. The conversion to C++ |
---|
63 | required so many changes it made it impossible to recompile any |
---|
64 | Forms objects. Since it was incompatible anyway, Bill decided |
---|
65 | to incorporate his older ideas as much as possible by |
---|
66 | simplifying the lower level interface and the event passing |
---|
67 | mechanism.</P> |
---|
68 | |
---|
69 | <P>Bill received permission to release it for free on the |
---|
70 | Internet, with the GNU general public license. Response from |
---|
71 | Internet users indicated that the Linux market dwarfed the SGI |
---|
72 | and high-speed GL market, so he rewrote it to use X for all |
---|
73 | drawing, greatly speeding it up on these machines. That is the |
---|
74 | version you have now.</P> |
---|
75 | |
---|
76 | <P>Digital Domain has since withdrawn support for FLTK. While |
---|
77 | Bill is no longer able to actively develop it, he still |
---|
78 | contributes to FLTK in his free time and is a part of the FLTK |
---|
79 | development team.</P> |
---|
80 | |
---|
81 | <H2>Features</H2> |
---|
82 | |
---|
83 | <P>FLTK was designed to be statically linked. This was done by |
---|
84 | splitting it into many small objects and designing it so that |
---|
85 | functions that are not used do not have pointers to them in the |
---|
86 | parts that are used, and thus do not get linked in. This allows |
---|
87 | you to make an easy-to-install program or to modify FLTK to |
---|
88 | the exact requirements of your application without worrying |
---|
89 | about bloat. FLTK works fine as a shared library, though, and |
---|
90 | is now included with several Linux distributions.</P> |
---|
91 | |
---|
92 | <P>Here are some of the core features unique to FLTK:</P> |
---|
93 | |
---|
94 | <UL> |
---|
95 | |
---|
96 | <LI>sizeof(Fl_Widget) == 64 to 92.</LI> |
---|
97 | |
---|
98 | <LI>The "core" (the "hello" program |
---|
99 | compiled & linked with a static FLTK library using |
---|
100 | gcc on a 486 and then stripped) is 114K.</LI> |
---|
101 | |
---|
102 | <LI>The FLUID program (which includes every widget) is |
---|
103 | 538k.</LI> |
---|
104 | |
---|
105 | <LI>Written directly atop core libraries (Xlib, WIN32 or |
---|
106 | Carbon) for maximum speed, and carefully optimized for |
---|
107 | code size and performance.</LI> |
---|
108 | |
---|
109 | <LI>Precise low-level compatability between the X11, |
---|
110 | WIN32 and MacOS versions - only about 10% of the code is |
---|
111 | different.</LI> |
---|
112 | |
---|
113 | <LI>Interactive user interface builder program. Output is |
---|
114 | human-readable and editable C++ source code.</LI> |
---|
115 | |
---|
116 | <LI>Support for overlay hardware, with emulation if none |
---|
117 | is available.</LI> |
---|
118 | |
---|
119 | <LI>Very small & fast portable 2-D drawing library |
---|
120 | to hide Xlib, WIN32, or QuickDraw.</LI> |
---|
121 | |
---|
122 | <LI>OpenGL/Mesa drawing area widget.</LI> |
---|
123 | |
---|
124 | <LI>Support for OpenGL overlay hardware on both X11 and |
---|
125 | WIN32, with emulation if none is available.</LI> |
---|
126 | |
---|
127 | <LI>Text widgets with Emacs key bindings, X cut & |
---|
128 | paste, and foreign letter compose!</LI> |
---|
129 | |
---|
130 | <LI>Compatibility header file for the GLUT library.</LI> |
---|
131 | |
---|
132 | <LI>Compatibility header file for the XForms library.</LI> |
---|
133 | |
---|
134 | </UL> |
---|
135 | |
---|
136 | <H2>Licensing</H2> |
---|
137 | |
---|
138 | <P>FLTK comes with complete free source code. FLTK is available |
---|
139 | under the terms of the <A href="license.html">GNU Library |
---|
140 | General Public License</A> with exceptions that allow for static |
---|
141 | linking. Contrary to popular belief, it can be used in |
---|
142 | commercial software - even Bill Gates could use it!</P> |
---|
143 | |
---|
144 | <H2>What Does "FLTK" Mean?</H2> |
---|
145 | |
---|
146 | <P>FLTK was originally designed to be compatible with the Forms |
---|
147 | Library written for SGI machines. In that library all the |
---|
148 | functions and structures started with "fl_". This |
---|
149 | naming was extended to all new methods and widgets in the C++ |
---|
150 | library, and this prefix was taken as the name of the library. |
---|
151 | It is almost impossible to search for "FL" on the |
---|
152 | Internet, due to the fact that it is also the abbreviation for |
---|
153 | Florida. After much debating and searching for a new name for |
---|
154 | the toolkit, which was already in use by several people, Bill |
---|
155 | came up with "FLTK", including a bogus excuse that it |
---|
156 | stands for "The Fast Light Toolkit".</P> |
---|
157 | |
---|
158 | <H2>Building and Installing FLTK Under UNIX and MacOS X</H2> |
---|
159 | |
---|
160 | <P>In most cases you can just type "make". This will |
---|
161 | run configure with the default of no options and then compile |
---|
162 | everything.</P> |
---|
163 | |
---|
164 | <P>FLTK uses GNU autoconf to configure itself for your UNIX |
---|
165 | platform. The main things that the configure script will look |
---|
166 | for are the X11 and OpenGL (or Mesa) header and library files. |
---|
167 | If these cannot be found in the standard include/library |
---|
168 | locations you'll need to define the <tt>CFLAGS</tt>, |
---|
169 | <tt>CXXFLAGS</tt>, and <tt>LDFLAGS</tt> environment variables. |
---|
170 | For the Bourne and Korn shells you'd use:</P> |
---|
171 | |
---|
172 | <UL><PRE> |
---|
173 | CFLAGS=-I<I>includedir</I>; export CFLAGS |
---|
174 | CXXFLAGS=-I<I>includedir</I>; export CXXFLAGS |
---|
175 | LDFLAGS=-L<I>libdir</I>; export LDFLAGS |
---|
176 | </PRE></UL> |
---|
177 | |
---|
178 | <P>For C shell and tcsh, use:</P> |
---|
179 | |
---|
180 | <UL><PRE> |
---|
181 | setenv CFLAGS "-I<I>includedir</I>" |
---|
182 | setenv CXXFLAGS "-I<I>includedir</I>" |
---|
183 | setenv LDFLAGS "-L<I>libdir</I>" |
---|
184 | </PRE></UL> |
---|
185 | |
---|
186 | <P>By default configure will look for a C++ compiler named |
---|
187 | <tt>CC</tt>, <tt>c++</tt>, <tt>g++</tt>, or <tt>gcc</tt> in that |
---|
188 | order. To use another compiler you need to set the <tt>CXX</tt> |
---|
189 | environment variable:</P> |
---|
190 | |
---|
191 | <UL><PRE> |
---|
192 | CXX=xlC; export CXX |
---|
193 | setenv CXX "xlC" |
---|
194 | </PRE></UL> |
---|
195 | |
---|
196 | <P>The <tt>CC</tt> environment variable can also be used to |
---|
197 | override the default C compiler (<tt>cc</tt> or <tt>gcc</tt>), |
---|
198 | which is used for a few FLTK source files.</P> |
---|
199 | |
---|
200 | <P>You can run configure yourself to get the exact setup you |
---|
201 | need. Type "./configure <options>", where |
---|
202 | options are:</P> |
---|
203 | |
---|
204 | <DL> |
---|
205 | |
---|
206 | <DT>--enable-cygwin</DT> |
---|
207 | <DD>Enable the Cygwin libraries under WIN32</DD> |
---|
208 | |
---|
209 | <DT>--enable-debug</DT> |
---|
210 | <DD>Enable debugging code & symbols</DD> |
---|
211 | |
---|
212 | <DT>--disable-gl</DT> |
---|
213 | <DD>Disable OpenGL support</DD> |
---|
214 | |
---|
215 | <DT>--enable-shared</DT> |
---|
216 | <DD>Enable generation of shared libraries</DD> |
---|
217 | |
---|
218 | <DT>--enable-threads</DT> |
---|
219 | <DD>Enable multithreading support</DD> |
---|
220 | |
---|
221 | <DT>--enable-xdbe</DT> |
---|
222 | <DD>Enable the X double-buffer extension</DD> |
---|
223 | |
---|
224 | <DT>--enable-xft</DT> |
---|
225 | <DD>Enable the Xft library for anti-aliased fonts under X11</DD> |
---|
226 | |
---|
227 | <DT>--bindir=/path</DT> |
---|
228 | <DD>Set the location for executables [default = $prefix/bin]</DD> |
---|
229 | |
---|
230 | <DT>--datadir=/path</DT> |
---|
231 | <DD>Set the location for data files. [default = $prefix/share]</DD> |
---|
232 | |
---|
233 | <DT>--libdir=/path</DT> |
---|
234 | <DD>Set the location for libraries [default = $prefix/lib]</DD> |
---|
235 | |
---|
236 | <DT>--includedir=/path</DT> |
---|
237 | <DD>Set the location for include files. [default = $prefix/include]</DD> |
---|
238 | |
---|
239 | <DT>--mandir=/path</DT> |
---|
240 | <DD>Set the location for man pages. [default = $prefix/man]</DD> |
---|
241 | |
---|
242 | <DT>--prefix=/dir</DT> |
---|
243 | <DD>Set the directory prefix for files [default = /usr/local]</DD> |
---|
244 | |
---|
245 | </DL> |
---|
246 | |
---|
247 | <P>When the configure script is done you can just run the |
---|
248 | "make" command. This will build the library, FLUID |
---|
249 | tool, and all of the test programs.</P> |
---|
250 | |
---|
251 | <P>To install the library, become root and type "make |
---|
252 | install". This will copy the "fluid" executable |
---|
253 | to "bindir", the header files to |
---|
254 | "includedir", and the library files to |
---|
255 | "libdir".</P> |
---|
256 | |
---|
257 | <H2>Building FLTK Under Microsoft Windows</H2> |
---|
258 | |
---|
259 | <P>There are three ways to build FLTK under Microsoft Windows. |
---|
260 | The first is to use the Visual C++ 5.0 project files under the |
---|
261 | "visualc" directory. Just open (or double-click on) |
---|
262 | the "fltk.dsw" file to get the whole shebang.</P> |
---|
263 | |
---|
264 | <P>The second method is to use the <TT>configure</TT> script |
---|
265 | included with the FLTK software; this has only been tested with |
---|
266 | the CygWin tools:</P> |
---|
267 | |
---|
268 | <UL><PRE> |
---|
269 | sh configure --prefix=C:/FLTK |
---|
270 | make |
---|
271 | </PRE></UL> |
---|
272 | |
---|
273 | <P>The final method is to use a GNU-based development tool with |
---|
274 | the files in the "makefiles" directory. To build |
---|
275 | using one of these tools simply copy the appropriate |
---|
276 | makeinclude and config files to the main directory and do a |
---|
277 | make:</P> |
---|
278 | |
---|
279 | <UL><PRE> |
---|
280 | copy makefiles\Makefile.<env> Makefile |
---|
281 | make |
---|
282 | </PRE></UL> |
---|
283 | |
---|
284 | <H3>Using the Visual C++ DLL Library</H3> |
---|
285 | |
---|
286 | <P>The "fltkdll.dsp" project file builds a DLL-version |
---|
287 | of the FLTK library. Because of name mangling differences |
---|
288 | between PC compilers (even between different versions of Visual |
---|
289 | C++!) you can only use the DLL that is generated with the same |
---|
290 | version compiler that you built it with.</P> |
---|
291 | |
---|
292 | <P>When compiling an application or DLL that uses the FLTK DLL, |
---|
293 | you will need to define the <tt>FL_DLL</tt> preprocessor symbol |
---|
294 | to get the correct linkage commands embedded within the FLTK |
---|
295 | header files.</P> |
---|
296 | |
---|
297 | <H2>Building FLTK Under OS/2</H2> |
---|
298 | |
---|
299 | <P>The current OS/2 build requires XFree86 for OS/2 to work. A |
---|
300 | native Presentation Manager version has not been implemented |
---|
301 | yet (volunteers are welcome!).</P> |
---|
302 | |
---|
303 | <p>The current set of Makefiles/configuration failes assumes that |
---|
304 | EMX 0.9d and libExt |
---|
305 | (from <A HREF="http://posix2.sourceforge.net">posix2.sourceforge.net</A>) |
---|
306 | is installed. |
---|
307 | |
---|
308 | <P>To build the XFree86 version of FLTK for OS/2, copy the appropriate |
---|
309 | makeinclude and config files to the main directory and do a make: </P> |
---|
310 | |
---|
311 | <UL><PRE> |
---|
312 | copy makefiles\Makefile.os2x Makefile |
---|
313 | make |
---|
314 | </PRE></UL> |
---|
315 | |
---|
316 | <H2>Internet Resources</H2> |
---|
317 | |
---|
318 | <P>FLTK is available on the 'net in a bunch of locations:</P> |
---|
319 | |
---|
320 | <DL> |
---|
321 | |
---|
322 | <DT>WWW |
---|
323 | <DD><A href="http://www.fltk.org/">http://www.fltk.org/</A> |
---|
324 | <DD><A href="http://www.fltk.org/str.php">http://www.fltk.org/str.php</A> |
---|
325 | [for reporting bugs] |
---|
326 | <DD><A href="http://www.fltk.org/software.php">http://www.fltk.org/software.php</A> |
---|
327 | [source code] |
---|
328 | |
---|
329 | <DT>FTP |
---|
330 | <DD><A HREF="http://ftp.easysw.com/pub/fltk">California, USA, (http://ftp.easysw.com)</A> |
---|
331 | <DD><A HREF="ftp://ftp.easysw.com/pub/fltk">California, USA (ftp://ftp.easysw.com)</A> |
---|
332 | <DD><A HREF="ftp://ftp2.easysw.com/pub/fltk">Maryland, USA (ftp2.easysw.com)</A> |
---|
333 | <DD><A HREF="ftp://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub/fltk">Espoo, Finland (ftp.funet.fi)</A> |
---|
334 | <DD><A HREF="ftp://linux.mathematik.tu-darmstadt.de/pub/linux/mirrors/misc/fltk">Germany (linux.mathematik.tu-darmstadt.de)</A> |
---|
335 | <DD><A HREF="ftp://gd.tuwien.ac.at/hci/fltk">Austria (gd.tuwien.ac.at)</A> |
---|
336 | |
---|
337 | <DT>EMail</DT> |
---|
338 | <DD><A href="mailto:fltk@fltk.org">fltk@fltk.org</A> [see |
---|
339 | instructions below] |
---|
340 | <DD><A href="mailto:fltk-bugs@fltk.org">fltk-bugs@fltk.org</A> [for |
---|
341 | reporting bugs] |
---|
342 | |
---|
343 | <DT>NNTP Newsgroups</DT> |
---|
344 | <DD>news.easysw.com</DD> |
---|
345 | |
---|
346 | </DL> |
---|
347 | |
---|
348 | <P>To send a message to the FLTK mailing list |
---|
349 | ("fltk@fltk.org") you must first join the list. |
---|
350 | Non-member submissions are blocked to avoid problems with |
---|
351 | unsolicited email.</P> |
---|
352 | |
---|
353 | <P>To join the FLTK mailing list, send a message to |
---|
354 | "majordomo@fltk.org" with "subscribe fltk" |
---|
355 | in the message body. A digest of this list is available by |
---|
356 | subscribing to the "fltk-digest" mailing list.</P> |
---|
357 | |
---|
358 | <H2>Reporting Bugs</H2> |
---|
359 | |
---|
360 | <P>To report a bug in FLTK, send an email to |
---|
361 | "fltk-bugs@fltk.org". Please include the FLTK version, |
---|
362 | operating system & version, and compiler that you are using |
---|
363 | when describing the bug or problem. We will be unable to provide |
---|
364 | any kind of help without that basic information.</P> |
---|
365 | |
---|
366 | <P>Bugs can also be reported to the "fltk.bugs" newsgroup or on the |
---|
367 | SourceForge bug tracker pages.</P> |
---|
368 | |
---|
369 | <P>For general support and questions, please use the FLTK mailing list |
---|
370 | at "fltk@fltk.org" or one of the newsgroups.</P> |
---|
371 | |
---|
372 | </BODY> |
---|
373 | </HTML> |
---|