1/**
2
3 \page	examples	Example Source Code
4
5The FLTK distribution contains over 60 sample applications written
6in, or ported to, FLTK. If the FLTK archive you received does not
7contain either an 'examples' or 'test' directory, you can download
8the complete FLTK distribution from \b http://fltk.org/software.php .
9
10Most of the example programs were created while testing a group of widgets.
11They are not meant to be great achievements in clean C++ programming, but
12merely a test platform to verify the functionality of the FLTK library.
13
14Note that extra example programs are also available in an additional
15'examples' directory, but these are \b NOT built automatically when
16you build FLTK, unlike those in the 'test' directory shown below.
17
18\section example_applications  Example Applications
19
20<table width=100% border=0>
21<tr>
22<td> \ref examples_adjuster        </td>
23<td> \ref examples_arc             </td>
24<td> \ref examples_ask             </td>
25<td> \ref examples_bitmap          </td>
26<td> \ref examples_blocks          </td>
27<td> \ref examples_boxtype         </td>
28</tr>
29<tr>
30<td> \ref examples_browser         </td>
31<td> \ref examples_button          </td>
32<td> \ref examples_buttons         </td>
33<td> \ref examples_checkers        </td>
34<td> \ref examples_clock           </td>
35<td> \ref examples_colbrowser      </td>
36</tr>
37<tr>
38<td> \ref examples_color_chooser   </td>
39<td> \ref examples_cube            </td>
40<td> \ref examples_CubeView        </td>
41<td> \ref examples_cursor          </td>
42<td> \ref examples_curve           </td>
43<td> \ref examples_demo            </td>
44</tr>
45<tr>
46<td> \ref examples_device       </td>
47<td> \ref examples_doublebuffer    </td>
48<td> \ref examples_editor          </td>
49<td> \ref examples_fast_slow       </td>
50<td> \ref examples_file_chooser    </td>
51<td> \ref examples_fluid           </td>
52</tr>
53<tr>
54<td> \ref examples_fonts           </td>
55<td> \ref examples_forms           </td>
56<td> \ref examples_fractals        </td>
57<td> \ref examples_fullscreen      </td>
58<td> \ref examples_gl_overlay      </td>
59<td> \ref examples_glpuzzle        </td>
60</tr>
61<tr>
62<td> \ref examples_hello           </td>
63<td> \ref examples_help_dialog     </td>
64<td> \ref examples_iconize         </td>
65<td> \ref examples_image           </td>
66<td> \ref examples_inactive        </td>
67<td> \ref examples_input           </td>
68</tr>
69<tr>
70<td> \ref examples_input_choice    </td>
71<td> \ref examples_keyboard        </td>
72<td> \ref examples_label           </td>
73<td> \ref examples_line_style      </td>
74<td> \ref examples_list_visuals    </td>
75<td> \ref examples_mandelbrot      </td>
76</tr>
77<tr>
78<td> \ref examples_menubar         </td>
79<td> \ref examples_message         </td>
80<td> \ref examples_minimum         </td>
81<td> \ref examples_navigation      </td>
82<td> \ref examples_output          </td>
83<td> \ref examples_overlay         </td>
84</tr>
85<tr>
86<td> \ref examples_pack            </td>
87<td> \ref examples_pixmap_browser  </td>
88<td> \ref examples_pixmap          </td>
89<td> \ref examples_preferences     </td>
90<td> \ref examples_radio           </td>
91<td> \ref examples_resizebox       </td>
92</tr>
93<tr>
94<td> \ref examples_resize          </td>
95<td> \ref examples_scroll          </td>
96<td> \ref examples_shape           </td>
97<td> \ref examples_subwindow       </td>
98<td> \ref examples_sudoku          </td>
99<td> \ref examples_symbols         </td>
100</tr>
101<tr>
102<td> \ref examples_tabs            </td>
103<td> \ref examples_threads         </td>
104<td> \ref examples_tile            </td>
105<td> \ref examples_tiled_image     </td>
106<td> \ref examples_unittests       </td>
107<td> \ref examples_utf8            </td>
108</tr>
109<tr>
110<td> \ref examples_valuators       </td>
111</tr>
112</table>
113
114\subsection examples_adjuster adjuster
115
116\par
117\c adjuster shows a nifty little widget for quickly
118setting values in a great range.
119
120\subsection examples_arc arc
121
122\par
123The \c arc demo explains how to derive your own widget to
124generate some custom drawings. The sample drawings use the matrix
125based arc drawing for some fun effects.
126
127\subsection examples_ask ask
128
129\par
130\c ask shows some of FLTK's standard dialog boxes. Click
131the correct answers or you may end up in a loop, or you may end
132up in a loop, or you... .
133
134\subsection examples_bitmap bitmap
135
136\par
137This simple test shows the use of a single color bitmap as a
138label for a box widget. Bitmaps are stored in the X11 '.bmp'
139file format and can be part of the source code.
140
141\subsection examples_blocks blocks
142
143\par
144A wonderful and addictive game that shows the usage of FLTK
145timers, graphics, and how to implement sound on all platforms.
146\c blocks is also a good example for the Mac OS X specific
147bundle format.
148
149\subsection examples_boxtype boxtype
150
151\par
152\c boxtype gives an overview of readily available boxes and
153frames in FLTK. More types can be added by the application programmer.
154When using themes, FLTK shuffles boxtypes around to give your program
155a new look.
156
157\subsection examples_browser browser
158
159\par
160\c browser shows the capabilities of the Fl_Browser widget.
161Important features tested are loading of files, line formatting, and
162correct positioning of the browser data window.
163
164\subsection examples_button button
165
166\par
167The \c button test is a simple demo of push-buttons and callbacks.
168
169\subsection examples_buttons buttons
170
171\par
172\c buttons shows a sample of FLTK button types.
173
174\subsection examples_checkers checkers
175
176\par
177Written by Steve Poulsen in early 1979, \c checkers shows
178how to convert a VT100 text-terminal based program into a neat
179application with a graphical UI. Check out the code that drags the
180pieces, and how the pieces are drawn by layering. Then tell me
181how to beat the computer at Checkers.
182
183\subsection examples_clock clock
184
185\par
186The \c clock demo shows two analog clocks. The innards of
187the Fl_Clock widget are pretty interesting, explaining
188the use of timeouts and matrix based drawing.
189
190\subsection examples_colbrowser colbrowser
191
192\par
193\c colbrowser runs only on X11 systems. It reads
194<i>/usr/lib/X11/rgb.txt</i> to show the color representation
195of every text entry in the file. This is beautiful, but
196only moderately useful unless your UI is written in <i>Motif</i>.
197
198\subsection examples_color_chooser color_chooser
199
200\par
201The \c color_chooser gives a short demo of FLTK's palette based
202color chooser and of the RGB based color wheel.
203
204\subsection examples_cube cube
205
206\par
207The \c cube demo shows the speed of OpenGL. It also tests
208the ability to render two OpenGL buffers into a single window,
209and shows OpenGL text.
210
211\subsection examples_CubeView CubeView
212
213\par
214\c CubeView shows how to create a UI containing OpenGL with Fluid.
215
216\subsection examples_cursor cursor
217
218\par
219The \c cursor demo shows all mouse cursor shapes that come standard
220with FLTK. The <i>fgcolor</i> and <i>bgcolor</i> sliders work only
221on few systems (some version of Irix for example).
222
223\subsection examples_curve curve
224
225\par
226\c curve draws a nice Bezier curve into a custom widget. The
227<i>points</i> option for splines is not supported on all platforms.
228
229\subsection examples_demo demo
230
231\par
232This tool allows quick access to all programs in the \c test directory.
233\c demo is based on the visuals of the IrixGL demo program. The menu
234tree can be changed by editing <tt>test/demo.menu</tt>.
235
236\subsection examples_device device
237
238\par
239Exercises the Fl_Image_Surface, Fl_Copy_Surface, and Fl_Printer classes to draw to an
240Fl_Image object, copy graphical data to the clipboard, and for print support.
241\note The clipboard.cxx program of the 'examples' directory is a clipboard watching
242application that continuously displays the textual or graphical content of the system
243clipboard (a.k.a pasteboard on Mac OS X) exercising Fl::paste().
244
245\subsection examples_doublebuffer doublebuffer
246
247\par
248The \c doublebuffer demo shows the difference between a single
249buffered window, which may flicker during a slow redraw, and a
250double buffered window, which never flickers, but uses twice the
251amount of RAM. Some modern OS's double buffer all windows automatically
252to allow transparency and shadows on the desktop. FLTK is smart enough
253to not tripple buffer a window in that case.
254
255\subsection examples_editor editor
256
257\par
258FLTK has two very different text input widgets. Fl_Input
259and derived classes are rather light weight, however
260Fl_Text_Editor is a complete port of <i>nedit</i> (with permission).
261The \c editor test is almost a full application, showing custom
262syntax highlighting and dialog creation.
263
264\subsection examples_fast_slow fast_slow
265
266\par
267\c fast_slow shows how an application can use the Fl_Widget::when()
268setting to receive different kinds of callbacks.
269
270\subsection examples_file_chooser file_chooser
271
272\par
273The standard FLTK \c file_chooser is the result of many
274iterations, trying to find a middle ground between a complex
275browser and a fast light implementation.
276
277\subsection examples_fonts fonts
278
279\par
280\c fonts shows all available text fonts on the host system.
281If your machine still has some pixmap based fonts, the supported
282sizes will be shown in bold face. Only the first 256 fonts will
283be listed.
284
285\subsection examples_forms forms
286
287\par
288\c forms is an XForms program with very few changes.
289Search for "fltk" to find all changes necessary to port to fltk.
290This demo shows the different boxtypes. Note that some
291boxtypes are not appropriate for some objects.
292
293\subsection examples_fractals fractals
294
295\par
296\c fractals shows how to mix OpenGL, Glut and FLTK code.
297FLTK supports a rather large subset of Glut, so that many Glut
298applications compile just fine.
299
300\subsection examples_fullscreen fullscreen
301
302\par
303This demo shows how to do many of the window manipulations that
304are popular for games.
305You can toggle the border on/off, switch between single-
306and double-buffered rendering, and take over the entire
307screen. More information in the source code.
308
309\subsection examples_gl_overlay gl_overlay
310
311\par
312\c gl_overlay shows OpenGL overlay plane rendering. If no
313hardware overlay plane is available, FLTK will simulate it
314for you.
315
316\subsection examples_glpuzzle glpuzzle
317
318\par
319The \c glpuzzle test shows how most Glut source code compiles
320easily under FLTK.
321
322\subsection examples_hello hello
323
324\par
325\c hello: Hello, World. Need I say more? Well, maybe. This
326tiny demo shows how little is needed to get a functioning application
327running with FLTK. Quite impressive, I'd say.
328
329\subsection examples_help_dialog help_dialog
330
331\par
332\c help_dialog displays the built-in FLTK help browser. The
333Fl_Help_Dialog understands a subset of html and renders
334various image formats. This widget makes it easy to provide help
335pages to the user without depending on the operating system's
336html browser.
337
338\subsection examples_iconize iconize
339
340\par
341\c iconize demonstrates the effect of the window functions
342hide(), iconize(), and show().
343
344\subsection examples_image image
345
346\par
347The \c image demo shows how an image can be created on the fly.
348This generated image contains an alpha (transparency) channel which
349lets previous renderings 'shine through', either via true
350transparency or by using screen door transparency (pixelation).
351
352\subsection examples_inactive inactive
353
354\par
355\c inactive tests the correct rendering of inactive widgets.
356To see the inactive version of images, you can check out the pixmap
357or image test.
358
359\subsection examples_input input
360
361\par
362This tool shows and tests different types of text input fields based on
363Fl_Input_. The \c input program also tests various
364settings of Fl_Input::when().
365
366\subsection examples_input_choice input_choice
367
368\par
369\c input_choice tests the latest addition to FLTK1, a text input
370field with an attached pulldown menu. Windows users will recognize
371similarities to the 'ComboBox'. \c input_choice starts up in
372'plastic' scheme, but the traditional scheme is also supported.
373
374\subsection examples_keyboard keyboard
375
376\par
377FLTK unifies keyboard events for all platforms. The \c keyboard
378test can be used to check the return values of Fl::event_key()
379and Fl::event_text(). It is also great to see the modifier
380buttons and the scroll wheel at work. Quit this application by closing
381the window. The ESC key will not work.
382
383\subsection examples_label label
384
385\par
386Every FLTK widget can have a label attached to it. The \c label
387demo shows alignment, clipping, and wrapping of text labels. Labels
388can contain symbols at the start and end of the text, like <i>\@FLTK</i>
389or <i>\@circle uh-huh \@square</i>.
390
391\subsection examples_line_style line_style
392
393\par
394Advanced line drawing can be tested with \c line_style.
395Not all platforms support all line styles.
396
397\subsection examples_list_visuals list_visuals
398
399\par
400This little app finds all available pixel formats for the current X11
401screen. But since you are now an FLTK user, you don't have to worry
402about any of this.
403
404\subsection examples_mandelbrot mandelbrot
405
406\par
407\c mandelbrot shows two advanced topics in one test. It creates
408grayscale images on the fly, updating them via the <i>idle</i> callback
409system. This is one of the few occasions where the <i>idle</i> callback
410is very useful by giving all available processor time to the application
411without blocking the UI or other apps.
412
413\subsection examples_menubar menubar
414
415\par
416The \c menubar tests many aspects of FLTK's popup menu system.
417Among the features are radio buttons, menus taller than the screen,
418arbitrary sub menu depth, and global shortcuts.
419
420\subsection examples_message message
421
422\par
423\c message pops up a few of FLTK's standard message boxes.
424
425\subsection examples_minimum minimum
426
427\par
428The \c minimum test program verifies that the update regions
429are set correctly. In a real life application, the trail would
430be avoided by choosing a smaller label or by setting label clipping
431differently.
432
433\subsection examples_navigation navigation
434
435\par
436\c navigation demonstrates how the text cursor moves from
437text field to text field when using the arrow keys, tab, and shift-tab.
438
439\subsection examples_output output
440
441\par
442\c output shows the difference between the single line and
443multi line mode of the Fl_Output widget. Fonts can be
444selected from the FLTK standard list of fonts.
445
446\subsection examples_overlay overlay
447
448\par
449The \c overlay test app shows how easy an FLTK window can
450be layered to display cursor and manipulator style elements. This
451example derives a new class from Fl_Overlay_Window and
452provides a new function to draw custom overlays.
453
454\subsection examples_pack pack
455
456\par
457The \c pack test program demonstrates the resizing
458and repositioning of children of the Fl_Pack group.
459Putting an Fl_Pack into an Fl_Scroll is
460a useful way to create a browser for large sets of data.
461
462\subsection examples_pixmap_browser pixmap_browser
463
464\par
465\c pixmap_browser tests the shared-image interface. When using
466the same image multiple times, Fl_Shared_Image will keep it
467only once in memory.
468
469\subsection examples_pixmap pixmap
470
471\par
472This simple test shows the use of a LUT based pixmap as a
473label for a box widget. Pixmaps are stored in the X11 '.xpm'
474file format and can be part of the source code. Pixmaps support
475one transparent color.
476
477\subsection examples_preferences preferences
478
479\par
480I do have my \c preferences in the morning, but sometimes I
481just can't remember a thing. This is where the Fl_Preferences
482come in handy. They remember any kind of data between program launches.
483
484\subsection examples_radio radio
485
486\par
487The \c radio tool was created entirely with <i>fluid</i>. It
488shows some of the available button types and tests radio
489button behavior.
490
491\subsection examples_resizebox resizebox
492
493\par
494\c resizebox shows some possible ways of FLTK's automatic
495resize behavior.
496
497\subsection examples_resize resize
498
499\par
500The \c resize demo tests size and position functions with
501the given window manager.
502
503\subsection examples_scroll scroll
504
505\par
506\c scroll shows how to scroll an area of widgets, one of
507them being a slow custom drawing. Fl_Scroll uses
508clipping and smart window area copying to improve redraw speed.
509The buttons at the bottom of the window control decoration rendering
510and updates.
511
512\subsection examples_shape shape
513
514\par
515\c shape is a very minimal demo that shows how to create
516your own OpenGL rendering widget. Now that you know that, go ahead
517and write that flight simulator you always dreamt of.
518
519\subsection examples_subwindow subwindow
520
521\par
522The \c subwindow demo tests messaging and drawing between
523the main window and 'true' sub windows. A sub window is different
524to a group by resetting the FLTK coordinate system to 0, 0 in the
525top left corner. On Win32 and X11, subwindows have their own
526operating system specific handle.
527
528\subsection examples_sudoku sudoku
529
530\par
531Another highly addictive game - don't play it, I warned you.
532The implementation shows how to create application icons,
533how to deal with OS specifics, and how to generate sound.
534
535\subsection examples_symbols symbols
536
537\par
538\c symbols are a speciality of FLTK. These little vector
539drawings can be integrated into labels. They scale and rotate,
540and with a little patience, you can define your own. The rotation
541number refers to 45 degree rotations if you were looking at a
542numeric keypad (2 is down, 6 is right, etc.).
543
544\subsection examples_tabs tabs
545
546\par
547The \c tabs tool was created with <i>fluid</i>. It tests
548correct hiding and redisplaying of tabs, navigation across tabs,
549resize behavior, and no unneeded redrawing of invisible widgets.
550
551\par
552The \c tabs application shows the Fl_Tabs widget
553on the left and the Fl_Wizard widget on the right side
554for direct comparison of these two panel management widgets.
555
556\subsection examples_threads threads
557
558\par
559FLTK can be used in a multithreading environment. There are some
560limitations, mostly due to the underlying operating system.
561\c threads shows how to use Fl::lock(),
562Fl::unlock(), and Fl::awake() in secondary threads
563to keep FLTK happy. Although locking works on all platforms,
564this demo is not available on every machine.
565
566\subsection examples_tile tile
567
568\par
569The \c tile tool shows a nice way of using Fl_Tile.
570To test correct resizing of subwindows, the widget for region
5711 is created from an Fl_Window class.
572
573\subsection examples_tiled_image tiled_image
574
575\par
576The \c tiled_image demo uses an image as the background
577for a window by repeating it over the full size of the widget.
578The window is resizable and shows how the image gets repeated.
579
580\subsection examples_unittests unittests
581
582\par
583\c unittests exercises all of FLTK's drawing features (e.g., text, lines, circles, images),
584as well as scrollbars and schemes.
585
586\subsection examples_utf8 utf8
587
588\par
589\c utf8 shows all fonts available to the platform that runs it, and how each font
590draws each of the Unicode code points ranging between U+0020 and U+FFFF.
591
592\subsection examples_valuators valuators
593
594\par
595\c valuators shows all of FLTK's nifty widgets to change
596numeric values.
597
598\subsection examples_fluid fluid
599
600\par
601\c fluid is not only a big test program, but also a very
602useful visual UI designer. Many parts of \c fluid were
603created using \c fluid. See the \link fluid Fluid Tutorial \endlink
604for more details.
605
606
607\htmlonly
608<hr>
609<table summary="navigation bar" width="100%" border="0">
610<tr>
611  <td width="45%" align="LEFT">
612    <a class="el" href="license.html">
613    [Prev]
614    Software License
615    </a>
616  </td>
617  <td width="10%" align="CENTER">
618    <a class="el" href="index.html">[Index]</a>
619  </td>
620  <td width="45%" align="RIGHT">
621    &nbsp;
622    </a>
623  </td>
624</tr>
625</table>
626\endhtmlonly
627
628*/
629