diff options
| author | Bill Spitzak <spitzak@gmail.com> | 1999-01-31 07:43:16 +0000 |
|---|---|---|
| committer | Bill Spitzak <spitzak@gmail.com> | 1999-01-31 07:43:16 +0000 |
| commit | 4c53a5d8f4f23358a101ef6bda4b6b8ea4b95274 (patch) | |
| tree | 322cf457283a64e3dc124846abba2331c4be3726 /documentation/basics.html | |
| parent | 4b8754ace4ce4974e7ef8a83f3c830d56aa7f1d0 (diff) | |
Added optimization for SGI builds (mike: please run autoconf before making
a distribution).
Documentation fixes.
git-svn-id: file:///fltk/svn/fltk/trunk@259 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'documentation/basics.html')
| -rw-r--r-- | documentation/basics.html | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/documentation/basics.html b/documentation/basics.html index e394a6cc2..959e67641 100644 --- a/documentation/basics.html +++ b/documentation/basics.html @@ -20,13 +20,12 @@ FLTK. </UL> <B>Microsoft Windows developers please note:</B> case *is* significant under other operating systems, and the C standard uses the forward -slash (/) to separate directories. The following <TT>#include</TT> - directives are *not* recommended for portability reasons: +slash (/) to separate directories. <i>Do not do any of the following:</i> <UL> <PRE> -#include <fl\fl_xyz.h> -#include <fl/fl_xyz.h> #include <FL\Fl_xyz.H> +#include <fl/fl_xyz.h> +#include <Fl/fl_xyz.h> </PRE> </UL> <H2>Compiling Programs with Standard Compilers</H2> @@ -75,7 +74,8 @@ display the window. int main(int argc, char **argv) { Fl_Window *window = new Fl_Window(300,180); - Fl_Box *box = new Fl_Box(FL_UP_BOX,20,40,260,100,"Hello, World!"); + Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!"); + box->box(FL_UP_BOX); box->labelsize(36); box->labelfont(FL_BOLD+FL_ITALIC); box->labeltype(FL_SHADOW_LABEL); @@ -95,12 +95,13 @@ Fl_Window *window = new <A href=Fl_Window.html#Fl_Window>Fl_Window</A>(300,180); and a box with the "Hello, World!" string in it: <UL> <PRE> -Fl_Box *box = new <A href=Fl_Box.html#Fl_Box>Fl_Box</A>(FL_UP_BOX,20,40,260,100,"Hello, World!"); +Fl_Box *box = new <A href=Fl_Box.html#Fl_Box>Fl_Box</A>(20,40,260,100,"Hello, World!"); </PRE> </UL> - Next, we set the size, font, and style of the label: + Next, we set the type of box and the size, font, and style of the label: <UL> <PRE> +box->box(FL_UP_BOX); box-><A href=Fl_Widget.html#Fl_Widget.labelsize>labelsize</A>(36); box-><A href=Fl_Widget.html#Fl_Widget.labelfont>labelfont</A>(FL_BOLD+FL_ITALIC); box-><A href=Fl_Widget.html#Fl_Widget.labeltype>labeltype</A>(FL_SHADOW_LABEL); @@ -118,21 +119,13 @@ The resulting program will display the window below. You can quit the program by closing the window or pressing the ESCape key. <P ALIGN=CENTER><IMG src=./hello.C.gif></P> <H3>Creating the Widgets</H3> - The widgets are created using the C++ <TT>new</TT> operator; the -arguments to the constructors are usually one of the following: + The widgets are created using the C++ <TT>new</TT> operator. For + most widgets the arguments to the constructor are: <UL> <PRE> -Fl_Widget(boxtype, x, y, width, height, label) Fl_Widget(x, y, width, height) -Fl_Widget(width, height) </PRE> </UL> - The <TT>boxtype</TT> value is the style of the box that is drawn -around the widget. Usually this is <TT>FL_NO_BOX</TT>, which means -that no box is drawn. In our "Hello, World!" example we use <TT> -FL_UP_BOX</TT>, which means that a raised button border will be drawn -around the widget. You can learn more about boxtypes in <A href=#boytypes> -Chapter 3</A>. <P>The <TT>x</TT> and <TT>y</TT> parameters determine where the widget or window is placed on the screen. In FLTK the top left corner of the window or screen is the origin (i.e. x = 0, y = 0) and the units are in @@ -145,6 +138,23 @@ widget with or <tt>NULL</tt>. If not specified the label defaults to <tt>NULL</tt>. The label string must be in static storage (such as a string constant) because FLTK does not make a copy of it (it just uses the pointer). +<H3>Get/Set Methods</H3> +<tt>box->box(FL_UP_BOX)</tt> sets the type of box the +Fl_Box draws, changing it from the default of <tt>FL_NO_BOX</tt>, which means +that no box is drawn. In our "Hello, World!" example we use <TT> +FL_UP_BOX</TT>, which means that a raised button border will be drawn +around the widget. You can learn more about boxtypes in <A href=#boytypes> +Chapter 3</A>. +<p>You could examine the boxtype in by doing +<tt>box->box()</tt>. Fltk uses method name overloading to make +short names for get/set methods. A "set" method is always of the form +"void name(type)", and a "get" method is always of the form +"type name() const". +<p>Almost all of these set/get pairs are very fast and short inline +functions and thus very efficient. However, <i>the "set" methods do +not call redraw()</i>, you have to call it yourself. This greatly +reduces code size and execution time. The only common exception is +<tt>value()</tt>, this does redraw() if necessary. <H3>Labels</H3> All widgets support labels. In the case of window widgets, the label is used for the label in the title bar. Our example program calls the <A href=Fl_Widget.html#Fl_Widget.labelfont> |
