FLTK (pronounced "fulltick") is a cross-platform C++ GUI toolkit. FLTK programs developed under Code::Blocks-EP for Windows® can then be easily ported to UNIX®/Linux® (X11) and MacOS® X. Many applications, both commercial and open-source have been developed with FLTK.

FLTK is designed to be small and modular enough to be statically linked, which is important in development environments like Quincy and Code::Blocks.

FLTK also includes an excellent GUI builder called FLUID that can be used to create applications in minutes.
The example programs offered here all come with the full distribution of the FLTK library at http://fltk.org



Before we start

Get the example from the zip file: FLTKexamples.zip (note: Only one Code::Blocks-ready project is in these examples).

Save the archive into the new "FLTKexamples" subdirectory, and extract all the source files from the archive into that directory. The directory contains many separate examples. The Code::Blocks "CubeView" project is located in the separate directory CubeView4CodeBlocks.

You may note that the C++ source files in the examples directory have extension ".cxx", and not the ".cpp" favoured by Microsoft. This does not pose a problem, as IDEs treat ".cpp", ".cc" and ".cxx" in exactly the same way.
In addition to C++ source files the directory contains image files used in the various projects (.png or .xbm), Windows resource files (.rc), FLUID project files (.fl), various icons, etc...

In addition to the CubeView example, the directory contains code for examples:

  adjuster
  arc
  ask
  bitmap
  blocks
  boxtype
  browser
  button
  buttons
  checkers
  clock
  colbrowser
  cube
  CubeView
  cursor
  curve
  demo
  doublebuffer
  editor
  fast_slow
  file_chooser
  fonts
  forms
  fractals
  fullscreen
  gl_overlay
  glpuzzle
  hello
  help
  iconize
  image
  inactive
  input
  input_choice
  keyboard
  label
  line_style
  mandelbrot
  minimum
  navigation
  output
  overlay
  pack
  pixmap
  preferences
  radio
  resize
  resizebox
  scroll
  shape
  subwindow
  sudoku
  symbols
  tabs
  threads
  tile
  tiled_image
  valuators
Note that the "PRJ" files found with each program are project files for the Quincy IDE that also supports FLTK

Load the "Cubeview"project with Code::Blocks

-The cubeview program is used to demonstrate how to generate a whole FLTK program using the FLUID User Interface Builder.

Cubeview screen
Cubeview rotates a cube in 3 dimensions using mouse controls.

Build the project with Code::Blocks and run it.

Studying the "CubeView" project

The FLTK documentation offers a tutorial dedicated to the construction of Cubeview.
This tutorial will show you how the graphical interface can be fully generated using the FLUID GUI tool, available from the Code::Blocks-EP "Tools" menu.


You can now load the other FLTK examples and create FLTK projects that will enable you to build them. With some of them you may need to add one or more of the extra FLTK libraries: fltk_forms, fltk_gl, fltk_images, fltk_jpeg, fltk_png and fltk_z.

You will need to refer frequently to the FLTK API documentation. You can reach it from the Code::Blocks "Programmer's Help" menu entry, or by following this link: