|
|
@ -29,7 +29,7 @@ These <TT>.cxx</TT> files must <TT>#include</TT> the <TT>.h</TT> file or they ca |
|
|
|
#include</TT> the <TT>.cxx</TT> file so it still appears to be a single source |
|
|
|
#include</TT> the <TT>.cxx</TT> file so it still appears to be a single source |
|
|
|
file. |
|
|
|
file. |
|
|
|
|
|
|
|
|
|
|
|
<P ALIGN=CENTER><IMG src=fluid-org.gif> |
|
|
|
<P ALIGN=CENTER><IMG src="fluid-org.gif" ALT="FLUID organization."> |
|
|
|
|
|
|
|
|
|
|
|
<P>Normally the FLUID file defines one or more functions or classes which |
|
|
|
<P>Normally the FLUID file defines one or more functions or classes which |
|
|
|
output C++ code. Each function defines a one or more FLTK |
|
|
|
output C++ code. Each function defines a one or more FLTK |
|
|
@ -113,7 +113,7 @@ simple tasks with it. This tutorial will show you how to generate a |
|
|
|
complete user interface class with FLUID that is used for the CubeView |
|
|
|
complete user interface class with FLUID that is used for the CubeView |
|
|
|
program provided with FLTK. |
|
|
|
program provided with FLTK. |
|
|
|
|
|
|
|
|
|
|
|
<P ALIGN=CENTER><IMG SRC="cubeview.gif"></P> |
|
|
|
<P ALIGN=CENTER><IMG SRC="cubeview.gif" ALT="CubeView demo."></P> |
|
|
|
|
|
|
|
|
|
|
|
<P>The window is of class CubeViewUI, and is completely generated by FLUID, including |
|
|
|
<P>The window is of class CubeViewUI, and is completely generated by FLUID, including |
|
|
|
class member functions. The central display of the cube is a separate |
|
|
|
class member functions. The central display of the cube is a separate |
|
|
@ -323,14 +323,14 @@ void CubeView::draw() { |
|
|
|
<h3>The CubeViewUI Class</h3> |
|
|
|
<h3>The CubeViewUI Class</h3> |
|
|
|
We will completely construct a window to display and control the |
|
|
|
We will completely construct a window to display and control the |
|
|
|
CubeView defined in the previous section using FLUID. |
|
|
|
CubeView defined in the previous section using FLUID. |
|
|
|
<h4><a name="def">Defining the CubeViewUI Class</a></h4> |
|
|
|
<h4><a name="defui">Defining the CubeViewUI Class</a></h4> |
|
|
|
Once you have started FLUID, the first step in defining a class is to |
|
|
|
Once you have started FLUID, the first step in defining a class is to |
|
|
|
create a new class within FLUID using the <b>New->Code->Class</b> |
|
|
|
create a new class within FLUID using the <b>New->Code->Class</b> |
|
|
|
menu item. Name the class "CubeViewUI" and leave the |
|
|
|
menu item. Name the class "CubeViewUI" and leave the |
|
|
|
subclass blank. We do not need any inheritance for this |
|
|
|
subclass blank. We do not need any inheritance for this |
|
|
|
window. You should see the new class declaration in the FLUID |
|
|
|
window. You should see the new class declaration in the FLUID |
|
|
|
browser window. |
|
|
|
browser window. |
|
|
|
<p align=center><img src="fluid1.gif"></p> |
|
|
|
<p align=center><img src="fluid1.gif" ALT="FLUID file for CubeView."></p> |
|
|
|
<h4><a name="addcon">Adding the Class Constructor</a></h4> |
|
|
|
<h4><a name="addcon">Adding the Class Constructor</a></h4> |
|
|
|
Click on the CubeViewUI class in the FLUID window and add a new method |
|
|
|
Click on the CubeViewUI class in the FLUID window and add a new method |
|
|
|
by selecting <b>New->Code->Function/Method.</b> The name of the |
|
|
|
by selecting <b>New->Code->Function/Method.</b> The name of the |
|
|
@ -352,7 +352,7 @@ None of these additions need be public. And they shouldn't be |
|
|
|
unless you plan to expose them as part of the interface for |
|
|
|
unless you plan to expose them as part of the interface for |
|
|
|
CubeViewUI. |
|
|
|
CubeViewUI. |
|
|
|
<p>When you are finished you should have something like this: |
|
|
|
<p>When you are finished you should have something like this: |
|
|
|
<p align=center><img src="fluid2.gif"> |
|
|
|
<p align=center><img src="fluid2.gif" ALT="FLUID window containing CubeView demo."> |
|
|
|
<p>We will talk about the <tt>show()</tt> method that is highlighted |
|
|
|
<p>We will talk about the <tt>show()</tt> method that is highlighted |
|
|
|
shortly. |
|
|
|
shortly. |
|
|
|
<h4><a name="addcube">Adding the CubeView Widget</a></h4> |
|
|
|
<h4><a name="addcube">Adding the CubeView Widget</a></h4> |
|
|
@ -373,7 +373,7 @@ Code:" field enter <tt>#include "CubeView.h"</tt> |
|
|
|
CubeView as a member of CubeViewUI, so any public CubeView methods are |
|
|
|
CubeView as a member of CubeViewUI, so any public CubeView methods are |
|
|
|
now available to CubeViewUI. |
|
|
|
now available to CubeViewUI. |
|
|
|
|
|
|
|
|
|
|
|
<p align=center><img src="fluid3.gif"></p> |
|
|
|
<p align=center><img src="fluid3.gif" ALT="CubeView methods."></p> |
|
|
|
|
|
|
|
|
|
|
|
<h4><a name="defcall">Defining the Callbacks</a></h4> |
|
|
|
<h4><a name="defcall">Defining the Callbacks</a></h4> |
|
|
|
Each of the widgets we defined before adding CubeView can have |
|
|
|
Each of the widgets we defined before adding CubeView can have |
|
|
@ -401,7 +401,7 @@ appear on the screen. |
|
|
|
<tt>show()</tt>. We don't need a return value here, and since we will |
|
|
|
<tt>show()</tt>. We don't need a return value here, and since we will |
|
|
|
not be adding any widgets to this method FLUID will assign it a return |
|
|
|
not be adding any widgets to this method FLUID will assign it a return |
|
|
|
type of <tt>void</tt>. |
|
|
|
type of <tt>void</tt>. |
|
|
|
<p align=center><img src="fluid4.gif"></p> |
|
|
|
<p align=center><img src="fluid4.gif" ALT="CubeView constructor."></p> |
|
|
|
<p>Once the new method has been added, highlight its name and select |
|
|
|
<p>Once the new method has been added, highlight its name and select |
|
|
|
New->Code->Code. Enter the method's code in the code window. |
|
|
|
New->Code->Code. Enter the method's code in the code window. |
|
|
|
|
|
|
|
|
|
|
@ -553,7 +553,7 @@ grid that all widgets snap to when you move and resize them, and for the |
|
|
|
"snap" which is how far a widget has to be dragged from its original position |
|
|
|
"snap" which is how far a widget has to be dragged from its original position |
|
|
|
to actually change. |
|
|
|
to actually change. |
|
|
|
|
|
|
|
|
|
|
|
<P ALIGN="CENTER"><IMG SRC="fluid_prefs.gif"></P> |
|
|
|
<P ALIGN="CENTER"><IMG SRC="fluid_prefs.gif" ALT="FLUID Preferences Window"></P> |
|
|
|
|
|
|
|
|
|
|
|
<P>The output filenames control the extensions or names of the files the are |
|
|
|
<P>The output filenames control the extensions or names of the files the are |
|
|
|
generated by FLUID. If you check the "Include .h from .cxx" button the code |
|
|
|
generated by FLUID. If you check the "Include .h from .cxx" button the code |
|
|
@ -617,7 +617,7 @@ to "visible" attributes (such as the color, label, box) are not undone |
|
|
|
by revert or cancel. Changes to code like the callbacks are undone, |
|
|
|
by revert or cancel. Changes to code like the callbacks are undone, |
|
|
|
however. |
|
|
|
however. |
|
|
|
<!-- NEW PAGE --> |
|
|
|
<!-- NEW PAGE --> |
|
|
|
<TABLE cellpadding=0 cellspacing=0 width=100%> |
|
|
|
<TABLE cellpadding=0 cellspacing=0 width=100% summary="columns of text"> |
|
|
|
<TR> |
|
|
|
<TR> |
|
|
|
<TD VALIGN=TOP> |
|
|
|
<TD VALIGN=TOP> |
|
|
|
<H3><A name=widget_attributes>Widget Attributes</A></H3> |
|
|
|
<H3><A name=widget_attributes>Widget Attributes</A></H3> |
|
|
@ -636,7 +636,7 @@ You pick the subtype off of this menu. |
|
|
|
The boxtype to draw as a background for the widget. |
|
|
|
The boxtype to draw as a background for the widget. |
|
|
|
</TD> |
|
|
|
</TD> |
|
|
|
<TD> </TD> |
|
|
|
<TD> </TD> |
|
|
|
<TD VALIGN=TOP WIDTH=378><IMG src="fluid_widget.gif"></TD> |
|
|
|
<TD VALIGN=TOP WIDTH=378><IMG src="fluid_widget.gif" ALT="The FLUID widget dialog."></TD> |
|
|
|
</TR> |
|
|
|
</TR> |
|
|
|
</TABLE> |
|
|
|
</TABLE> |
|
|
|
<P>Many widgets will work, and draw faster, with a "frame" instead of a |
|
|
|
<P>Many widgets will work, and draw faster, with a "frame" instead of a |
|
|
@ -918,7 +918,7 @@ to select the appropriate language and message file. |
|
|
|
"GNU gettext" from the "Use" chooser. Two new input fields will then |
|
|
|
"GNU gettext" from the "Use" chooser. Two new input fields will then |
|
|
|
appear to control the include file and function/macro name to use when |
|
|
|
appear to control the include file and function/macro name to use when |
|
|
|
retrieving the localized label strings. |
|
|
|
retrieving the localized label strings. |
|
|
|
<P ALIGN="CENTER"><IMG SRC="fluid-gettext.gif"></P> |
|
|
|
<P ALIGN="CENTER"><IMG SRC="fluid-gettext.gif" ALT="I18N using FLUID."></P> |
|
|
|
<P>The "#include" field controls the header file to include for I18N; by |
|
|
|
<P>The "#include" field controls the header file to include for I18N; by |
|
|
|
default this is <TT><libintl.h></TT>, the standard I18N file for |
|
|
|
default this is <TT><libintl.h></TT>, the standard I18N file for |
|
|
|
GNU gettext. |
|
|
|
GNU gettext. |
|
|
@ -934,7 +934,7 @@ need to call <TT>setlocale()</TT> to select the appropriate language. |
|
|
|
"POSIX catgets" from the "Use" chooser. Three new input fields will then |
|
|
|
"POSIX catgets" from the "Use" chooser. Three new input fields will then |
|
|
|
appear to control the include file, catalog file, and set number for |
|
|
|
appear to control the include file, catalog file, and set number for |
|
|
|
retrieving the localized label strings. |
|
|
|
retrieving the localized label strings. |
|
|
|
<P ALIGN="CENTER"><IMG SRC="fluid-catgets.gif"></P> |
|
|
|
<P ALIGN="CENTER"><IMG SRC="fluid-catgets.gif" ALT="I18N using FLUID"></P> |
|
|
|
<P>The "#include" field controls the header file to include for I18N; by |
|
|
|
<P>The "#include" field controls the header file to include for I18N; by |
|
|
|
default this is <TT><nl_types.h></TT>, the standard I18N file for |
|
|
|
default this is <TT><nl_types.h></TT>, the standard I18N file for |
|
|
|
POSIX catgets. |
|
|
|
POSIX catgets. |
|
|
|