documentation/preface.dox re-added, with history (preface.html)

documentation/index.dox		re-added, with history (index.html)
documentation/advanced.dox	added, copied from advanced.html


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6223 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2008-09-13 13:28:51 +00:00
parent bdb9a5f237
commit 054d25081a
3 changed files with 300 additions and 0 deletions

View File

@ -0,0 +1,90 @@
/**
\page advanced 10 - Advanced FLTK
<P>This chapter explains advanced programming and design topics
that will help you to get the most out of FLTK.</P>
<H2><A NAME="multithreading">Multithreading</H2>
<P>FLTK supports multithreaded application using a locking mechanism based on "pthreads". We do not provide a threading interface as part of the library. However a simple example how threads can be implemented for all supported platforms can be found in <tt>test/threads.h</tt> and <tt>test/threads.cxx</tt>.
<P>To use the locking mechanism, FLTK must be compiled with <tt>--enable-threads</tt> set during the <tt>configure</tt> process. IDE-based versions of FLTK are automatically compiled with locking enabled if possible.
<P>In <TT>main()</TT>, call <a href="Fl.html#Fl.lock"><TT>Fl::lock()</TT></A> before <A HREF="Fl.html#Fl.run"><TT>Fl::run()</TT></A> or <A HREF="Fl.html#Fl.wait"><TT>Fl::wait()</TT></A> to start the runtime multithreading support for your program. All callbacks and derived functions like <tt>handle()</tt> and <tt>draw()</tt> will now be properly locked:</P>
<pre>
int main() {
Fl::lock();
/* run thread */
while (Fl::wait() &gt; 0) {
if (Fl::thread_message()) {
/* process your data */
}
}
}
</pre>
<P>You can now start as many threads as you like. From within
a thread (other than the main thread) FLTK calls must be wrapped
with calls to <a href="Fl.html#Fl.lock"><tt>Fl::lock()</tt></a>
and <a href="Fl.html#Fl.unlock"><tt>Fl::unlock()</tt></a>:
<pre>
Fl::lock(); // avoid conflicting calls
... // your code here
Fl::unlock(); // allow other threads to access FLTK again
</pre>
<p>You can send messages from child threads to the main thread
using <a href="Fl.html#Fl.awake"><tt>Fl::awake(msg)</tt></a>:</p>
<pre>
void *msg; // "msg" is a pointer to your message
Fl::awake(msg); // send "msg" to main thread
</pre>
<p>You can also tell the main thread to call a function for you
as soon as possible by using
<a href="Fl.html#Fl.awake"><tt>Fl::awake(callback, userdata)</tt></a>:</p>
<pre>
void do_something(void *userdata) {
// running with the main thread
}
// running in another thread
void *data; // "data" is a pointer to your user data
Fl::awake(do_something, data); // call something in main thread
</pre>
<P>FLTK supports multiple platforms, some of them which do not
allow any other but the main thread to handle system events and
open or close windows. The safe thing to do is to adhere to the
following rules for threads on all operating systems:
<ul>
<li>Don't <tt>show()</tt> or <tt>hide()</tt>anything that contains
widgets derived from <tt>Fl_Window</tt>, including dialogs, file
choosers, subwindows or <tt>Fl_GL_Window</tt>s</li>
<li>Don't call <tt>Fl::wait()</tt>, <tt>Fl::flush()</tt> or any
related methods that will handle system messages</li>
<li>Don't start or cancel timers</li>
<li>Don't change window decorations or titles</li>
<li>The <tt>make_current()</tt> method may or may not work well for regular windows, but should always work for <tt>Fl_GL_Window</tt>s to allow for high speed rendering on graphics cards with multiple pipelines</li>
</ul>
<P>See also:
<a href="Fl.html#Fl.awake">void awake(void *message)</A>,
<a href="Fl.html#Fl.lock">void lock()</A>,
<a href="Fl.html#Fl.thread_message">void *thread_message()</A>,
<a href="Fl.html#Fl.unlock">void unlock()</A>.
*/

103
documentation/index.dox Normal file
View File

@ -0,0 +1,103 @@
/**
\mainpage FLTK Programming Manual
<TABLE BGCOLOR="#9f9f9f" CELLPADDING="8" CELLSPACING="0" SUMMARY="TITLE BAR" WIDTH="700">
<TR>
<TD VALIGN="MIDDLE">
\image html FL200.gif
<TD ALIGN="CENTER" VALIGN="MIDDLE">
<H1>FLTK 1.3.0 Programming Manual</H1>
<P>Revision 8 by Michael Sweet, Craig P. Earls,<br>Matthias Melcher, and Bill Spitzak<BR>
Copyright 1998-2008 by Bill Spitzak and others.</P>
</TD>
</TR>
<TR>
<TH COLSPAN=2>This software and manual are provided under the terms of the GNU Library General Public License. Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.</TH>
</TR>
</TABLE>
<TABLE BGCOLOR="#9f9fef" CELLPADDING="8" CELLSPACING="0" SUMMARY="Table of Contents" WIDTH="700">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP"><B>
\subpage preface
</B>
<BR>
<BR>
<B><A HREF="intro.html#intro">1 - Introduction to FLTK</A></B>
<BR>
<BR>
<B><A HREF="basics.html#basics">2 - FLTK Basics</A></B>
<BR>
<BR>
<B><A HREF="common.html#common">3 - Common Widgets and Attributes</A></B>
<UL>
<LI><A HREF="drawing.html#colors">Colors</A></LI>
<LI><A HREF="common.html#boxtypes">Box Types</A></LI>
<LI><A HREF="common.html#labels">Labels and Label Types</A></LI>
<LI><A HREF="drawing.html#images">Images</A></LI>
<LI><A HREF="Fl_Pixmap.html#Fl_Pixmap">class Fl_Pixmap</A></LI>
</UL>
<B><A HREF="editor.html#editor">4 - Designing a Simple Text Editor</A></B>
<BR>
<BR>
<B><A HREF="drawing.html#drawing">5 - Drawing Things in FLTK</A></B>
<BR>
<BR>
<B><A HREF="events.html#events">6 - Handling Events</A></B>
<UL>
<LI><A HREF="events.html#event_xxx">Fl::event_*() methods</A></LI>
<LI><A HREF="events.html#propagation">Event Propagation</A></LI>
</UL>
<B><A HREF="subclassing.html#subclassing">7 - Adding and Extending
Widgets</A></B>
<BR>
<BR>
<B><A HREF="opengl.html#opengl">8 - Using OpenGL</A></B>
</TD>
<TD ALIGN=LEFT VALIGN=TOP>
<B><A HREF="fluid.html#FLUID">9 - Programming with FLUID</A></B>
<UL>
<LI><A HREF="fluid.html#widget_attributes">Widget Attributes</A></LI>
<LI><A HREF="fluid.html#widget_attributes">Selecting Moving Widgets</A></LI>
<LI><A HREF="fluid.html#images">Image Labels</A></LI>
</UL>
<B>
\subpage advanced
</B>
<BR>
<BR>
<B><A HREF="classes.html">A - Class Reference</A></B>
<BR>
<BR>
<B><A HREF="globals_func.html">B - Function Reference</A></B>
<BR>
<BR>
<B><A HREF="enumerations.html#Enumerations">C - FLTK Enumerations.H</A>
</B>
<BR>
<BR>
<B><A HREF="glut.html#glut">D - GLUT Compatibility</A></B>
<UL>
<LI><A HREF="glut.html#Fl_Glut_Window">class Fl_Glut_Window</A></LI>
</UL>
<B><A HREF="forms.html#forms">E - Forms Compatibility</A></B>
<BR>
<BR>
<B><A HREF="osissues.html#osissues">F - Operating System Issues</A></B>
<BR>
<BR>
<B><A HREF="migration.html">G - Migrating Code from FLTK 1.0.x</A></B>
<BR>
<BR>
<B><A HREF="license.html#license">H - Software License</A></B>
<BR>
<BR>
<B><A HREF="examples.html#examples">I - Example Source Code</A></B>
</TD>
</TR>
</TABLE>
*/

107
documentation/preface.dox Normal file
View File

@ -0,0 +1,107 @@
/**
\page preface Preface
<P>This manual describes the Fast Light Tool Kit (&quot;FLTK&quot;)
version 1.3.0, a C++ Graphical User Interface
(&quot;GUI&quot;) toolkit for UNIX, Microsoft Windows and MacOS. Each
of the chapters in this manual is designed as a tutorial for
using FLTK, while the appendices provide a convenient reference
for all FLTK widgets, functions, and operating system
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 A</A>.</B>
<H2>Organization</H2>
<P>This manual is organized into the following chapters and appendices:</P>
<UL>
<LI><A HREF="intro.html#intro">Chapter 1 - Introduction to FLTK</A></LI>
<LI><A HREF="basics.html#basics">Chapter 2 - FLTK Basics</A></LI>
<LI><A HREF="common.html#common">Chapter 3 - Common Widgets and Attributes</A></LI>
<LI><A HREF="editor.html#editor">Chapter 4 - Designing a Simple Text
Editor</A></LI>
<LI><A HREF="drawing.html#drawing">Chapter 5 - Drawing Things in FLTK</A></LI>
<LI><A HREF="events.html#events">Chapter 6 - Handling Events</A></LI>
<LI><A HREF="subclassing.html#subclassing">Chapter 7 - Extending and
Adding Widgets</A></LI>
<LI><A HREF="opengl.html#opengl">Chapter 8 - Using OpenGL</A></LI>
<LI><A HREF="fluid.html#FLUID">Chapter 9 - Programming With FLUID</A></LI>
<LI><A HREF="widgets.html#widgets">Appendix A - Class Reference</A></LI>
<LI><A HREF="functions.html#functions">Appendix B - Function Reference</A></LI>
<LI><A HREF="enumerations.html#Enumerations">Appendix C - Enumeration
Reference</A></LI>
<LI><A HREF="glut.html#glut">Appendix D - GLUT Compatibility</A></LI>
<LI><A HREF="forms.html#forms">Appendix E - Forms Compatibility</A></LI>
<LI><A HREF="osissues.html#osissues">Appendix F - Operating System Issues</A></LI>
<LI><A HREF="migration.html">Appendix G - Migrating from FLTK 1.0.x to FLTK 1.1.x</A></LI>
<LI><A HREF="license.html#license">Appendix H - Software License</A></LI>
<LI><A HREF="examples.html#examples">Appendix I - Example Source Code</A></LI>
</UL>
<H2>Conventions</H2>
<P>The following typeface conventions are used in this manual:</P>
<UL>
<LI>Function and constant names are shown in <B><TT>bold courier type</TT></B></LI>
<LI>Code samples and commands are shown in <TT>regular courier type</TT></LI>
</UL>
<H2>Abbreviations</H2>
<P>The following abbreviations are used in this manual:</P>
<DL>
<DT>X11</DT>
<DD>The X Window System version 11.</DD>
<DT>Xlib</DT>
<DD>The X Window System interface library.</DD>
<DT>WIN32</DT>
<DD>The Microsoft Windows 32-bit Application Programmer's Interface.</DD>
<DT>MacOS</DT>
<DD>The Apple Macintosh OS 8.6 and later, including OS X.</DD>
</DL>
<H2>Copyrights and Trademarks</H2>
<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>
<P>UNIX is a registered trademark of the X Open Group, Inc.
Microsoft and Windows are registered trademarks of Microsoft
Corporation. OpenGL is a registered trademark of Silicon
Graphics, Inc. Apple, Macintosh, MacOS, and Mac OS X are
registered trademarks of Apple Computer, Inc.</P>
*/