mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 15:32:12 +08:00
"Final" changes for first draft of 1.0 documentation.
git-svn-id: file:///fltk/svn/fltk/trunk@187 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -53,11 +53,11 @@ after these.
|
||||
<li><a href="#Fl_Widget.argument">argument</a>
|
||||
<li><a href="#Fl_Widget.box">box</a>
|
||||
<li><a href="#Fl_Widget.callback">callback</a>
|
||||
<li><a href="#Fl_Widget.changed">changed</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td align=left valign=top>
|
||||
<ul>
|
||||
<li><a href="#Fl_Widget.changed">changed</a>
|
||||
<li><a href="#Fl_Widget.clear_changed">clear_changed</a>
|
||||
<li><a href="#Fl_Widget.color">color</a>
|
||||
<li><a href="#Fl_Widget.contains">contains</a>
|
||||
@@ -66,27 +66,22 @@ after these.
|
||||
<li><a href="#Fl_Widget.default_callback">default_callback</a>
|
||||
<li><a href="#Fl_Widget.do_callback">do_callback</a>
|
||||
<li><a href="#Fl_Widget.h">h</a>
|
||||
<li><a href="#Fl_Widget.hide">hide</a>
|
||||
<li><a href="#Fl_Widget.ih">ih</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td align=left valign=top>
|
||||
<ul>
|
||||
<li><a href="#Fl_Widget.init_size">init_size</a>
|
||||
<li><a href="#Fl_Widget.hide">hide</a>
|
||||
<li><a href="#Fl_Widget.inside">inside</a>
|
||||
<li><a href="#Fl_Widget.iw">iw</a>
|
||||
<li><a href="#Fl_Widget.ix">ix</a>
|
||||
<li><a href="#Fl_Widget.iy">iy</a>
|
||||
<li><a href="#Fl_Widget.label">label</a>
|
||||
<li><a href="#Fl_Widget.labelcolor">labelcolor</a>
|
||||
<li><a href="#Fl_Widget.labelfont">labelfont</a>
|
||||
<li><a href="#Fl_Widget.labelsize">labelsize</a>
|
||||
<li><a href="#Fl_Widget.labeltype">labeltype</a>
|
||||
<li><a href="#Fl_Widget.parent">parent</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td align=left valign=top>
|
||||
<ul>
|
||||
<li><a href="#Fl_Widget.parent">parent</a>
|
||||
<li><a href="#Fl_Widget.position">position</a>
|
||||
<li><a href="#Fl_Widget.redraw">redraw</a>
|
||||
<li><a href="#Fl_Widget.resize">resize</a>
|
||||
@@ -94,12 +89,13 @@ after these.
|
||||
<li><a href="#Fl_Widget.set_changed">set_changed</a>
|
||||
<li><a href="#Fl_Widget.show">show</a>
|
||||
<li><a href="#Fl_Widget.size">size</a>
|
||||
<li><a href="#Fl_Widget.type">type</a>
|
||||
<li><a href="#Fl_Widget.user_data">user_data</a>
|
||||
<li><a href="#Fl_Widget.take_focus">take_focus</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td align=left valign=top>
|
||||
<ul>
|
||||
<li><a href="#Fl_Widget.type">type</a>
|
||||
<li><a href="#Fl_Widget.user_data">user_data</a>
|
||||
<li><a href="#Fl_Widget.visible">visible</a>
|
||||
<li><a href="#Fl_Widget.w">w</a>
|
||||
<li><a href="#Fl_Widget.when">when</a>
|
||||
@@ -150,27 +146,11 @@ way to update the display, such as scrolling from the old position).
|
||||
<p><tt>position(x,y)</tt> is a shortcut for <tt>resize(x,y,w(),h())</tt>,
|
||||
and <tt>size(w,h)</tt> is a shortcut for <tt>resize(x(),y(),w,h)</tt>.
|
||||
|
||||
<h4><a name="Fl_Widget.ix">short Fl_Widget::ix() const</a><br>
|
||||
<a name="Fl_Widget.iy">short Fl_Widget::iy() const</a><br>
|
||||
<a name="Fl_Widget.iw">short Fl_Widget::iw() const</a><br>
|
||||
<a name="Fl_Widget.ih">short Fl_Widget::ih() const</a><br>
|
||||
<a name="Fl_Widget.init_size">void Fl_Widget::init_size(int,int,int,int)</a></h4>
|
||||
|
||||
The initial size and position of the widget. This is a copy of the
|
||||
arguments that the constructor was called with. This information is
|
||||
used by <a href="#Fl_Group"><tt>Fl_Group</tt></a> to calculate new sizes of
|
||||
the children when they are resized.
|
||||
|
||||
<p><tt>init_size()</tt> calls <tt>resize()</tt> with the passed sizes,
|
||||
and then replaces the initial size with the new values. If this widget
|
||||
is a group you will have to init_size all the children as well or
|
||||
unpredictable results will occur.
|
||||
|
||||
<h4><a name="Fl_Widget.window">Fl_Window* Fl_Widget::window() const;</a></h4>
|
||||
|
||||
Return a pointer to the <a href="#Fl_Window"><tt>Fl_Window</tt></a>
|
||||
that this widget is in (it will skip any and all parent widgets between
|
||||
this and the window). Returns NULL if none. Note: for an
|
||||
this and the window). Returns <tt>NULL</tt> if none. Note: for an
|
||||
<tt>Fl_Window</tt>, this returns it's <i>parent</i> window (if any),
|
||||
not <i>this</i> window.
|
||||
|
||||
@@ -376,5 +356,13 @@ this widget. Returns false if <tt>b</tt> is <tt>NULL</tt>.
|
||||
Returns true if this is a child of <tt>a</tt>, or is equal to <tt>a</tt>.
|
||||
Returns false if <tt>a</tt> is <tt>NULL</tt>.
|
||||
|
||||
<h4><a name="Fl_Widget.take_focus">int Fl_Widget::take_focus()</a></h4>
|
||||
|
||||
Tries to make this widget be the <tt>Fl::focus()</tt> widget, by first
|
||||
sending it an <tt>FL_FOCUS</tt> event, and if it returns non-zero,
|
||||
setting <tt>Fl::focus()</tt> to this widget. You should use this
|
||||
method to assign the focus to an widget. Returns true if the widget
|
||||
accepted the focus.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: Makefile,v 1.2 1998/12/29 14:58:59 mike Exp $"
|
||||
# "$Id: Makefile,v 1.3 1999/01/07 16:36:05 mike Exp $"
|
||||
#
|
||||
# Documentation makefile for the Fast Light Tool Kit (FLTK).
|
||||
#
|
||||
@@ -29,6 +29,8 @@ HTMLFILES = \
|
||||
src/basics.html \
|
||||
src/common.html \
|
||||
src/editor.html \
|
||||
src/drawing.html \
|
||||
src/events.html \
|
||||
src/subclassing.html \
|
||||
src/fluid.html \
|
||||
src/opengl.html \
|
||||
@@ -113,14 +115,14 @@ index.html: $(HTMLFILES)
|
||||
fltk.ps.gz: $(HTMLFILES)
|
||||
@echo "Generating PostScript documentation..."
|
||||
@rm -f fltk.ps fltk.ps.gz
|
||||
@htmldoc -f fltk.ps --no-compression --jpeg=90 --duplex --verbose --toclevels 2 --title src/FL.gif $(HTMLFILES)
|
||||
@htmldoc -f fltk.ps --jpeg=90 --duplex --verbose --toclevels 2 --title src/FL.gif $(HTMLFILES)
|
||||
@gzip -9 fltk.ps
|
||||
|
||||
fltk.pdf: $(HTMLFILES)
|
||||
@echo "Generating PDF documentation..."
|
||||
@rm -f fltk.pdf
|
||||
@htmldoc -f fltk.pdf --no-compression --jpeg=90 --duplex --verbose --toclevels 2 --title src/FL.gif $(HTMLFILES)
|
||||
@htmldoc -f fltk.pdf --compression=9 --jpeg=90 --duplex --verbose --toclevels 2 --title src/FL.gif $(HTMLFILES)
|
||||
|
||||
#
|
||||
# End of "$Id: Makefile,v 1.2 1998/12/29 14:58:59 mike Exp $".
|
||||
# End of "$Id: Makefile,v 1.3 1999/01/07 16:36:05 mike Exp $".
|
||||
#
|
||||
|
||||
@@ -31,7 +31,7 @@ The proper way to include FLTK header files is:
|
||||
#include <FL/Fl_xyz.H>
|
||||
</pre></ul>
|
||||
|
||||
Microsoft Windows developers please note: case *is* significant
|
||||
<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:
|
||||
@@ -71,9 +71,8 @@ header files. This can be done by selecting "Settings" from the
|
||||
|
||||
<p>You can build your Microsoft Windows applications as Console or
|
||||
WIN32 applications. If you want to use the standard C <tt>main()</tt>
|
||||
function as the entry point, enter the name <tt>mainCRTStartup</tt> in
|
||||
the "Entry-point symbol" field in the "Output" settings under the
|
||||
"Link" tab.
|
||||
function as the entry point, FLTK includes a <tt>WinMain()</tt> function
|
||||
that will call your <tt>main()</tt> function for you.
|
||||
|
||||
<p><i>Note: The Visual C++ optimizer is known to cause problems with
|
||||
many programs. We only recommend using the "Favor Small Code"
|
||||
@@ -155,7 +154,7 @@ 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="#common">Chapter
|
||||
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
|
||||
@@ -170,7 +169,7 @@ governed by the underlying window system or hardware.
|
||||
<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
|
||||
is used for the label in the title bar. Our example program calls the
|
||||
<a href="#Fl_Widget.labelfont"><tt>labelfont</tt></a>,
|
||||
<a href="#Fl_Widget.labelsize"><tt>labelsize</tt></a>, and
|
||||
<a href="#Fl_Widget.labeltype"><tt>labeltype</tt></a> methods.
|
||||
@@ -185,7 +184,7 @@ directly.
|
||||
<p>The <tt>labeltype</tt> method sets the type of label. FLTK supports
|
||||
normal, embossed, shadowed, symbol, and image labels.
|
||||
|
||||
<p>A complete list of all label options can be found in <a href="#common">
|
||||
<p>A complete list of all label options can be found in <a href="#labels">
|
||||
Chapter 3</a>.
|
||||
|
||||
<H3>Showing the Window</H3>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<HTML>
|
||||
<BODY>
|
||||
|
||||
<H1 ALIGN=RIGHT>3 - Common Widgets and Attributes</H1>
|
||||
<H1 ALIGN=RIGHT><A NAME="common">3 - Common Widgets and Attributes</A></H1>
|
||||
|
||||
This chapter describes many of the widgets that are provided with FLTK and covers how
|
||||
to query and set the standard attributes.
|
||||
@@ -119,7 +119,7 @@ window->size(width, height);
|
||||
Changing the size or position of a widget will cause a redraw of that widget
|
||||
and its children.
|
||||
|
||||
<H2>Colors</H2>
|
||||
<H2><A NAME="colors">Colors</A></H2>
|
||||
|
||||
FLTK manages a virtual color palette of "standard" colors. The
|
||||
standard colors are:
|
||||
@@ -148,7 +148,7 @@ Similarly, the label color can be set using the <tt>labelcolor()</tt> method:
|
||||
button->labelcolor(FL_WHITE);
|
||||
</pre></ul>
|
||||
|
||||
<H2>Box Types</H2>
|
||||
<H2><A NAME="boxtypes">Box Types</A></H2>
|
||||
|
||||
<p>The type <tt>Fl_Boxtype</tt> stored and returned in <a href="#Fl_Widget.box">
|
||||
<tt>Fl_Widget::box()</tt></a> is an enumeration defined in
|
||||
@@ -204,9 +204,9 @@ The last 4 arguments to <tt>Fl::set_boxtype()</tt> are the offsets
|
||||
for the bounding box that should be subtracted when drawing the label
|
||||
inside the box.
|
||||
|
||||
<H2>Labels and Label Types</H2>
|
||||
<H2><A NAME="labels">Labels and Label Types</A></H2>
|
||||
|
||||
The <tt>label()</tt>, <tt>align</tt>, <tt>labelfont()</tt>, <tt>labelsize()<tt>,
|
||||
The <tt>label()</tt>, <tt>align</tt>, <tt>labelfont()</tt>, <tt>labelsize()</tt>,
|
||||
and <tt>labeltype()</tt> methods control the labeling of widgets.
|
||||
|
||||
<H3>label()</H3>
|
||||
|
||||
+417
-1031
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
<HTML>
|
||||
<BODY>
|
||||
|
||||
<H1 ALIGN=RIGHT>4 - Designing a Simple Text Editor</H1>
|
||||
<H1 ALIGN=RIGHT><A NAME="editor">4 - Designing a Simple Text Editor</A></H1>
|
||||
|
||||
This chapter takes you through the design of a simple FLTK-based text editor.
|
||||
|
||||
@@ -295,7 +295,7 @@ We call the <tt>load_file()</tt> function to actually load the file.
|
||||
<H3>paste_cb()</H3>
|
||||
|
||||
This callback function will send a FL_PASTE message to the <tt>input</tt>
|
||||
widget using the <a href="#paste"><tt>Fl::paste()</tt> method:
|
||||
widget using the <a href="#paste"><tt>Fl::paste()</tt></a> method:
|
||||
|
||||
<ul><pre>
|
||||
void paste_cb(void) {
|
||||
@@ -514,7 +514,7 @@ void load_file(char *newfile) {
|
||||
</pre></ul>
|
||||
|
||||
When loading the file we use the <a href="#Fl_Input_.replace">
|
||||
<tt>input->replace()</tt> method to "replace" the text at the end of
|
||||
<tt>input->replace()</tt></a> method to "replace" the text at the end of
|
||||
the buffer. The <tt>pos</tt> variable keeps track of the end of the
|
||||
buffer.
|
||||
|
||||
|
||||
+340
-295
File diff suppressed because it is too large
Load Diff
+145
-419
File diff suppressed because it is too large
Load Diff
+273
-301
File diff suppressed because it is too large
Load Diff
+181
-140
@@ -3,182 +3,193 @@
|
||||
|
||||
<H1 ALIGN=RIGHT><A NAME="forms">E - Forms Compatibility</A></H1>
|
||||
|
||||
<a href="#fluid">Fluid</a> (the Fast Light User Interface Designer)
|
||||
can read the .fd files put out by all versions of Forms and XForms
|
||||
fdesign. However, it will mangle them a bit, but it prints a warning
|
||||
message about anything it does not understand. Fluid cannot write
|
||||
fdesign files, so you should save to a new name so you don't write
|
||||
over the old one.
|
||||
This appendix describes the Forms compatibility included with FLTK.
|
||||
|
||||
<H2>Importing Forms Layout Files</H2>
|
||||
|
||||
<a href="#FLUID">FLUID</a> can read the .fd files put out by all
|
||||
versions of Forms and XForms fdesign. However, it will mangle them a
|
||||
bit, but it prints a warning message about anything it does not
|
||||
understand. FLUID cannot write fdesign files, so you should save to a
|
||||
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 compatability header,
|
||||
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>You should be able to compile existing Forms or XForms source code
|
||||
by changing the -I switch to your compiler so that the forms.h file
|
||||
supplied with FLTK is included. Take a look at forms.h to see how it
|
||||
works, but the basic trick is lots of inline functions.
|
||||
Most of the XForms demo programs work without changes.
|
||||
<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>forms.h</tt> file supplied with FLTK is included. Take a look at
|
||||
<tt>forms.h</tt> to see how it works, but the basic trick is lots of
|
||||
inline functions. Most of the XForms demo programs work without
|
||||
changes.
|
||||
|
||||
<p>You will also have to compile your Forms or XForms program using a
|
||||
C++ compiler. The FLTK library does not provide C bindings or header
|
||||
files.
|
||||
|
||||
<p>Although FLTK was designed to be compatable with the GL Forms library
|
||||
(version 0.3 or so), XForms has bloated severely and it's interface is
|
||||
X specific. Therefore, XForms compatability is no longer a goal of
|
||||
FLTK. Compatability was limited to things that were free, or that
|
||||
would add code that would not be linked in if the feature is unused.
|
||||
I did not add anything that would make the FLTK widgets bigger, or that
|
||||
used X types as arguments.
|
||||
X-specific. Therefore, XForms compatibility is no longer 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>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 it a lot cleaner and make it easier to figure out how to
|
||||
call the FLTK functions. Unfortunately this conversion is harder than I
|
||||
expeceted and even our inhouse code still uses forms.H a lot.
|
||||
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.
|
||||
|
||||
<h2>Problems you will encounter</h2>
|
||||
|
||||
<ul>
|
||||
|
||||
<p><li>Many parts of XForms use X-specific structures like XEvent in
|
||||
their interface. I did not emulate these! Unfortunately these
|
||||
<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
|
||||
programs. You will need to rewrite these to use FLTK subclasses.
|
||||
|
||||
<p><li><a href=Fl_Free.html>Fl_Free</a> widgets emulate the <i>old</i>
|
||||
Forms "free" widget. It may be useful for porting programs that
|
||||
change the handle() function on widgets, but you will still need to
|
||||
rewrite things.
|
||||
<p><a href="#Fl_Free"><tt>Fl_Free</tt></a> widgets emulate 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><li><a href=Fl_Timer.html>Fl_Timer</a> widgets are provided to
|
||||
emulate the XForms timer. These work, but are quite inefficient
|
||||
and inaccurate compared to using Fl::add_timeout().
|
||||
<p><a href="#Fl_Timer"><tt>Fl_Timer</tt></a> widgets are provided to
|
||||
emulate the XForms timer. These work, but are quite inefficient and
|
||||
inaccurate compared to using <a
|
||||
href="#add_timeout"><tt>Fl::add_timeout()</tt></a>.
|
||||
|
||||
<p><li><i>All instance variables are hidden.</i>
|
||||
<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().
|
||||
with "->x()", etc. Replace "boxtype" with "box()".
|
||||
|
||||
<p><li>const char* arguments to most FLTK methods are simply stored, while
|
||||
Forms would strdup() the passed string. This is most noticable with the
|
||||
label of widgets. Your program must always pass static data such as a
|
||||
string constant or malloc'd buffer to label(). If you are using
|
||||
labels to display program output you may want to try the <a
|
||||
href=Fl_Output.html>Fl_Output</a> widget.
|
||||
<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
|
||||
pass static data such as a string constant or malloc'd buffer to
|
||||
<tt>label()</tt>. If you are using labels to display program output
|
||||
you may want to try the <a href="#Fl_Output"><tt>Fl_Output</tt></a> widget.
|
||||
|
||||
<p><li>The default fonts and sizes are matched to the older GL version of
|
||||
<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><li>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
|
||||
user_data() field of a window. To do this,
|
||||
search through the fdesign output for all occurances
|
||||
of "->fdui" and edit to use "->user_data()" instead. This will
|
||||
require casts and is not trivial.
|
||||
<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. This will require casts and is not trivial.
|
||||
|
||||
<p><li>The prototype for the functions passed to fl_add_timeout() and
|
||||
fl_set_idle_callback() callback are different.
|
||||
<p>The prototype for the functions passed to <tt>fl_add_timeout()</tt>
|
||||
and <tt>fl_set_idle_callback()</tt> callback are different.
|
||||
|
||||
<p><li><b>All the following XForms calls are missing:</b><p>
|
||||
<p><b>All the following XForms calls are missing:</b><p>
|
||||
|
||||
<li><code>FL_VERSION, FL_REVISION</code>, fl_library_version()
|
||||
<li><code>FL_RETURN_DBLCLICK</code> (use Fl::event_clicks())
|
||||
<li>fl_add_signal_callback()
|
||||
<li>fl_set_form_atactivate() & fl_set_form_atdeactivate()
|
||||
<li>fl_set_form_property()
|
||||
<li>fl_set_app_mainform(), fl_get_app_mainform()
|
||||
<li>fl_set_form_minsize(), fl_set_form_maxsize()
|
||||
<li>fl_set_form_event_cmask(), fl_get_form_event_cmask()
|
||||
<li>fl_set_form_dblbuffer(), fl_set_object_dblbuffer() (use an
|
||||
Fl_Double_Window instead)
|
||||
<li>fl_adjust_form_size()
|
||||
<li>fl_register_raw_callback()
|
||||
<li>fl_set_object_bw(), fl_set_border_width()
|
||||
<li>fl_set_object_resize(), fl_set_object_gravity()
|
||||
<li>fl_set_object_shortcutkey()
|
||||
<li>fl_set_object_automatic()
|
||||
<li>fl_get_object_bbox() (maybe FLTK should do this)
|
||||
<li>fl_set_object_prehandler(), fl_set_object_posthandler()
|
||||
<li>fl_enumerate_fonts()
|
||||
<li>Most drawing functions
|
||||
<li>fl_set_coordunit() (FLTK uses pixels all the time)
|
||||
<li>fl_ringbell()
|
||||
<li>fl_gettime()
|
||||
<li>fl_win*() (all these functions)
|
||||
<li>fl_initialize(argc,argv,x,y,z) ignores last 3 arguments
|
||||
<li>fl_read_bitmapfile(), fl_read_pixmapfile()
|
||||
<li>fl_addto_browser_chars()
|
||||
<li>FL_MENU_BUTTON just draws normally
|
||||
<li>fl_set_bitmapbutton_file(), fl_set_pixmapbutton_file()
|
||||
<li>FL_CANVAS objects
|
||||
<li>FL_DIGITAL_CLOCK (comes out analog)
|
||||
<li>fl_create_bitmap_cursor(), fl_set_cursor_color()
|
||||
<li>fl_set_dial_angles()
|
||||
<li>fl_show_oneliner()
|
||||
<li>fl_set_choice_shortcut(a,b,c)
|
||||
<li>command log
|
||||
<li>Only some of file selector is emulated
|
||||
<li>FL_DATE_INPUT
|
||||
<li>fl_pup*() (all these functions)
|
||||
<li>textbox object (should be easy but I had no sample programs)
|
||||
<li>xyplot object
|
||||
<ul>
|
||||
<li><tt>FL_REVISION</tt>, <tt>fl_library_version()</tt>
|
||||
<li><tt>FL_RETURN_DBLCLICK</tt> (use <tt>Fl::event_clicks()</tt>)
|
||||
<li><tt>fl_add_signal_callback()</tt>
|
||||
<li><tt>fl_set_form_atactivate()</tt> & <tt>fl_set_form_atdeactivate()</tt>
|
||||
<li><tt>fl_set_form_property()</tt>
|
||||
<li><tt>fl_set_app_mainform()</tt>, <tt>fl_get_app_mainform()</tt>
|
||||
<li><tt>fl_set_form_minsize()</tt>, <tt>fl_set_form_maxsize()</tt>
|
||||
<li><tt>fl_set_form_event_cmask()</tt>, <tt>fl_get_form_event_cmask()</tt>
|
||||
<li><tt>fl_set_form_dblbuffer()</tt>, <tt>fl_set_object_dblbuffer()</tt> (use an
|
||||
<tt>Fl_Double_Window</tt> instead)
|
||||
<li><tt>fl_adjust_form_size()</tt>
|
||||
<li><tt>fl_register_raw_callback()</tt>
|
||||
<li><tt>fl_set_object_bw()</tt>, <tt>fl_set_border_width()</tt>
|
||||
<li><tt>fl_set_object_resize()</tt>, <tt>fl_set_object_gravity()</tt>
|
||||
<li><tt>fl_set_object_shortcutkey()</tt>
|
||||
<li><tt>fl_set_object_automatic()</tt>
|
||||
<li><tt>fl_get_object_bbox()</tt> (maybe FLTK should do this)
|
||||
<li><tt>fl_set_object_prehandler()</tt>, <tt>fl_set_object_posthandler()</tt>
|
||||
<li><tt>fl_enumerate_fonts()</tt>
|
||||
<li>Most drawing functions
|
||||
<li><tt>fl_set_coordunit()</tt> (FLTK uses pixels all the time)
|
||||
<li><tt>fl_ringbell()</tt>
|
||||
<li><tt>fl_gettime()</tt>
|
||||
<li><tt>fl_win*()</tt> (all these functions)
|
||||
<li><tt>fl_initialize(argc,argv,x,y,z)</tt> ignores last 3 arguments
|
||||
<li><tt>fl_read_bitmapfile()</tt>, <tt>fl_read_pixmapfile()</tt>
|
||||
<li><tt>fl_addto_browser_chars()</tt>
|
||||
<li><tt>FL_MENU_BUTTON</tt> just draws normally
|
||||
<li><tt>fl_set_bitmapbutton_file()</tt>, <tt>fl_set_pixmapbutton_file()</tt>
|
||||
<li><tt>FL_CANVAS</tt> objects
|
||||
<li><tt>FL_DIGITAL_CLOCK</tt> (comes out analog)
|
||||
<li><tt>fl_create_bitmap_cursor()</tt>, <tt>fl_set_cursor_color()</tt>
|
||||
<li><tt>fl_set_dial_angles()</tt>
|
||||
<li><tt>fl_show_oneliner()</tt>
|
||||
<li><tt>fl_set_choice_shortcut(a,b,c)
|
||||
<li>command log
|
||||
<li>Only some of file selector is emulated
|
||||
<li><tt>FL_DATE_INPUT</tt>
|
||||
<li><tt>fl_pup*()</tt> (all these functions)
|
||||
<li>textbox object (should be easy but I had no sample programs)
|
||||
<li>xyplot object
|
||||
</ul>
|
||||
|
||||
<h2>Additional notes for porting old Forms programs</h2>
|
||||
<h2>Additional Notes</h2>
|
||||
|
||||
<p>These notes were written for porting programs written with the
|
||||
older GL version of Forms. Most of these problems are the same ones
|
||||
These notes were written for porting programs written with the older
|
||||
IRISGL version of Forms. Most of these problems are the same ones
|
||||
encountered when going from old Forms to XForms:
|
||||
|
||||
<h4>Does not go into background</h4>
|
||||
<h3>Does Not Run In Background</h3>
|
||||
|
||||
The GL library always forked when you created the first window, unless
|
||||
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.
|
||||
|
||||
<h4>You cannot use GL windows or fl_queue</h4>
|
||||
<h3>You Cannot Use IRISGL windows or fl_queue</h3>
|
||||
|
||||
<P>If a Forms (not XForms) program if you wanted your own window for
|
||||
displaying things you would create a GL window and draw in it,
|
||||
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,
|
||||
periodically calling Forms to check if the user hit buttons on the
|
||||
panels. If the user did things to the GL window, you would find this
|
||||
out by having the value FL_EVENT returned from the call to Forms.
|
||||
panels. If the user did things to the IRISGL window, you would find
|
||||
this out by having the value FL_EVENT returned from the call to Forms.
|
||||
|
||||
<p>None of this works with FLTK. Nor will it compile, the necessary
|
||||
calls are not in the interface.
|
||||
|
||||
<p>You have to make a subclass of <a
|
||||
href=Fl_Gl_Window.html>Fl_Gl_Window</a> and write a draw() method and
|
||||
handle() method. This may require anywhere from a trivial to a major
|
||||
rewrite. See the example program <a href=shape.C.html>shape.C</a> for
|
||||
how this is structured.
|
||||
href="#Fl_Gl_Window"><tt>Fl_Gl_Window</tt></a> and write a <tt>draw()</tt>
|
||||
method and <tt>handle()</tt> method. This may require anywhere from a trivial
|
||||
to a major rewrite.
|
||||
|
||||
<p>If you draw into the overlay planes you will have to also write a
|
||||
draw_overlay() routine and call redraw_overlay() on the gl window.
|
||||
<tt>draw_overlay()</tt> method and call <tt>redraw_overlay()</tt> on the
|
||||
OpenGL window.
|
||||
|
||||
<p>One easy way to hack your program so it works is to make the draw()
|
||||
and handle() methods on your window set some static variables, storing
|
||||
what event happened. Then in the main loop of your program, call
|
||||
Fl::wait() and then check these variables, acting on them as
|
||||
though they are events read from fl_queue.
|
||||
<p>One easy way to hack your program so it works is to make the
|
||||
<tt>draw()</tt> and <tt>handle()</tt> methods on your window set some
|
||||
static variables, storing what event happened. Then in the main loop
|
||||
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>.
|
||||
|
||||
<h4>You must use OpenGL to draw everything</h4>
|
||||
<h3>You Must Use OpenGL to Draw Everything</h3>
|
||||
|
||||
<p>The file <FL/gl.h> defines replacements for a lot of gl calls,
|
||||
translating them to OpenGL. There are much better translators
|
||||
available that you might want to investigate.
|
||||
<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.
|
||||
|
||||
<h4>You cannot make Forms subclasses</h4>
|
||||
<h3>You Cannot Make Forms Subclasses</h3>
|
||||
|
||||
Programs that call fl_make_object or directly setting the handle
|
||||
routine will not compile. You have to rewrite them to use a subclass
|
||||
of Fl_Widget. It is important to note that the handle() method is not
|
||||
exactly the same as the handle() function of Forms. Where a Forms
|
||||
handle() returned non-zero, your handle() must call do_callback().
|
||||
And your handle() must return non-zero if it "understood" the event.
|
||||
Programs that call <tt>fl_make_object</tt> or directly setting the
|
||||
handle routine will not compile. You have to rewrite them to use a
|
||||
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 to work quite well. It may be quicker to modify your subclass
|
||||
@@ -187,34 +198,64 @@ into a "free" widget, since the "handle" functions match.
|
||||
<p>If your subclass draws into the overlay you are in trouble and will
|
||||
have to rewrite things a lot.
|
||||
|
||||
<h4>You cannot use <device.h></h4>
|
||||
<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:
|
||||
|
||||
<table>
|
||||
<tr><td align=center>Forms <td align=center>FLTK
|
||||
<tr><td>MOUSE_X <td>Fl::event_x_root()
|
||||
<tr><td>MOUSE_Y<td> Fl::event_y_root()
|
||||
<tr><td>LEFTSHIFTKEY,RIGHTSHIFTKEY<td> Fl::event_shift()
|
||||
<tr><td>CAPSLOCKKEY<td> Fl::event_capslock()
|
||||
<tr><td>LEFTCTRLKEY,RIGHTCTRLKEY<td> Fl::event_ctrl()
|
||||
<tr><td>LEFTALTKEY,RIGHTALTKEY<td> Fl::event_alt()
|
||||
<tr><td>MOUSE1,RIGHTMOUSE<td> Fl::event_state()&(1<<10)
|
||||
<tr><td>MOUSE2,MIDDLEMOUSE<td> Fl::event_state()&(1<<9)
|
||||
<tr><td>MOUSE3,LEFTMOUSE<td> Fl::event_state()&(1<<8)
|
||||
<table border=1>
|
||||
<tr>
|
||||
<th align=center>Forms</th>
|
||||
<th align=center>FLTK</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MOUSE_X</td>
|
||||
<td>Fl::event_x_root()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MOUSE_Y</td>
|
||||
<td>Fl::event_y_root()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LEFTSHIFTKEY,RIGHTSHIFTKEY</td>
|
||||
<td>Fl::event_shift()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CAPSLOCKKEY</td>
|
||||
<td>Fl::event_capslock()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LEFTCTRLKEY,RIGHTCTRLKEY</td>
|
||||
<td>Fl::event_ctrl()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>LEFTALTKEY,RIGHTALTKEY</td>
|
||||
<td>Fl::event_alt()</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MOUSE1,RIGHTMOUSE</td>
|
||||
<td>Fl::event_state()&FL_BUTTON3</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MOUSE2,MIDDLEMOUSE</td>
|
||||
<td>Fl::event_state()&FL_BUTTON2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MOUSE3,LEFTMOUSE</td>
|
||||
<td>Fl::event_state()&FL_BUTTON1</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>Anything else in getvaluator and you are on your own...
|
||||
Anything else in <tt>getvaluator</tt> and you are on your own...
|
||||
|
||||
<h4>Font numbers are different</h4>
|
||||
<h3>Font Numbers Are Different</h3>
|
||||
|
||||
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>
|
||||
FLTK. If you are really desperate to fix this use the following code:
|
||||
|
||||
<pre>
|
||||
<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*");
|
||||
|
||||
+933
-635
File diff suppressed because it is too large
Load Diff
+141
-92
@@ -3,143 +3,192 @@
|
||||
|
||||
<H1 ALIGN=RIGHT><A NAME="glut">D - GLUT Compatibility</A></H1>
|
||||
|
||||
You should be able to compile existing Glut source code by
|
||||
including <FL/glut.H> instead of <GL/glut.h>. This can be done by
|
||||
editing the source, by changing the -I switches to the compiler, or by
|
||||
providing a symbolic link from GL/glut.h to FL/glut.H.
|
||||
This appendix describes the GLUT compatibility header file supplied with
|
||||
FLTK.
|
||||
|
||||
<p>All files calling glut procedures must be compiled with C++. You may
|
||||
<H2>Using the GLUT Compatibility Header File</H2>
|
||||
|
||||
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><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.
|
||||
I was unable to get some calls to glu to compile without adding some
|
||||
casts, apparently due to errors in the glu header files.
|
||||
|
||||
<p>You must link with -lFl. If you call any glut drawing functions
|
||||
that fltk does not emulate (<code>glutExtensionsSupported(), glutWire*(),
|
||||
glutSolid*(), and glutStroke*()</code>), you will also have to link with
|
||||
-lglut, <i>after</i> -lFl.
|
||||
<p>You must link with the FLTK library. If you call any GLUT drawing
|
||||
functions that FLTK does not emulate
|
||||
(<tt>glutExtensionsSupported()</tt>, <tt>glutWire*()</tt>,
|
||||
<tt>glutSolid*()</tt>, and <tt>glutStroke*()</tt>), you will also have
|
||||
to link with the GLUT library (<i>after</i> the FLTK library!)
|
||||
|
||||
<p>Most of glut.H is inline functions. You should take a look at it
|
||||
(and maybe at glut.C in the fltk source) if you are having trouble
|
||||
porting your Glut program.
|
||||
<p>Most of <tt>FL/glut.H</tt> is inline functions. You should take a
|
||||
look at it (and maybe at <tt>test/glut.cxx</tt> in the FLTK source) if
|
||||
you are having trouble porting your GLUT program.
|
||||
|
||||
<p>This has been tested with most of the demo programs that come with
|
||||
the Glut 3.3 distribution.
|
||||
the GLUT 3.3 distribution.
|
||||
|
||||
<h2>Known Problems</h2>
|
||||
|
||||
The following functions and/or arguments to functions are missing,
|
||||
and you will have to replace them or comment them out for your code to
|
||||
compile:
|
||||
|
||||
<ul>
|
||||
|
||||
<li>The following functions and/or arguments to functions are missing,
|
||||
and you will have to replace them or comment them out for your code to
|
||||
compile:<ul>
|
||||
|
||||
<li><code>glutLayerGet(GLUT_LAYER_IN_USE)</code>
|
||||
<li><code>glutLayerGet(GLUT_HAS_OVERLAY)</code>
|
||||
<li><code>glutSetColor(), glutGetColor(), glutCopyColormap()</code>
|
||||
<li><code>glutInitDisplayMode(GLUT_STEREO)</code>
|
||||
<li><code>glutInitDisplayMode(GLUT_LUMINANCE)</code>
|
||||
<li><code>glutPushWindow()</code>
|
||||
<li><code>glutWarpPointer()</code>
|
||||
<li>Spaceball, buttonbox, dials, tablet functions, <code>glutDeviceGet()</code>
|
||||
<li><code>glutWindowStatusFunc()</code>
|
||||
<li><code>glutGet(GLUT_WINDOW_NUM_CHILDREN)</code>
|
||||
<li><code>glutGet(GLUT_SCREEN_WIDTH_MM)</code>
|
||||
<li><code>glutGet(GLUT_SCREEN_HEIGHT_MM)</code>
|
||||
<li><code>glutGet(GLUT_ELAPSED_TIME)</code>
|
||||
<li><code>glutVideoResize()</code> missing.
|
||||
<li><tt>glutLayerGet(GLUT_LAYER_IN_USE)</tt>
|
||||
<li><tt>glutLayerGet(GLUT_HAS_OVERLAY)</tt>
|
||||
<li><tt>glutSetColor(), glutGetColor(), glutCopyColormap()</tt>
|
||||
<li><tt>glutInitDisplayMode(GLUT_STEREO)</tt>
|
||||
<li><tt>glutInitDisplayMode(GLUT_LUMINANCE)</tt>
|
||||
<li><tt>glutPushWindow()</tt>
|
||||
<li><tt>glutWarpPointer()</tt>
|
||||
<li>Spaceball, buttonbox, dials, tablet functions,
|
||||
<tt>glutDeviceGet()</tt>
|
||||
<li><tt>glutWindowStatusFunc()</tt>
|
||||
<li><tt>glutGet(GLUT_WINDOW_NUM_CHILDREN)</tt>
|
||||
<li><tt>glutGet(GLUT_SCREEN_WIDTH_MM)</tt>
|
||||
<li><tt>glutGet(GLUT_SCREEN_HEIGHT_MM)</tt>
|
||||
<li><tt>glutGet(GLUT_ELAPSED_TIME)</tt>
|
||||
<li><tt>glutVideoResize()</tt> missing.
|
||||
|
||||
</ul>
|
||||
|
||||
<li>Most of the symbols/enumerations have different values than
|
||||
Glut uses. This will break code that relies on the actual values.
|
||||
Most of the symbols/enumerations have different values than
|
||||
GLUT uses. This will break code that relies on the actual values.
|
||||
The only symbols guaranteed to have the same values are true/false
|
||||
pairs like <code>GLUT_DOWN</code> and <code>GLUT_UP</code>, mouse
|
||||
buttons <code>GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON,
|
||||
GLUT_RIGHT_BUTTON</code>, and <code>GLUT_KEY_F1</code> thru
|
||||
<code>F12</code>.
|
||||
pairs like <tt>GLUT_DOWN</tt> and <tt>GLUT_UP</tt>, mouse
|
||||
buttons <tt>GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON,
|
||||
GLUT_RIGHT_BUTTON</tt>, and <tt>GLUT_KEY_F1</tt> thru
|
||||
<tt>F12</tt>.
|
||||
|
||||
<li><i>The strings passed as menu labels are not copied</i>.
|
||||
<p>The strings passed as menu labels are not copied.
|
||||
|
||||
<li><code>glutPostRedisplay()</code> does not work if called from
|
||||
inside a display function. You must use <code>glutIdleFunc()</code>
|
||||
<p><tt>glutPostRedisplay()</tt> does not work if called from
|
||||
inside a display function. You must use <tt>glutIdleFunc()</tt>
|
||||
if you want your display to update continuously.
|
||||
|
||||
<li><code>glutSwapBuffers()</code> does not work from inside a display
|
||||
function. This is on purpose, because fltk swaps the buffers for you.
|
||||
<p><tt>glutSwapBuffers()</tt> does not work from inside a display
|
||||
function. This is on purpose, because FLTK swaps the buffers for you.
|
||||
|
||||
<li><code>glutUseLayer()</code> does not work well, and should only be
|
||||
<p><tt>glutUseLayer()</tt> does not work well, and should only be
|
||||
used to initialize transformations inside a resize callback. You
|
||||
should redraw overlays by using <code>glutOverlayDisplayFunc()</code>.
|
||||
should redraw overlays by using <tt>glutOverlayDisplayFunc()</tt>.
|
||||
|
||||
<li>Overlays are cleared before the overlay display function is
|
||||
called. <code>glutLayerGet(GLUT_OVERLAY_DAMAGED)</code> always
|
||||
returns true, this fixed some glut overlay programs. You must rewrite
|
||||
your code so that gl_color() is used to choose colors in an overlay,
|
||||
or you will get random overlay colors.
|
||||
<p>Overlays are cleared before the overlay display function is called.
|
||||
<tt>glutLayerGet(GLUT_OVERLAY_DAMAGED)</tt> always returns true for
|
||||
compatibility with some GLUT overlay programs. You must rewrite your
|
||||
code so that <tt>gl_color()</tt> is used to choose colors in an
|
||||
overlay, or you will get random overlay colors.
|
||||
|
||||
<li><code>glutSetCursor(GLUT_CURSOR_FULL_CROSSHAIR)</code> just
|
||||
<p><tt>glutSetCursor(GLUT_CURSOR_FULL_CROSSHAIR)</tt> just
|
||||
results in a small crosshair.
|
||||
|
||||
<li>The fonts used by <code>glutBitmapCharacter() and
|
||||
glutBitmapWidth()</code> may be different.
|
||||
<p>The fonts used by <tt>glutBitmapCharacter() and
|
||||
glutBitmapWidth()</tt> may be different.
|
||||
|
||||
<li><code>glutInit(argc,argv)</code> will consume different switches than glut
|
||||
<p><tt>glutInit(argc,argv)</tt> will consume different switches than GLUT
|
||||
does. It accepts the switches recognized by <a
|
||||
href=Fl.html>Fl_Window::arg()</a>, and will accept any
|
||||
abbreviation of these switches (such as -d for -display).
|
||||
href="#args"><tt>Fl::args()</tt></a>, and will accept any
|
||||
abbreviation of these switches (such as "-di" for "-display").
|
||||
|
||||
<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>'ing the window at the point it is created, which means the
|
||||
<tt>Fl_Window</tt> parent window must already be shown.
|
||||
|
||||
<ul>
|
||||
|
||||
<li>Don't call <tt>glutInit()</tt>.
|
||||
|
||||
<li>Create your <tt>Fl_Window</tt>, and any FLTK widgets.
|
||||
Leave a blank area in the window for your GLUT window.
|
||||
|
||||
<li><tt>show()</tt> the <tt>Fl_Window</tt>. Perhaps call
|
||||
<tt>show(argc,argv)</tt>.
|
||||
|
||||
<li>Call <tt>window->begin()</tt> so that the GLUT window will
|
||||
be automatically added to it.
|
||||
|
||||
<li>Use <tt>glutInitWindowSize()</tt> and
|
||||
<tt>glutInitWindowPosition()</tt> to set the location in the
|
||||
parent window to put the GLUT window.
|
||||
|
||||
<li>Put your GLUT code next. It probably does not need many changes.
|
||||
Call <tt>window->end()</tt> immediately after the <tt>glutCreateWindow()</tt>!
|
||||
|
||||
<li>You can call either <tt>glutMainLoop()</tt>,
|
||||
<tt>Fl::run()</tt>, or loop calling <tt>Fl::wait()</tt> to run
|
||||
the program.
|
||||
|
||||
</ul>
|
||||
|
||||
<h2>Mixing Glut code and Fltk code</h2>
|
||||
<hr break>
|
||||
|
||||
You can make your Glut window a child of a Fl_Window with the
|
||||
following scheme. The biggest trick is that Glut insists on
|
||||
show()'ing the window at the point it is created, which means the
|
||||
Fl_Window parent window must already be show()n.
|
||||
<h2><a name="Fl_Glut_Window">class Fl_Glut_Window</a></h2>
|
||||
|
||||
<p>Don't call glutInit().
|
||||
<hr>
|
||||
|
||||
<p>Create your Fl_Window, and any fltk widgets. Leave a blank area in
|
||||
the window for your glut window.
|
||||
<h3>Class Hierarchy</h3>
|
||||
|
||||
<p>show() the Fl_Window. Perhaps call show(argc,argv).
|
||||
<ul><pre>
|
||||
<a href="#Fl_Gl_Window">Fl_Gl_Window</a>
|
||||
|
|
||||
+----<b>Fl_Glut_Window</b>
|
||||
</pre></ul>
|
||||
|
||||
<p>Call window->begin() so the glut window will be automatically added
|
||||
to it.
|
||||
<h3>Include Files</h3>
|
||||
|
||||
<p>Use glutInitWindowSize() and glutInitWindowPosition() to set the
|
||||
location in the parent window to put the glut window.
|
||||
<ul><pre>
|
||||
#include <FL/glut.H>
|
||||
</pre></ul>
|
||||
|
||||
<p>Put your glut code next. It probably does not need many changes.
|
||||
Call window->end() immediately after the glutCreateWindow()!
|
||||
<h3>Description</h3>
|
||||
|
||||
<p>You can call either glutMainLoop() or Fl::run() or loop calling
|
||||
Fl::wait() to run the program.
|
||||
|
||||
<h2>class Fl_Glut_Window : public <a href=Fl_Gl_Window.html>Fl_Gl_Window</a></h2>
|
||||
|
||||
Each Glut window is an instance of this class, which is a subclass of
|
||||
<a href=Fl_Gl_Window.html>Fl_Gl_Window</a>. You may find it useful to
|
||||
manipulate instances directly rather than use glut window id's. These
|
||||
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. These
|
||||
may be created without opening the display, and thus can fit better
|
||||
into FL's method of creating windows.
|
||||
into FLTK's method of creating windows.
|
||||
|
||||
<p>The current glut window is available in <code>Fl_Glut_Window
|
||||
*glut_window</code>.
|
||||
<p>The current GLUT window is available in the global variable
|
||||
<tt>glut_window</tt>.
|
||||
|
||||
<p><code>new Fl_Glut_Window(...)</code> is the same as
|
||||
<code>glutCreateWindow()</code> except it does not show() the window
|
||||
<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><code>window->make_current()</code> is the same as
|
||||
<code>glutSetWindow(number)</code>. If the window has not had show()
|
||||
called on it yet, some functions that assumme a gl context will not
|
||||
work. If you do show() the window, call make_current() again to set
|
||||
the context.
|
||||
<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> again to set the context.
|
||||
|
||||
<p><code>~Fl_Glut_Window()</code> is the same as
|
||||
<code>glutDestroyWindow()</code>.
|
||||
<p><tt>~Fl_Glut_Window()</tt> is the same as
|
||||
<tt>glutDestroyWindow()</tt>.
|
||||
|
||||
<h3>Methods</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="#Fl_Glut_Window.Fl_Glut_Window">Fl_Glut_Window</a>
|
||||
<li><a href="#Fl_Glut_Window.~Fl_Glut_Window">~Fl_Glut_Window</a>
|
||||
</ul>
|
||||
|
||||
<h4><a name="Fl_Glut_Window.Fl_Glut_Window">Fl_Glut_Window::Fl_Glut_Window(int x, int y, int w, int h, const char *title = 0)<br>
|
||||
Fl_Glut_Window::Fl_Glut_Window(int w, int h, const char *title = 0)</a></h4>
|
||||
|
||||
The first constructor takes 4 int arguments to create the window with
|
||||
a preset position and size. The second constructor with 2 arguments
|
||||
will create the window with a preset size, but the window manager
|
||||
will choose the position according to it's own whims.
|
||||
|
||||
<h4><a name="Fl_Glut_Window.~Fl_Glut_Window">virtual Fl_Glut_Window::~Fl_Glut_Window()</a></h4>
|
||||
|
||||
Destroys the GLUT window.
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
@@ -78,7 +78,7 @@ has started being included on Linux distributions.
|
||||
<p>Here are some of the core features unique to FLTK:
|
||||
|
||||
<ul>
|
||||
<li>sizeof(Fl_Widget) == 48.</li>
|
||||
<li>sizeof(Fl_Widget) == 40 to 48.</li>
|
||||
|
||||
<li>The "core" (the "hello" program compiled & linked with a static FLTK
|
||||
library using gcc on a 486 and then stripped) is 39.5K.</li>
|
||||
@@ -112,9 +112,9 @@ has started being included on Linux distributions.
|
||||
<li>Text input fields with Emacs key bindings, X cut &
|
||||
paste, and foreign letter compose!</li>
|
||||
|
||||
<li>Compatability header file for the GLUT library.</li>
|
||||
<li>Compatibility header file for the GLUT library.</li>
|
||||
|
||||
<li>Compatability header file for the XForms library.</li>
|
||||
<li>Compatibility header file for the XForms library.</li>
|
||||
|
||||
<li>Much too much to list here...</li>
|
||||
</ul>
|
||||
@@ -228,9 +228,11 @@ FLTK is available on the 'net in a bunch of locations:
|
||||
|
||||
<dt>FTP</dt>
|
||||
|
||||
<dd><a href="ftp://ftp.easysw.com/pub/fltk">ftp://ftp.easysw.com/pub/fltk</a><br>
|
||||
<a href="ftp://ftp.funet.fi/mirrors/ftp.easysw.com/pub/fltk">ftp://ftp.funet.fi/mirrors/ftp.easysw.com/pub/fltk</a><br>
|
||||
<a href="ftp://ftp.northamerica.net/pub/ESP/fltk">ftp.northamerica.net/pub/ESP/fltk</a><br></dd>
|
||||
<dd><a href="ftp://ftp.easysw.com/pub/fltk">ftp://ftp.easysw.com/pub/fltk</a></dd>
|
||||
|
||||
<dd><a href="ftp://ftp.funet.fi/mirrors/ftp.easysw.com/pub/fltk">ftp://ftp.funet.fi/mirrors/ftp.easysw.com/pub/fltk</a></dd>
|
||||
|
||||
<dd><a href="ftp://ftp.northamerica.net/pub/ESP/fltk">ftp.northamerica.net/pub/ESP/fltk</a><br></dd>
|
||||
|
||||
<dt>EMail</dt>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<H2>GNU LIBRARY GENERAL PUBLIC LICENSE</H2>
|
||||
|
||||
<P>Version 2, June 1991<BR>
|
||||
<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<BR>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
@@ -103,7 +103,7 @@ works together with the library.
|
||||
<P>Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
<H2>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H2>
|
||||
<H2 ALIGN=CENTER>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H2>
|
||||
|
||||
<STRONG>0.</STRONG> This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
@@ -437,7 +437,7 @@ 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.
|
||||
|
||||
<H2>NO WARRANTY</H2>
|
||||
<H2 ALIGN=CENTER>NO WARRANTY</H2>
|
||||
|
||||
<P><STRONG>15.</STRONG>
|
||||
BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
@@ -462,7 +462,7 @@ 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.
|
||||
|
||||
<H2>END OF TERMS AND CONDITIONS</H2>
|
||||
<H2 ALIGN=CENTER>END OF TERMS AND CONDITIONS</H2>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
+281
-407
File diff suppressed because it is too large
Load Diff
+275
-275
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="Author" CONTENT="Michael Sweet">
|
||||
<META NAME="Copyright" CONTENT="Copyright 1998 by Bill Spizak and Others.">
|
||||
<META NAME="Copyright" CONTENT="Copyright 1998-1999 by Bill Spizak and Others.">
|
||||
<META NAME="DocNumber" CONTENT="Revision 0">
|
||||
<TITLE>FLTK 1.0 Programming Manual</TITLE>
|
||||
</HEAD>
|
||||
@@ -23,15 +23,18 @@ This manual is organized into the following chapters and appendices:
|
||||
<LI><A HREF="#basics">Chapter 2 - FLTK Basics</A>
|
||||
<LI><A HREF="#common">Chapter 3 - Common Widgets and Attributes</A>
|
||||
<LI><A HREF="#editor">Chapter 4 - Designing a Simple Text Editor</A>
|
||||
<LI><A HREF="#subclasseing">Chapter 5 - Extending and Adding Widgets</A>
|
||||
<LI><A HREF="#fluid">Chapter 6 - Programming With FLUID</A>
|
||||
<LI><A HREF="#opengl">Chapter 7 - Using OpenGL</A>
|
||||
<LI><A HREF="#drawing">Chapter 5 - Drawing Things in FLTK</A>
|
||||
<LI><A HREF="#events">Chapter 6 - Handling Events</A>
|
||||
<LI><A HREF="#subclassing">Chapter 7 - Extending and Adding Widgets</A>
|
||||
<LI><A HREF="#fluid">Chapter 8 - Programming With FLUID</A>
|
||||
<LI><A HREF="#opengl">Chapter 9 - Using OpenGL</A>
|
||||
<LI><A HREF="#widgets">Appendix A - Widget Reference</A>
|
||||
<LI><A HREF="#functions">Appendix B - Function Reference</A>
|
||||
<LI><A HREF="#enumerations">Appendix C - Enumeration Reference</A>
|
||||
<LI><A HREF="#glut">Appendix D - GLUT Compatibility</A>
|
||||
<LI><A HREF="#forms">Appendix E - Forms Compatibility</A>
|
||||
<LI><A HREF="#license">Appendix F - Software License</A>
|
||||
<LI><A HREF="#license">Appendix F - Operating System Issues</A>
|
||||
<LI><A HREF="#license">Appendix G - Software License</A>
|
||||
</UL>
|
||||
|
||||
<H2>Conventions</H2>
|
||||
@@ -63,7 +66,7 @@ The following abbreviations are used in this manual:
|
||||
|
||||
<H2>Copyrights and Trademarks</H2>
|
||||
|
||||
FLTK is Copyright 1998 by Bill Spitzak and others. Use and distribution of FLTK is
|
||||
FLTK is Copyright 1998-1999 by Bill Spitzak and others. Use and distribution of FLTK is
|
||||
governed by the GNU Library General Public License, located in
|
||||
<A HREF=#license>Appendix D</A>.
|
||||
|
||||
|
||||
+316
-378
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,11 @@
|
||||
<HTML>
|
||||
<BODY>
|
||||
<H1 ALIGN=RIGHT>A - Widget Reference</H1>
|
||||
|
||||
This appendix describes all of the widget classes in FLTK. For a
|
||||
description of the <tt>fl_</tt> functions and <tt>Fl::</tt> methods,
|
||||
see <a href="#functions"> Appendix B</a>.
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user