mirror of
https://github.com/fltk/fltk.git
synced 2026-06-07 00:55:23 +08:00
Another bunch of doxygen updates: *.dox. Fixed links and many html tags.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6287 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -83,7 +83,7 @@ From Duncan: (will be removed later, just for now as a reminder)
|
||||
|
||||
5. I've just added comments for the fl_color_chooser() functions, and
|
||||
in order to keep them and the general Function Reference information
|
||||
for them together, I created a new doxygen group, and used \ingroup
|
||||
for them together, I created a new doxygen group, and used \\ingroup
|
||||
in the three comment blocks. This creates a new Modules page (which
|
||||
may not be what we want) with links to it from the File Members and
|
||||
Fl_Color_Chooser.H pages. It needs a bit more experimentation on my
|
||||
|
||||
+149
-166
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ They are not meant to be great achievements in clean C++ programming, but merely
|
||||
a test platform to verify the functionality of the FLTK library.</P>
|
||||
|
||||
<table width=100% border=0>
|
||||
<tr><td colspan=4><font size=+1><b>Example Applications</b></font></td>
|
||||
<tr><td colspan=4><H3><b>Example Applications</b></H3></td>
|
||||
<tr>
|
||||
<td><a href="#adjuster"><tt>adjuster</tt></a></td>
|
||||
<td><a href="#arc"><tt>arc</tt></a></td>
|
||||
|
||||
+13
-15
@@ -37,8 +37,8 @@ POSIX catgets interfaces.
|
||||
main()</TT> function) into the <TT>.fl</TT> file and thus making the <TT>.cxx</TT> file a
|
||||
single source file to compile. Most programs are more complex than
|
||||
this, so you write other <TT>.cxx</TT> files that call the FLUID functions.
|
||||
These <TT>.cxx</TT> files must <TT>#include</TT> the <TT>.h</TT> file or they can <TT>
|
||||
#include</TT> the <TT>.cxx</TT> file so it still appears to be a single source
|
||||
These <TT>.cxx</TT> files must <TT>\#include</TT> the <TT>.h</TT> file or they can <TT>
|
||||
\#include</TT> the <TT>.cxx</TT> file so it still appears to be a single source
|
||||
file.
|
||||
|
||||
\image html fluid-org.gif "Figure 9-1: FLUID organization"
|
||||
@@ -154,9 +154,7 @@ how to:
|
||||
constructor and any member functions necessary.
|
||||
<li>Use FLUID to set callbacks member functions of a custom widget
|
||||
classes.
|
||||
<li>Subclass an <a
|
||||
href="Fl_Gl_Window.html#Fl_Gl_Window"><TT>Fl_Gl_Window</TT></A> to suit
|
||||
your purposes.
|
||||
<li>Subclass an Fl_Gl_Window to suit your purposes.
|
||||
</ol>
|
||||
|
||||
<h3>The CubeView Class</h3>
|
||||
@@ -361,7 +359,7 @@ CubeView defined in the previous section using FLUID.
|
||||
<h4><a name="defui">Defining the CubeViewUI Class</a></h4>
|
||||
|
||||
<P>Once you have started FLUID, the first step in defining a class is to
|
||||
create a new class within FLUID using the \em New->Code->Class</b>
|
||||
create a new class within FLUID using the \em New->Code->Class
|
||||
menu item. Name the class "CubeViewUI" and leave the
|
||||
subclass blank. We do not need any inheritance for this
|
||||
window. You should see the new class declaration in the FLUID
|
||||
@@ -416,9 +414,9 @@ This will be no ordinary box, however.
|
||||
display CubeView is to enter CubeView in the "Class:" text
|
||||
entry box. This tells FLUID that it is not an <tt>Fl_Box</tt>, but a
|
||||
similar widget with the same constructor. In the "Extra
|
||||
Code:" field enter <tt>#include "CubeView.h"</tt>
|
||||
Code:" field enter <tt>\#include "CubeView.h"</tt>
|
||||
|
||||
<p>This <tt>#include</tt> is important, as we have just included
|
||||
<p>This <tt>\#include</tt> is important, as we have just included
|
||||
CubeView as a member of CubeViewUI, so any public CubeView methods are
|
||||
now available to CubeViewUI.
|
||||
|
||||
@@ -595,7 +593,7 @@ changed the current file.
|
||||
|
||||
<H4>Edit/Undo (Ctrl+z)</H4>
|
||||
|
||||
<P>This isn't implemented yet. You should do save often so you can
|
||||
<P>This isn't implemented yet. You should do save often so you can
|
||||
recover from any mistakes you make.
|
||||
|
||||
<H4>Edit/Cut (Ctrl+x)</H4>
|
||||
@@ -990,8 +988,8 @@ menus, and browsers.
|
||||
<tt>Fl_Widget</tt>. Whatever identifier you type in here will
|
||||
be the class that is instantiated.
|
||||
|
||||
<P>In addition, no <tt>#include</tt> header file is put in the
|
||||
<TT>.h</TT> file. You must provide a <tt>#include</tt> line as
|
||||
<P>In addition, no <tt>\#include</tt> header file is put in the
|
||||
<TT>.h</TT> file. You must provide a <tt>\#include</tt> line as
|
||||
the first line of the "Extra Code" which declares your
|
||||
subclass.</P>
|
||||
|
||||
@@ -1032,7 +1030,7 @@ Otherwise is controls whether the widget is declared
|
||||
<P>These four fields let you type in literal lines of code to
|
||||
dump into the <TT>.h</TT> or <TT>.cxx</TT> files.
|
||||
|
||||
<P>If the text starts with a <tt>#</tt> or the word
|
||||
<P>If the text starts with a <tt>\#</tt> or the word
|
||||
<tt>extern</tt> then FLUID thinks this is an "include"
|
||||
line, and it is written to the <TT>.h</TT> file. If the same
|
||||
include line occurs several times then only one copy is
|
||||
@@ -1301,7 +1299,7 @@ strings.
|
||||
|
||||
\image html fluid-gettext.gif "Figure 9-11: Internationalization using GNU gettext"
|
||||
|
||||
<P>The "#include" field controls the header file to include for
|
||||
<P>The "\#include" field controls the header file to include for
|
||||
I18N; by default this is \b <libintl.h>, the
|
||||
standard I18N file for GNU gettext.
|
||||
|
||||
@@ -1324,7 +1322,7 @@ strings.
|
||||
|
||||
\image html fluid-catgets.gif "Figure 9-12: Internationalization using POSIX catgets"
|
||||
|
||||
<P>The "#include" field controls the header file to include for
|
||||
<P>The "\#include" field controls the header file to include for
|
||||
I18N; by default this is \b <nl_types.h>, the
|
||||
standard I18N file for POSIX catgets.
|
||||
|
||||
@@ -1340,7 +1338,7 @@ The default set is 1 and rarely needs to be changed.
|
||||
<H2><A NAME="limitations">Known limitations</A></H2>
|
||||
|
||||
Declaration Blocks can be used to temporarily block out already
|
||||
designed code using <code>#if 0</code> and <code>#endif</code>
|
||||
designed code using <tt>\#if 0</tt> and <tt>\#endif</tt>
|
||||
type construction. This will effectively avoid compilation of
|
||||
blocks of code. However, static code and data generated by this
|
||||
segment (menu items, images, include statements, etc.) will still
|
||||
|
||||
+31
-31
@@ -12,7 +12,7 @@ new name so you don't write over the old one.
|
||||
<P>You will need to edit your main code considerably to get it to link
|
||||
with the output from FLUID. If you are not interested in this you may
|
||||
have more immediate luck with the forms compatibility header, <TT>
|
||||
<FL/forms.H></TT>. </P>
|
||||
<FL/forms.H></TT>. </P>
|
||||
<H2>Using the Compatibility Header File</H2>
|
||||
You should be able to compile existing Forms or XForms source code by
|
||||
changing the include directory switch to your compiler so that the <TT>
|
||||
@@ -29,17 +29,17 @@ a goal of FLTK. Compatibility was limited to things that were free, or
|
||||
that would add code that would not be linked in if the feature is
|
||||
unused, or that was not X-specific. </P>
|
||||
<P>To use any new features of FLTK, you should rewrite your code to not
|
||||
use the inline functions and instead use "pure" FLTK. This will make
|
||||
use the inline functions and instead use "pure" FLTK. This will make
|
||||
it a lot cleaner and make it easier to figure out how to call the FLTK
|
||||
functions. Unfortunately this conversion is harder than expected and
|
||||
even Digital Domain's inhouse code still uses <TT>forms.H</TT> a lot. </P>
|
||||
<H2>Problems You Will Encounter</H2>
|
||||
<P>Many parts of XForms use X-specific structures like <TT>XEvent</TT>
|
||||
in their interface. I did not emulate these! Unfortunately these
|
||||
features (such as the "canvas" widget) are needed by most large
|
||||
features (such as the "canvas" widget) are needed by most large
|
||||
programs. You will need to rewrite these to use FLTK subclasses. </P>
|
||||
<P><A href=Fl_Free.html#Fl_Free><TT>Fl_Free</TT></A> widgets emulate
|
||||
the <I>old</I> Forms "free" widget. It may be useful for porting
|
||||
the <I>old</I> Forms "free" widget. It may be useful for porting
|
||||
programs that change the <TT>handle()</TT> function on widgets, but you
|
||||
will still need to rewrite things. </P>
|
||||
<P><A href=Fl_Timer.html#Fl_Timer><TT>Fl_Timer</TT></A> widgets are
|
||||
@@ -49,8 +49,8 @@ inefficient and inaccurate compared to using <A href="Fl.html#Fl.add_timeout">
|
||||
<P><I>All instance variables are hidden.</I> If you directly refer to
|
||||
the x, y, w, h, label, or other fields of your Forms widgets you will
|
||||
have to add empty parenthesis after each reference. The easiest way to
|
||||
do this is to globally replace "->x" with "->x()", etc. Replace
|
||||
"boxtype" with "box()". </P>
|
||||
do this is to globally replace "->x" with "->x()", etc. Replace
|
||||
"boxtype" with "box()". </P>
|
||||
<P><TT>const char *</TT> arguments to most FLTK methods are simply
|
||||
stored, while Forms would <TT>strdup()</TT> the passed string. This is
|
||||
most noticable with the label of widgets. Your program must always
|
||||
@@ -61,11 +61,11 @@ may want to try the <A href=Fl_Output.html#Fl_Output><TT>Fl_Output</TT></A>
|
||||
<P>The default fonts and sizes are matched to the older GL version of
|
||||
Forms, so all labels will draw somewhat larger than an XForms program
|
||||
does. </P>
|
||||
<P>fdesign outputs a setting of a "fdui" instance variable to the main
|
||||
<P>fdesign outputs a setting of a "fdui" instance variable to the main
|
||||
window. I did not emulate this because I wanted all instance variables
|
||||
to be hidden. You can store the same information in the <TT>user_data()</TT>
|
||||
field of a window. To do this, search through the fdesign output for
|
||||
all occurances of "->fdui" and edit to use "->user_data()" instead.
|
||||
all occurances of "->fdui" and edit to use "->user_data()" instead.
|
||||
This will require casts and is not trivial. </P>
|
||||
<P>The prototype for the functions passed to <TT>fl_add_timeout()</TT>
|
||||
and <TT>fl_set_idle_callback()</TT> callback are different. </P>
|
||||
@@ -123,9 +123,9 @@ IRISGL version of Forms. Most of these problems are the same ones
|
||||
encountered when going from old Forms to XForms:
|
||||
<H3>Does Not Run In Background</H3>
|
||||
The IRISGL library always forked when you created the first window,
|
||||
unless "foreground()" was called. FLTK acts like "foreground()" is
|
||||
called all the time. If you really want the fork behavior do "if
|
||||
(fork()) exit(0)" right at the start of your program.
|
||||
unless "foreground()" was called. FLTK acts like "foreground()" is
|
||||
called all the time. If you really want the fork behavior do "if
|
||||
(fork()) exit(0)" right at the start of your program.
|
||||
<H3>You Cannot Use IRISGL Windows or fl_queue</H3>
|
||||
If a Forms (not XForms) program if you wanted your own window for
|
||||
displaying things you would create a IRISGL window and draw in it,
|
||||
@@ -148,7 +148,7 @@ of your program, call <TT>Fl::wait()</TT> and then check these
|
||||
variables, acting on them as though they are events read from <TT>
|
||||
fl_queue</TT>. </P>
|
||||
<H3>You Must Use OpenGL to Draw Everything</H3>
|
||||
<P>The file <TT><FL/gl.h></TT> defines replacements for a lot of IRISGL
|
||||
<P>The file <TT><FL/gl.h></TT> defines replacements for a lot of IRISGL
|
||||
calls, translating them to OpenGL. There are much better translators
|
||||
available that you might want to investigate. </P>
|
||||
<H3>You Cannot Make Forms Subclasses</H3>
|
||||
@@ -158,15 +158,15 @@ subclass of <TT>Fl_Widget</TT>. It is important to note that the <TT>
|
||||
handle()</TT> method is not exactly the same as the <TT>handle()</TT>
|
||||
function of Forms. Where a Forms <TT>handle()</TT> returned non-zero,
|
||||
your <TT>handle()</TT> must call <TT>do_callback()</TT>. And your <TT>
|
||||
handle()</TT> must return non-zero if it "understood" the event.
|
||||
<P>An attempt has been made to emulate the "free" widget. This appears
|
||||
handle()</TT> must return non-zero if it "understood" the event.
|
||||
<P>An attempt has been made to emulate the "free" widget. This appears
|
||||
to work quite well. It may be quicker to modify your subclass into a
|
||||
"free" widget, since the "handle" functions match. </P>
|
||||
"free" widget, since the "handle" functions match. </P>
|
||||
<P>If your subclass draws into the overlay you are in trouble and will
|
||||
have to rewrite things a lot. </P>
|
||||
<H3>You Cannot Use <device.h></H3>
|
||||
If you have written your own "free" widgets you will probably get a
|
||||
lot of errors about "getvaluator". You should substitute:
|
||||
<H3>You Cannot Use <device.h></H3>
|
||||
If you have written your own "free" widgets you will probably get a
|
||||
lot of errors about "getvaluator". You should substitute:
|
||||
<CENTER><TABLE border=1 WIDTH=90% summary="Mapping of Forms valuators to FLTK.">
|
||||
<TR><TH align=center>Forms</TH><TH align=center>FLTK</TH></TR>
|
||||
<TR><TD>MOUSE_X</TD><TD>Fl::event_x_root()</TD></TR>
|
||||
@@ -181,21 +181,21 @@ lot of errors about "getvaluator". You should substitute:
|
||||
</TABLE></CENTER>
|
||||
Anything else in <TT>getvaluator</TT> and you are on your own...
|
||||
<H3>Font Numbers Are Different</H3>
|
||||
The "style" numbers have been changed because I wanted to insert
|
||||
The "style" numbers have been changed because I wanted to insert
|
||||
bold-italic versions of the normal fonts. If you use Times, Courier,
|
||||
or Bookman to display any text you will get a different font out of
|
||||
FLTK. If you are really desperate to fix this use the following code:
|
||||
<UL>
|
||||
<PRE>
|
||||
fl_font_name(3,"*courier-medium-r-no*");
|
||||
fl_font_name(4,"*courier-bold-r-no*");
|
||||
fl_font_name(5,"*courier-medium-o-no*");
|
||||
fl_font_name(6,"*times-medium-r-no*");
|
||||
fl_font_name(7,"*times-bold-r-no*");
|
||||
fl_font_name(8,"*times-medium-i-no*");
|
||||
fl_font_name(9,"*bookman-light-r-no*");
|
||||
fl_font_name(10,"*bookman-demi-r-no*");
|
||||
fl_font_name(11,"*bookman-light-i-no*");
|
||||
</PRE>
|
||||
|
||||
\code
|
||||
fl_font_name(3,"*courier-medium-r-no*");
|
||||
fl_font_name(4,"*courier-bold-r-no*");
|
||||
fl_font_name(5,"*courier-medium-o-no*");
|
||||
fl_font_name(6,"*times-medium-r-no*");
|
||||
fl_font_name(7,"*times-bold-r-no*");
|
||||
fl_font_name(8,"*times-medium-i-no*");
|
||||
fl_font_name(9,"*bookman-light-r-no*");
|
||||
fl_font_name(10,"*bookman-demi-r-no*");
|
||||
fl_font_name(11,"*bookman-light-i-no*");
|
||||
\endcode
|
||||
|
||||
*/
|
||||
|
||||
+13
-14
@@ -4,7 +4,7 @@
|
||||
|
||||
<P>This appendix describes the GLUT compatibility header file supplied with FLTK. FLTK's GLUT compatibility is based on the original GLUT 3.7 and the follow-on FreeGLUT 2.4.0 libraries.</P>
|
||||
<H2>Using the GLUT Compatibility Header File</H2>
|
||||
<P>You should be able to compile existing GLUT source code by including <TT><FL/glut.H></TT> instead of <TT><GL/glut.h></TT>. This can be done by editing the source, by changing the <TT>-I</TT> switches to the compiler, or by providing a symbolic link from <TT>GL/glut.h</TT> to <TT>FL/glut.H</TT>.</P>
|
||||
<P>You should be able to compile existing GLUT source code by including <TT><FL/glut.H></TT> instead of <TT><GL/glut.h></TT>. This can be done by editing the source, by changing the <TT>-I</TT> switches to the compiler, or by providing a symbolic link from <TT>GL/glut.h</TT> to <TT>FL/glut.H</TT>.</P>
|
||||
<P><I>All files calling GLUT procedures must be compiled with C++</I>. You may have to alter them slightly to get them to compile without warnings, and you may have to rename them to get make to use the C++ compiler.</P>
|
||||
<P>You must link with the FLTK library. Most of <TT>FL/glut.H</TT> is inline functions. You should take a look at it (and maybe at <TT>test/glpuzzle.cxx</TT> in the FLTK source) if you are having trouble porting your GLUT program. </P>
|
||||
<P>This has been tested with most of the demo programs that come with the GLUT and FreeGLUT distributions.</P>
|
||||
@@ -54,7 +54,7 @@ small crosshair. </P>
|
||||
<P><TT>glutInit(argc,argv)</TT> will consume different switches than
|
||||
GLUT does. It accepts the switches recognized by <A href="Fl.html#Fl.args">
|
||||
<TT>Fl::args()</TT></A>, and will accept any abbreviation of these
|
||||
switches (such as "-di" for "-display"). </P>
|
||||
switches (such as "-di" for "-display"). </P>
|
||||
<H2>Mixing GLUT and FLTK Code</H2>
|
||||
You can make your GLUT window a child of a <TT>Fl_Window</TT> with the
|
||||
following scheme. The biggest trick is that GLUT insists on <TT>show()</TT>
|
||||
@@ -66,12 +66,12 @@ Fl_Window</TT> parent window must already be shown.
|
||||
blank area in the window for your GLUT window. </LI>
|
||||
<LI><TT>show()</TT> the <TT>Fl_Window</TT>. Perhaps call <TT>
|
||||
show(argc,argv)</TT>. </LI>
|
||||
<LI>Call <TT>window->begin()</TT> so that the GLUT window will be
|
||||
<LI>Call <TT>window->begin()</TT> so that the GLUT window will be
|
||||
automatically added to it. </LI>
|
||||
<LI>Use <TT>glutInitWindowSize()</TT> and <TT>glutInitWindowPosition()</TT>
|
||||
to set the location in the parent window to put the GLUT window. </LI>
|
||||
<LI>Put your GLUT code next. It probably does not need many changes.
|
||||
Call <TT>window->end()</TT> immediately after the <TT>
|
||||
Call <TT>window->end()</TT> immediately after the <TT>
|
||||
glutCreateWindow()</TT>! </LI>
|
||||
<LI>You can call either <TT>glutMainLoop()</TT>, <TT>Fl::run()</TT>, or
|
||||
loop calling <TT>Fl::wait()</TT> to run the program. </LI>
|
||||
@@ -80,19 +80,18 @@ loop calling <TT>Fl::wait()</TT> to run the program. </LI>
|
||||
<H2><A name=Fl_Glut_Window>class Fl_Glut_Window</A></H2>
|
||||
<HR>
|
||||
<H3>Class Hierarchy</H3>
|
||||
<UL>
|
||||
<PRE>
|
||||
\code
|
||||
<A href=Fl_Gl_Window.html#Fl_Gl_Window>Fl_Gl_Window</A>
|
||||
|
|
||||
+----<B>Fl_Glut_Window</B>
|
||||
</PRE>
|
||||
</UL>
|
||||
\endcode
|
||||
|
||||
<H3>Include Files</H3>
|
||||
<UL>
|
||||
<PRE>
|
||||
#include <FL/glut.H>
|
||||
</PRE>
|
||||
</UL>
|
||||
|
||||
\code
|
||||
#include <FL/glut.H>
|
||||
\endcode
|
||||
|
||||
<H3>Description</H3>
|
||||
Each GLUT window is an instance of this class. You may find it useful
|
||||
to manipulate instances directly rather than use GLUT window id's.
|
||||
@@ -103,7 +102,7 @@ glut_window</TT>. </P>
|
||||
<P><TT>new Fl_Glut_Window(...)</TT> is the same as <TT>
|
||||
glutCreateWindow()</TT> except it does not <TT>show()</TT> the window
|
||||
or make the window current. </P>
|
||||
<P><TT>window->make_current()</TT> is the same as <TT>
|
||||
<P><TT>window->make_current()</TT> is the same as <TT>
|
||||
glutSetWindow(number)</TT>. If the window has not had <TT>show()</TT>
|
||||
called on it yet, some functions that assumme an OpenGL context will
|
||||
not work. If you do <TT>show()</TT> the window, call <TT>make_current()</TT>
|
||||
|
||||
@@ -194,7 +194,7 @@ override the default C compiler (<tt>cc</tt> or <tt>gcc</tt>),
|
||||
which is used for a few FLTK source files.</P>
|
||||
|
||||
<P>You can run configure yourself to get the exact setup you
|
||||
need. Type "./configure <options>", where
|
||||
need. Type "./configure <options>", where
|
||||
options are:</P>
|
||||
|
||||
<DL>
|
||||
|
||||
+14
-14
@@ -57,7 +57,7 @@ exceptions:</P>
|
||||
|
||||
<HR>
|
||||
|
||||
<P ALIGN=CENTER><BIG>GNU LIBRARY GENERAL PUBLIC LICENSE</BIG></P>
|
||||
<P ALIGN=CENTER><B>GNU LIBRARY GENERAL PUBLIC LICENSE</B></P>
|
||||
<P ALIGN=CENTER>Version 2, June 1991
|
||||
<BR> Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
<BR> 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
@@ -65,7 +65,7 @@ exceptions:</P>
|
||||
this license document, but changing it is not allowed.
|
||||
<BR> [This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.] </P>
|
||||
<P><BIG>Preamble</BIG></P>
|
||||
<P><B>Preamble</B></P>
|
||||
The licenses for most software are designed to take away your freedom
|
||||
to share and change it. By contrast, the GNU General Public Licenses
|
||||
are intended to guarantee your freedom to share and change free
|
||||
@@ -140,8 +140,8 @@ former contains code derived from the library, while the latter only
|
||||
works together with the library. </P>
|
||||
<P>Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one. </P>
|
||||
<P ALIGN="CENTER"><BIG>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
|
||||
MODIFICATION</BIG></P>
|
||||
<P ALIGN="CENTER"><B>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
|
||||
MODIFICATION</B></P>
|
||||
<STRONG>0.</STRONG> This License Agreement applies to any software
|
||||
library which contains a notice placed by the copyright holder or other
|
||||
authorized party saying it may be distributed under the terms of this
|
||||
@@ -181,7 +181,7 @@ fee. </P>
|
||||
<P><STRONG>2.</STRONG> You may modify your copy or copies of the
|
||||
Library or any portion of it, thus forming a work based on the Library,
|
||||
and copy and distribute such modifications or work under the terms of
|
||||
Section 1 above, provided that you also meet all of these conditions: <BLOCKQUOTE>
|
||||
Section 1 above, provided that you also meet all of these conditions:
|
||||
<STRONG>a)</STRONG> The modified work must itself be a software
|
||||
library.
|
||||
<P><STRONG>b)</STRONG> You must cause the files modified to carry
|
||||
@@ -203,7 +203,7 @@ purpose that is entirely well-defined independent of the application.
|
||||
function or table used by this function must be optional: if the
|
||||
application does not supply it, the square root function must still
|
||||
compute square roots.) </P>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<P>These requirements apply to the modified work as a whole.
|
||||
If identifiable sections of that work are not derived from the
|
||||
Library, and can be reasonably considered independent and separate
|
||||
@@ -284,7 +284,7 @@ this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things: <BLOCKQUOTE><STRONG>a)</STRONG> Accompany the work
|
||||
of these things: <STRONG>a)</STRONG> Accompany the work
|
||||
with the complete corresponding machine-readable source code for the
|
||||
Library including whatever changes were used in the work (which must
|
||||
be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
@@ -304,7 +304,7 @@ access to copy from a designated place, offer equivalent access to
|
||||
copy the above specified materials from the same place. </P>
|
||||
<P><STRONG>d)</STRONG> Verify that the user has already received a copy
|
||||
of these materials or that you have already sent this user a copy. </P>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<P>For an executable, the required form of the "work that
|
||||
uses the Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
@@ -323,16 +323,16 @@ based on the Library side-by-side in a single library together with
|
||||
other library facilities not covered by this License, and distribute
|
||||
such a combined library, provided that the separate distribution of the
|
||||
work based on the Library and of the other library facilities is
|
||||
otherwise permitted, and provided that you do these two things: <BLOCKQUOTE>
|
||||
otherwise permitted, and provided that you do these two things:
|
||||
<STRONG>a)</STRONG> Accompany the combined library with a copy of the
|
||||
same work based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the Sections
|
||||
above.
|
||||
<P><STRONG>b)</STRONG> Give prominent notice with the combined library
|
||||
of the fact that part of it is a work based on the Library, and
|
||||
explaining where to find the accompanying uncombined form of the same
|
||||
of the fact that part of it is a work based on the Library, and
|
||||
explaining where to find the accompanying uncombined form of the same
|
||||
work. </P>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<P><STRONG>8.</STRONG> You may not copy, modify, sublicense,
|
||||
link with, or distribute the Library except as expressly provided under
|
||||
this License. Any attempt otherwise to copy, modify, sublicense, link
|
||||
@@ -412,7 +412,7 @@ Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally. </P>
|
||||
<P ALIGN="CENTER"><BIG>NO WARRANTY</BIG></P>
|
||||
<P ALIGN="CENTER"><B>NO WARRANTY</B></P>
|
||||
<P><STRONG>15.</STRONG> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE,
|
||||
THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
@@ -432,6 +432,6 @@ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES. </P>
|
||||
<P ALIGN="CENTER"><BIG>END OF TERMS AND CONDITIONS</BIG></P>
|
||||
<P ALIGN="CENTER"><B>END OF TERMS AND CONDITIONS</B></P>
|
||||
|
||||
*/
|
||||
|
||||
@@ -44,16 +44,16 @@ class.</P>
|
||||
|
||||
<P>Some function names have changed from FLTK 1.0.x to 1.1.x in
|
||||
order to avoid name space collisions. You can still use the old
|
||||
function names by defining the <CODE>FLTK_1_0_COMPAT</CODE>
|
||||
function names by defining the <TT>FLTK_1_0_COMPAT</TT>
|
||||
symbol on the command-line when you compile
|
||||
(<CODE>-DFLTK_1_0_COMPAT</CODE>) or in your source, e.g.:
|
||||
(<TT>-DFLTK_1_0_COMPAT</TT>) or in your source, e.g.:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
#define FLTK_1_0_COMPAT
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Enumerations.H>
|
||||
#include <FL/filename.H>
|
||||
</PRE></UL>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Enumerations.H>
|
||||
#include <FL/filename.H>
|
||||
\endcode
|
||||
|
||||
<P>The following table shows the old and new function names:</P>
|
||||
|
||||
@@ -151,8 +151,8 @@ text widgets get keyboard focus, call the <A
|
||||
HREF="Fl.html#Fl.visible_focus"><CODE>Fl::visible_focus()</CODE></A>
|
||||
method to disable it:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
Fl::visible_focus(0);
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
*/
|
||||
|
||||
+53
-56
@@ -20,10 +20,10 @@ href="#gl_start"><TT>gl_start()</TT></A> and <A
|
||||
href=#gl_finish><TT>gl_finish()</TT></A> functions around your
|
||||
OpenGL code.</P>
|
||||
|
||||
<P>You must include FLTK's <TT><FL/gl.h></TT> header
|
||||
file. It will include the file <TT><GL/gl.h></TT>, define
|
||||
<P>You must include FLTK's <TT><FL/gl.h></TT> header
|
||||
file. It will include the file <TT><GL/gl.h></TT>, define
|
||||
some extra drawing functions provided by FLTK, and include the
|
||||
<TT><windows.h></TT> header file needed by WIN32
|
||||
<TT><windows.h></TT> header file needed by WIN32
|
||||
applications.</P>
|
||||
|
||||
<H2>Making a Subclass of Fl_Gl_Window</H2>
|
||||
@@ -47,7 +47,7 @@ in the value returned by <tt>damage()</tt>. For double-buffered
|
||||
windows you will need to surround the drawing code with the
|
||||
following code to make sure that both buffers are redrawn:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
#ifndef MESA
|
||||
glDrawBuffer(GL_FRONT_AND_BACK);
|
||||
#endif // !MESA
|
||||
@@ -55,7 +55,7 @@ glDrawBuffer(GL_FRONT_AND_BACK);
|
||||
#ifndef MESA
|
||||
glDrawBuffer(GL_BACK);
|
||||
#endif // !MESA
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<CENTER><TABLE WIDTH="80%" BORDER="1" CELLPADDING="5" CELLSPACING="0" BGCOLOR="#cccccc">
|
||||
<TR>
|
||||
@@ -77,7 +77,7 @@ glDrawBuffer(GL_BACK);
|
||||
<P>To define the subclass you just subclass the
|
||||
<TT>Fl_Gl_Window</TT> class:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
class MyWindow : public Fl_Gl_Window {
|
||||
void draw();
|
||||
int handle(int);
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
MyWindow(int X, int Y, int W, int H, const char *L)
|
||||
: Fl_Gl_Window(X, Y, W, H, L) {}
|
||||
};
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>The <TT>draw()</TT> and <TT>handle()</TT> methods are
|
||||
described below. Like any widget, you can include additional
|
||||
@@ -98,7 +98,7 @@ information, etc.)
|
||||
<P>The <TT>draw()</TT> method is where you actually do your
|
||||
OpenGL drawing:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
void MyWindow::draw() {
|
||||
if (!valid()) {
|
||||
... set up projection, viewport, etc ...
|
||||
@@ -107,14 +107,14 @@ void MyWindow::draw() {
|
||||
}
|
||||
... draw ...
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<H3>The handle() Method</H3>
|
||||
|
||||
<P>The <TT>handle()</TT> method handles mouse and keyboard
|
||||
events for the window:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
int MyWindow::handle(int event) {
|
||||
switch(event) {
|
||||
case FL_PUSH:
|
||||
@@ -144,7 +144,7 @@ int MyWindow::handle(int event) {
|
||||
return Fl_Gl_Window::handle(event);
|
||||
}
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>When <TT>handle()</TT> is called, the OpenGL context is not
|
||||
set up! If your display changes, you should call
|
||||
@@ -154,16 +154,18 @@ call any OpenGL drawing functions from inside <TT>handle()</TT>!
|
||||
<P>You can call <I>some</I> OpenGL stuff like hit detection and texture
|
||||
loading functions by doing: </P>
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
case FL_PUSH:
|
||||
make_current(); // make OpenGL context current
|
||||
make_current(); // make OpenGL context current
|
||||
if (!valid()) {
|
||||
|
||||
... set up projection exactly the same as draw ...
|
||||
valid(1); // stop it from doing this next time
|
||||
|
||||
valid(1); // stop it from doing this next time
|
||||
}
|
||||
... ok to call NON-DRAWING OpenGL code here, such as hit
|
||||
detection, loading textures, etc...
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>Your main program can now create one of your windows by doing
|
||||
<TT>new MyWindow(...)</TT>. You can also use <A
|
||||
@@ -176,17 +178,17 @@ href="fluid.html#FLUID">FLUID</A> by:
|
||||
|
||||
<LI>Creating a <tt>Fl_Box</tt> widget in FLUID.</LI>
|
||||
|
||||
<LI>In the widget panel fill in the "class"
|
||||
<LI>In the widget panel fill in the "class"
|
||||
field with <tt>MyWindow</tt>. This will make FLUID
|
||||
produce constructors for your new class.</LI>
|
||||
|
||||
<LI>In the "Extra Code" field put <TT>#include
|
||||
"MyWindow.H"</TT>, so that the FLUID output
|
||||
<LI>In the "Extra Code" field put <TT>\#include
|
||||
"MyWindow.H"</TT>, so that the FLUID output
|
||||
file will compile.</LI>
|
||||
|
||||
</OL>
|
||||
|
||||
<P>You must put <TT>glwindow->show()</TT> in your main code
|
||||
<P>You must put <TT>glwindow->show()</TT> in your main code
|
||||
after calling <TT>show()</TT> on the window containing the
|
||||
OpenGL window.
|
||||
|
||||
@@ -201,22 +203,21 @@ care.
|
||||
<P>Most importantly, before you show <I>any</I> windows,
|
||||
including those that don't have OpenGL drawing, you <B>must</B>
|
||||
initialize FLTK so that it knows it is going to use OpenGL. You
|
||||
may use any of the symbols described for <A
|
||||
href="Fl_Gl_Window.html#Fl_Gl_Window.mode"><TT>Fl_Gl_Window::mode()</TT></A>
|
||||
may use any of the symbols described for Fl_Gl_Window::mode()
|
||||
to describe how you intend to use OpenGL:</P>
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
Fl::gl_visual(FL_RGB);
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>You can then put OpenGL drawing code anywhere you can draw
|
||||
normally by surrounding it with:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
gl_start();
|
||||
... put your OpenGL code here ...
|
||||
gl_finish();
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P><A name="gl_start"><TT>gl_start()</TT></A> and <A
|
||||
name="gl_finish"><TT>gl_finish()</TT></A> set up an OpenGL
|
||||
@@ -231,7 +232,7 @@ the projection transformation or anything else you should use
|
||||
<TT>glPushMatrix()</TT> and <TT>glPopMatrix()</TT> functions to
|
||||
put the state back before calling <TT>gl_finish()</TT>.</P>
|
||||
|
||||
<P>You may want to use <TT>Fl_Window::current()->h()</TT> to
|
||||
<P>You may want to use Fl_Window::current()->h() to
|
||||
get the drawable height so that you can flip the Y
|
||||
coordinates.</P>
|
||||
|
||||
@@ -240,26 +241,23 @@ adhere to for maximum portability: </P>
|
||||
|
||||
<UL>
|
||||
|
||||
<LI>You must choose a default visual with <A
|
||||
href="Fl.html#Fl.gl_visual"><TT>Fl::gl_visual()</TT></A>.</LI>
|
||||
<LI>You must choose a default visual with Fl::gl_visual().</LI>
|
||||
|
||||
<LI>You cannot pass <TT>FL_DOUBLE</TT> to
|
||||
<TT>Fl::gl_visual()</TT>.</LI>
|
||||
<LI>You cannot pass <TT>FL_DOUBLE</TT> to Fl::gl_visual().</LI>
|
||||
|
||||
<LI>You cannot use <TT>Fl_Double_Window</TT> or
|
||||
<TT>Fl_Overlay_Window</TT>.</LI>
|
||||
<LI>You cannot use Fl_Double_Window or Fl_Overlay_Window.</LI>
|
||||
|
||||
</UL>
|
||||
|
||||
<P>Do <I>not</I> call <TT>gl_start()</TT> or
|
||||
<TT>gl_finish()</TT> when drawing into an <TT>Fl_Gl_Window</TT>!
|
||||
<TT>gl_finish()</TT> when drawing into an Fl_Gl_Window !
|
||||
|
||||
<H2>OpenGL Drawing Functions</H2>
|
||||
|
||||
<P>FLTK provides some useful OpenGL drawing functions. They can
|
||||
be freely mixed with any OpenGL calls, and are defined by
|
||||
including <TT><FL/gl.H></TT> which you should include
|
||||
instead of the OpenGL header <TT><GL/gl.h></TT>.
|
||||
including <FL/gl.H> which you should include
|
||||
instead of the OpenGL header <TT><GL/gl.h></TT>.
|
||||
|
||||
<H4>void gl_color(Fl_Color)</H4>
|
||||
|
||||
@@ -270,10 +268,9 @@ only right if this window uses the default colormap!</I>
|
||||
<H4>void gl_rect(int x, int y, int w, int h)
|
||||
<BR>void gl_rectf(int x, int y, int w, int h)</H4>
|
||||
|
||||
<P>Outlines or fills a rectangle with the current color. If <A
|
||||
HREF="Fl_Gl_Window.html#Fl_Gl_Window.ortho"><TT>Fl_Gl_Window::ortho()</TT></A>
|
||||
has been called, then the rectangle will exactly fill the pixel
|
||||
rectangle passed.
|
||||
<P>Outlines or fills a rectangle with the current color. If
|
||||
Fl_Gl_Window::ortho() has been called, then the rectangle will exactly
|
||||
fill the pixel rectangle passed.
|
||||
|
||||
<H4>void gl_font(Fl_Font fontid, int size)</H4>
|
||||
|
||||
@@ -361,7 +358,7 @@ to view large scenes without writing a lot of OpenGL code.
|
||||
subclass of <TT>Fl_Gl_Widget</TT> that includes several state
|
||||
variables:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
class OptimizerWindow : public Fl_Gl_Window {
|
||||
csContext *context_; // Initialized to 0 and set by draw()...
|
||||
csDrawAction *draw_action_; // Draw action...
|
||||
@@ -384,13 +381,13 @@ public:
|
||||
void camera(csCamera *c) {
|
||||
camera_ = c;
|
||||
if (context_) {
|
||||
draw_action_->setCamera(camera_);
|
||||
camera_->draw(draw_action_);
|
||||
draw_action_->setCamera(camera_);
|
||||
camera_->draw(draw_action_);
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
};
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<H4>The camera() Method</H4>
|
||||
|
||||
@@ -403,7 +400,7 @@ this call.
|
||||
<P>The <TT>draw()</TT> method performs the needed initialization and does
|
||||
the actual drawing:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
void OptimizerWindow::draw() {
|
||||
if (!context_) {
|
||||
// This is the first time we've been asked to draw; create the
|
||||
@@ -411,12 +408,12 @@ void OptimizerWindow::draw() {
|
||||
|
||||
#ifdef WIN32
|
||||
context_ = new csContext((HDC)fl_getHDC());
|
||||
context_->ref();
|
||||
context_->makeCurrent((HDC)fl_getHDC());
|
||||
context_->ref();
|
||||
context_->makeCurrent((HDC)fl_getHDC());
|
||||
#else
|
||||
context_ = new csContext(fl_display, fl_visual);
|
||||
context_->ref();
|
||||
context_->makeCurrent(fl_display, fl_window);
|
||||
context_->ref();
|
||||
context_->makeCurrent(fl_display, fl_window);
|
||||
#endif // WIN32
|
||||
|
||||
... perform other context setup as desired ...
|
||||
@@ -425,24 +422,24 @@ void OptimizerWindow::draw() {
|
||||
|
||||
draw_action_ = new csDrawAction;
|
||||
if (camera_) {
|
||||
draw_action_->setCamera(camera_);
|
||||
camera_->draw(draw_action_);
|
||||
draw_action_->setCamera(camera_);
|
||||
camera_->draw(draw_action_);
|
||||
}
|
||||
} else {
|
||||
#ifdef WIN32
|
||||
context_->makeCurrent((HDC)fl_getHDC());
|
||||
context_->makeCurrent((HDC)fl_getHDC());
|
||||
#else
|
||||
context_->makeCurrent(fl_display, fl_window);
|
||||
context_->makeCurrent(fl_display, fl_window);
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
if (!valid()) {
|
||||
// Update the viewport for this context...
|
||||
context_->setViewport(0, 0, w(), h());
|
||||
context_->setViewport(0, 0, w(), h());
|
||||
}
|
||||
|
||||
// Clear the window...
|
||||
context_->clear(csContext::COLOR_CLEAR | csContext::DEPTH_CLEAR,
|
||||
context_->clear(csContext::COLOR_CLEAR | csContext::DEPTH_CLEAR,
|
||||
0.0f, // Red
|
||||
0.0f, // Green
|
||||
0.0f, // Blue
|
||||
@@ -450,9 +447,9 @@ void OptimizerWindow::draw() {
|
||||
|
||||
// Then draw the scene (if any)...
|
||||
if (scene_)
|
||||
draw_action_->apply(scene_);
|
||||
draw_action_->apply(scene_);
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<H4>The scene() Method</H4>
|
||||
|
||||
|
||||
+51
-51
@@ -9,9 +9,9 @@
|
||||
<P>All programs that need to access the operating system
|
||||
specific interfaces must include the following header file:
|
||||
|
||||
<UL><PRE>
|
||||
#include <FL/x.H>
|
||||
</PRE></UL>
|
||||
\code
|
||||
#include <FL/x.H>
|
||||
\endcode
|
||||
|
||||
<P>Despite the name, this header file will define the
|
||||
appropriate interface for your environment. The pages that
|
||||
@@ -78,7 +78,7 @@ XID, or <TT>NULL</TT> if not found. This function uses a cache
|
||||
so it is slightly faster than iterating through the windows
|
||||
yourself.</P>
|
||||
|
||||
<H4><A name="fl_handle">int fl_handle(const XEvent &)</A></H4>
|
||||
<H4><A name="fl_handle">int fl_handle(const XEvent &)</A></H4>
|
||||
|
||||
<P>This call allows you to supply the X events to FLTK, which
|
||||
may allow FLTK to cooperate with another toolkit or library. The
|
||||
@@ -104,21 +104,21 @@ HREF="subclassing.html#draw"><TT>Fl_Widget::draw()</TT></A> is
|
||||
called, or by <A
|
||||
href="Fl_Window.html#Fl_Window.make_current"><TT>Fl_Window::make_current()</TT></A>:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
extern Display *fl_display;
|
||||
extern Window fl_window;
|
||||
extern GC fl_gc;
|
||||
extern int fl_screen;
|
||||
extern XVisualInfo *fl_visual;
|
||||
extern Colormap fl_colormap;
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>You must use them to produce Xlib calls. Don't attempt to change
|
||||
them. A typical X drawing call is written like this:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
XDrawSomething(fl_display, fl_window, fl_gc, ...);
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>Other information such as the position or size of the X
|
||||
window can be found by looking at <A
|
||||
@@ -132,11 +132,11 @@ unsigned long fl_xpixel(uchar r, uchar g, uchar b)</A></H4>
|
||||
index or RGB color. This is the X pixel that <A
|
||||
href="drawing.html#fl_color"><TT>fl_color()</TT></A> would use.
|
||||
|
||||
<H4><A name="fl_parse_color">int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)</A></H4>
|
||||
<H4><A name="fl_parse_color">int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)</A></H4>
|
||||
|
||||
<P>Convert a name into the red, green, and blue values of a color
|
||||
by parsing the X11 color names. On other systems, <tt>fl_parse_color</tt>
|
||||
can only convert names in hexadecimal encoding, for example <tt>#ff8083</tt>.
|
||||
can only convert names in hexadecimal encoding, for example <tt>\#ff8083</tt>.
|
||||
|
||||
<H4><A name="fl_xfont">extern XFontStruct *fl_xfont</A></H4>
|
||||
|
||||
@@ -170,7 +170,7 @@ visual.
|
||||
<H4><A name="display">int Fl::display(const char *)</A></H4>
|
||||
|
||||
<P>Set which X display to use. This actually does
|
||||
<TT>putenv("DISPLAY=...")</TT> so that child programs
|
||||
<TT>putenv("DISPLAY=...")</TT> so that child programs
|
||||
will display on the same screen if called with <TT>exec()</TT>.
|
||||
This must be done before the display is opened. This call is
|
||||
provided under MacOS and WIN32 but it has no effect.
|
||||
@@ -206,7 +206,7 @@ probably cannot call any FLTK functions.
|
||||
<TT>fl_open_display()</TT> to the default screen. You can change
|
||||
it by setting this to a different value immediately afterwards.
|
||||
It can also be set by changing the last number in the
|
||||
<TT>Fl::display()</TT> string to "host:0.#".
|
||||
<TT>Fl::display()</TT> string to "host:0.#".
|
||||
|
||||
<H4><A name="fl_visual">extern XVisualInfo *fl_visual</A><BR>
|
||||
<A name="fl_colormap">extern Colormap fl_colormap</A></H4>
|
||||
@@ -217,15 +217,15 @@ visual and colormap. You can change them before calling
|
||||
<TT>show()</TT> on the first window. Typical code for changing
|
||||
the default visual is:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
Fl::args(argc, argv); // do this first so $DISPLAY is set
|
||||
fl_open_display();
|
||||
fl_visual = find_a_good_visual(fl_display, fl_screen);
|
||||
if (!fl_visual) Fl::abort("No good visual");
|
||||
fl_colormap = make_a_colormap(fl_display, fl_visual->visual, fl_visual->depth);
|
||||
if (!fl_visual) Fl::abort("No good visual");
|
||||
fl_colormap = make_a_colormap(fl_display, fl_visual->visual, fl_visual->depth);
|
||||
// it is now ok to show() windows:
|
||||
window->show(argc, argv);
|
||||
</PRE></UL>
|
||||
window->show(argc, argv);
|
||||
\endcode
|
||||
|
||||
<H3>Using a Subclass of Fl_Window for Special X Stuff</H3>
|
||||
|
||||
@@ -252,7 +252,7 @@ implementation must call either <TT>Fl_X::set_xid()</TT> or
|
||||
|
||||
<P>An example:</P>
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
void MyWindow::show() {
|
||||
if (shown()) {Fl_Window::show(); return;} // you must do this!
|
||||
fl_open_display(); // necessary if this is first window
|
||||
@@ -262,11 +262,11 @@ void MyWindow::show() {
|
||||
if (!visual) {
|
||||
visual = figure_out_visual();
|
||||
colormap = XCreateColormap(fl_display, RootWindow(fl_display,fl_screen),
|
||||
vis->visual, AllocNone);
|
||||
vis->visual, AllocNone);
|
||||
}
|
||||
Fl_X::make_xid(this, visual, colormap);
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<H4>Fl_X *Fl_X::set_xid(Fl_Window *, Window xid)</H4>
|
||||
|
||||
@@ -293,7 +293,7 @@ your own windows you might just want to put all the drawing code
|
||||
in here.
|
||||
|
||||
<P>The X region that is a combination of all <TT>damage()</TT>
|
||||
calls done so far is in <TT>Fl_X::i(this)->region</TT>. If
|
||||
calls done so far is in <TT>Fl_X::i(this)->region</TT>. If
|
||||
<TT>NULL</TT> then you should redraw the entire window. The
|
||||
undocumented function <TT>fl_clip_region(XRegion)</TT> will
|
||||
initialize the FLTK clip stack with a region or <TT>NULL</TT>
|
||||
@@ -301,20 +301,20 @@ for no clipping. You must set region to <TT>NULL</TT> afterwards
|
||||
as <TT>fl_clip_region()</TT> will own and delete it when
|
||||
done.</P>
|
||||
|
||||
<P>If <TT>damage() & FL_DAMAGE_EXPOSE</TT> then only X
|
||||
<P>If <TT>damage() & FL_DAMAGE_EXPOSE</TT> then only X
|
||||
expose events have happened. This may be useful if you have an
|
||||
undamaged image (such as a backing buffer) around.</P>
|
||||
|
||||
<P>Here is a sample where an undamaged image is kept somewhere:</P>
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
void MyWindow::flush() {
|
||||
fl_clip_region(Fl_X::i(this)->region);
|
||||
Fl_X::i(this)->region = 0;
|
||||
fl_clip_region(Fl_X::i(this)->region);
|
||||
Fl_X::i(this)->region = 0;
|
||||
if (damage() != 2) {... draw things into backing store ...}
|
||||
... copy backing store to window ...
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<H4>virtual void Fl_Window::hide()</H4>
|
||||
|
||||
@@ -324,7 +324,7 @@ window, and then call <TT>Fl_Window::hide()</TT> to get rid of
|
||||
the main window identified by <TT>xid()</TT>. If you override
|
||||
this, you must also override the destructor as shown:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
void MyWindow::hide() {
|
||||
if (mypixmap) {
|
||||
XFreePixmap(fl_display,mypixmap);
|
||||
@@ -332,7 +332,7 @@ void MyWindow::hide() {
|
||||
}
|
||||
Fl_Window::hide(); // you must call this
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<H4>virtual void Fl_Window::~Fl_Window()</H4>
|
||||
|
||||
@@ -340,11 +340,11 @@ void MyWindow::hide() {
|
||||
you <I>must</I> override the destructor as well (otherwise only
|
||||
the base class <TT>hide()</TT> is called):
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
MyWindow::~MyWindow() {
|
||||
hide();
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<H3>Setting the Icon of a Window</H3>
|
||||
|
||||
@@ -358,33 +358,33 @@ need to cast the icon <TT>Pixmap</TT> to a <TT>char *</TT> when
|
||||
calling this method. To set a monochrome icon using a bitmap compiled
|
||||
with your application use:
|
||||
|
||||
<UL><PRE>
|
||||
#include "icon.xbm"
|
||||
\code
|
||||
#include "icon.xbm"
|
||||
|
||||
fl_open_display(); // needed if display has not been previously opened
|
||||
|
||||
Pixmap p = XCreateBitmapFromData(fl_display, DefaultRootWindow(fl_display),
|
||||
icon_bits, icon_width, icon_height);
|
||||
|
||||
window->icon((char *)p);
|
||||
</PRE></UL>
|
||||
window->icon((char *)p);
|
||||
\endcode
|
||||
|
||||
<P>To use a multi-colored icon, the XPM format and library
|
||||
should be used as follows:
|
||||
|
||||
<UL><PRE>
|
||||
#include <X11/xpm.h>
|
||||
#include "icon.xpm"
|
||||
\code
|
||||
#include <X11/xpm.h>
|
||||
#include "icon.xpm"
|
||||
|
||||
fl_open_display(); // needed if display has not been previously opened
|
||||
|
||||
Pixmap p, mask;
|
||||
|
||||
XpmCreatePixmapFromData(fl_display, DefaultRootWindow(fl_display),
|
||||
icon_xpm, &p, &mask, NULL);
|
||||
icon_xpm, &p, &mask, NULL);
|
||||
|
||||
window->icon((char *)p);
|
||||
</PRE></UL>
|
||||
window->icon((char *)p);
|
||||
\endcode
|
||||
|
||||
<p>When using the Xpm library, be sure to include it in the list
|
||||
of libraries that are used to link the application (usually
|
||||
@@ -453,7 +453,7 @@ state information and data structures.
|
||||
|
||||
<H3>Handling Other WIN32 Messages</H3>
|
||||
|
||||
<P>By default a single WNDCLASSEX called "FLTK" is
|
||||
<P>By default a single WNDCLASSEX called "FLTK" is
|
||||
created. All <TT>Fl_Window</TT>'s are of this class unless you
|
||||
use <TT>Fl_Window::xclass()</TT>. The window class is created
|
||||
the first time <TT>Fl_Window::show()</TT> is called.
|
||||
@@ -505,14 +505,14 @@ HREF="subclassing.html#draw"><TT>Fl_Widget::draw()</TT></A> is
|
||||
called, FLTK stores all the silly extra arguments you need to
|
||||
make a proper GDI call in some global variables:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
extern HINSTANCE fl_display;
|
||||
extern HWND fl_window;
|
||||
extern HDC fl_gc;
|
||||
COLORREF fl_RGB();
|
||||
HPEN fl_pen();
|
||||
HBRUSH fl_brush();
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>These global variables are set before <TT>draw()</TT> is
|
||||
called, or by <A
|
||||
@@ -523,9 +523,9 @@ the current color set by <TT>fl_color()</TT> and are created as
|
||||
needed and cached. A typical GDI drawing call is written like
|
||||
this:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
DrawSomething(fl_gc, ..., fl_brush());
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>It may also be useful to refer to <A
|
||||
href="Fl_Window.html#Fl_Window.make_current"><TT>Fl_Window::current()</TT></A>
|
||||
@@ -543,9 +543,9 @@ need to cast the <TT>HICON</TT> handle to a <TT>char *</TT> when
|
||||
calling this method. To set the icon using an icon resource
|
||||
compiled with your application use:
|
||||
|
||||
<UL><PRE>
|
||||
window->icon((char *)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON)));
|
||||
</PRE></UL>
|
||||
\code
|
||||
window->icon((char *)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON)));
|
||||
\endcode
|
||||
|
||||
<P>You can also use the <TT>LoadImage()</TT> and related
|
||||
functions to load specific resolutions or create the icon from
|
||||
@@ -572,9 +572,9 @@ executables that controls whether or not to make a console
|
||||
window.
|
||||
|
||||
<P>To always get a console window you simply create a console
|
||||
application (the "/SUBSYSTEM:CONSOLE" option for the
|
||||
application (the "/SUBSYSTEM:CONSOLE" option for the
|
||||
linker). For a GUI-only application create a WIN32 application
|
||||
(the "/SUBSYSTEM:WINDOWS" option for the linker).</P>
|
||||
(the "/SUBSYSTEM:WINDOWS" option for the linker).</P>
|
||||
|
||||
<P>FLTK includes a <TT>WinMain()</TT> function that calls the
|
||||
ANSI standard <TT>main()</TT> entry point for you. <I>This
|
||||
@@ -707,7 +707,7 @@ applications
|
||||
will NOT copy any resource forks! For copying and moving use
|
||||
CpMac and MvMac respectively. For creating a tar archive, all
|
||||
executables need to be stripped from their Resource Fork before
|
||||
packing, e.g. "DeRez fluid > fluid.r". After unpacking the
|
||||
packing, e.g. "DeRez fluid > fluid.r". After unpacking the
|
||||
Resource Fork needs to be reattached, e.g. "Rez fluid.r -o
|
||||
fluid".
|
||||
</TD></TR></TABLE></CENTER>
|
||||
|
||||
@@ -12,7 +12,7 @@ interfaces.</P>
|
||||
|
||||
<P><B>This manual may be printed, modified, and/or used under
|
||||
the terms of the FLTK license provided in <A
|
||||
HREF="license.html">Appendix H</A>.</B>
|
||||
HREF="license.html">Appendix J</A>.</B>
|
||||
|
||||
<H2>Organization</H2>
|
||||
|
||||
@@ -99,7 +99,7 @@ HREF="license.html">Appendix H</A>.</B>
|
||||
|
||||
<P>FLTK is Copyright 1998-2006 by Bill Spitzak and others. Use and
|
||||
distribution of FLTK is governed by the GNU Library General Public
|
||||
License, located in <A HREF="license.html#license">Appendix H</A>.</P>
|
||||
License, located in <A HREF="license.html#license">Appendix J</A>.</P>
|
||||
|
||||
<P>UNIX is a registered trademark of the X Open Group, Inc.
|
||||
Microsoft and Windows are registered trademarks of Microsoft
|
||||
|
||||
@@ -26,23 +26,23 @@ subclass of <TT>Fl_Widget</TT>. <TT>Fl_Widget</TT> has only four
|
||||
virtual methods, and overriding some or all of these may be necessary.
|
||||
<H2>The Constructor</H2>
|
||||
The constructor should have the following arguments:
|
||||
<UL><PRE>
|
||||
\code
|
||||
MyClass(int x, int y, int w, int h, const char *label = 0);
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
This will allow the class to be used in <A href="fluid.html#FLUID">FLUID</A>
|
||||
without problems.
|
||||
<P>The constructor must call the constructor for the base class and
|
||||
pass the same arguments: </P>
|
||||
<UL><PRE>
|
||||
\code
|
||||
MyClass::MyClass(int x, int y, int w, int h, const char *label)
|
||||
: Fl_Widget(x, y, w, h, label) {
|
||||
// do initialization stuff...
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
<TT>Fl_Widget</TT>'s protected constructor sets <TT>x()</TT>, <TT>y()</TT>,
|
||||
<TT>w()</TT>, <TT>h()</TT>, and <TT>label()</TT> to the passed values
|
||||
and initializes the other instance variables to:
|
||||
<UL><PRE>
|
||||
\code
|
||||
type(0);
|
||||
box(FL_NO_BOX);
|
||||
color(FL_BACKGROUND_COLOR);
|
||||
@@ -56,7 +56,7 @@ callback(default_callback,0);
|
||||
flags(ACTIVE|VISIBLE);
|
||||
image(0);
|
||||
deimage(0);
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
<H2>Protected Methods of Fl_Widget</H2>
|
||||
The following methods are provided for subclasses to use:
|
||||
<UL>
|
||||
@@ -90,7 +90,7 @@ calls done since the last <TT>draw()</TT>.</P>
|
||||
see what parts of your widget need redrawing.</I> The <tt>handle()</tt>
|
||||
method can then set individual damage bits to limit the amount of drawing
|
||||
that needs to be done:
|
||||
<UL><PRE>
|
||||
\code
|
||||
MyClass::handle(int event) {
|
||||
...
|
||||
if (change_to_part1) damage(1);
|
||||
@@ -107,7 +107,7 @@ MyClass::draw() {
|
||||
if (damage() & (FL_DAMAGE_ALL | 2)) draw_part2();
|
||||
if (damage() & (FL_DAMAGE_ALL | 4)) draw_part3();
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
<H4><A name="draw_box">void Fl_Widget::draw_box() const
|
||||
<BR></A>void Fl_Widget::draw_box(Fl_Boxtype b, ulong c) const</H4>
|
||||
The first form draws this widget's <TT>box()</TT>, using the
|
||||
@@ -192,7 +192,7 @@ by calling the <A href="events.html#events"><TT>Fl::event_*()</TT></A>
|
||||
handled.
|
||||
<P>Here is a sample <TT>handle()</TT> method for a widget that acts as
|
||||
a pushbutton and also accepts the keystroke 'x' to cause the callback: </P>
|
||||
<UL><PRE>
|
||||
\code
|
||||
int MyClass::handle(int event) {
|
||||
switch(event) {
|
||||
case FL_PUSH:
|
||||
@@ -226,7 +226,7 @@ int MyClass::handle(int event) {
|
||||
return Fl_Widget::handle(event);
|
||||
}
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>You must return non-zero if your <TT>handle()</TT> method
|
||||
uses the event. If you return zero, the parent widget will try
|
||||
@@ -274,18 +274,17 @@ position. </P>
|
||||
Fl_Group</TT>, but you'll have to duplicate the code in <TT>Fl_Group</TT>
|
||||
anyways.
|
||||
<P>Instances of the child widgets may be included in the parent: </P>
|
||||
<UL><PRE>
|
||||
\code
|
||||
class MyClass : public Fl_Group {
|
||||
Fl_Button the_button;
|
||||
Fl_Slider the_slider;
|
||||
...
|
||||
};
|
||||
</PRE></UL>
|
||||
The constructor has to initialize these instances. They are
|
||||
automatically <TT>add()</TT>ed to the group, since the <TT>Fl_Group</TT>
|
||||
constructor does <TT>begin()</TT>. <I>Don't forget to call <TT>end()</TT>
|
||||
or use the <A href="Fl_End.html#Fl_End"><TT>Fl_End</TT></A> pseudo-class:</I>
|
||||
<UL><PRE>
|
||||
\endcode
|
||||
The constructor has to initialize these instances. They are automatically
|
||||
<TT>add()</TT>ed to the group, since the Fl_Group constructor does Fl_Group::begin().
|
||||
<I>Don't forget to call Fl_Group::end() or use the Fl_End pseudo-class:</I>
|
||||
\code
|
||||
MyClass::MyClass(int x, int y, int w, int h) :
|
||||
Fl_Group(x, y, w, h),
|
||||
the_button(x + 5, y + 5, 100, 20),
|
||||
@@ -294,29 +293,29 @@ MyClass::MyClass(int x, int y, int w, int h) :
|
||||
...(you could add dynamically created child widgets here)...
|
||||
end(); // don't forget to do this!
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
The child widgets need callbacks. These will be called with a pointer
|
||||
to the children, but the widget itself may be found in the <TT>parent()</TT>
|
||||
pointer of the child. Usually these callbacks can be static private
|
||||
methods, with a matching private method:
|
||||
<UL><PRE>
|
||||
\code
|
||||
void MyClass::static_slider_cb(Fl_Widget* v, void *) { // static method
|
||||
((MyClass*)(v->parent())->slider_cb();
|
||||
}
|
||||
void MyClass::slider_cb() { // normal method
|
||||
use(the_slider->value());
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
If you make the <TT>handle()</TT> method, you can quickly pass all the
|
||||
events to the children using the <TT>Fl_Group::handle()</TT> method.
|
||||
You don't need to override <TT>handle()</TT> if your composite widget
|
||||
does nothing other than pass events to the children:
|
||||
<UL><PRE>
|
||||
\code
|
||||
int MyClass::handle(int event) {
|
||||
if (Fl_Group::handle(event)) return 1;
|
||||
... handle events that children don't want ...
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
|
||||
<P>If you override <TT>draw()</TT> you need to draw all the
|
||||
children. If <TT>redraw()</TT> or <TT>damage()</TT> is called
|
||||
@@ -325,7 +324,7 @@ group, so this bit of <TT>damage()</TT> can be used to indicate
|
||||
that a child needs to be drawn. It is fastest if you avoid
|
||||
drawing anything else in this case:
|
||||
|
||||
<UL><PRE>
|
||||
\code
|
||||
int MyClass::draw() {
|
||||
Fl_Widget *const*a = array();
|
||||
if (damage() == FL_DAMAGE_CHILD) { // only redraw some children
|
||||
@@ -339,7 +338,7 @@ int MyClass::draw() {
|
||||
}
|
||||
}
|
||||
}
|
||||
</PRE></UL>
|
||||
\endcode
|
||||
<TT>Fl_Group</TT> provides some protected methods to make drawing
|
||||
easier:
|
||||
<UL>
|
||||
|
||||
Reference in New Issue
Block a user