This page is designed to assist you in completing project 1, Impressionist. This is the basic tutorial for using FLTK to create the user interface.
FLTK is a C++ graphical user interface tookit for X (Unix), OpenGL and Microsoft Windows (NT 4.0, 2000, 95, 98, and Me).
We won't cover much about FLTK in here because code examples are included in the skeleton code. But it is good to learn the basics of FLTK so that you can improve your UI later on if you choose to do so. You can click here to see the complete FLTK Programming Manual.
All public symbols in FLTK start with the charaters 'F' and 'L'
Fl::foo()
or fl_foo()
.
Fl_foo
FL_FOO
<FL/...>
Here are links to the most common widgets that you may need to use in your
programs. Code examples for some of these widgets can be found in ImpressionistView.cpp.
Fl_Window
Fl_Menu_Bar
Fl_Menu_Item
Fl_Value_Slider
Fl_Choice
Fl_Button
Fl_Light_Button
Fl_Input
Fl_Int_Input
Fl_Float_Input
Everything else
Here is a simple Hello World program that I get from the FLTK Programming Manual
(http://www.fltk.org/doc/basics.html).
#include <FL/Fl.h> #include <FL/Fl_Window.H> #include <FL/Fl_Box.h> int main(int argc, char *argv) { Fl_Window *window = new Fl_Window(300, 180); Fl_Box *box = new Fl_Box(20, 40, 260, 100, "Hello World!"); box->(FL_UP_BOX); box->labelsize(36); box->labelfont(FL_BOLD); box->labeltype(FL_SHADOW_LABEL); window->end(); window->show(argc, argv); return Fl::run() }
The statement Fl_Window *window = ...
will create a window with
the specified size (36). The next statement will create a box with the "Hello
World!" string in it. To format the box and string, we can use labelfont()
,
labeltype()
, etc.