diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 1999-03-10 20:18:38 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 1999-03-10 20:18:38 +0000 |
| commit | b5f85fd9d681a5cbbbc022bf0b2b23ba7eeeb41b (patch) | |
| tree | fabbf60ce1313dc8f7ead592b36c94096503eb79 /documentation/fluid.html | |
| parent | ce193d0ec51aad8c8feb525f46d6ec5869e52ef9 (diff) | |
Changed PostScript output to Level 1 for maximum compatibility.
Fixed some more typos and formatting problems.
git-svn-id: file:///fltk/svn/fltk/trunk@415 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'documentation/fluid.html')
| -rw-r--r-- | documentation/fluid.html | 170 |
1 files changed, 100 insertions, 70 deletions
diff --git a/documentation/fluid.html b/documentation/fluid.html index e2dfcbd7d..680598c3a 100644 --- a/documentation/fluid.html +++ b/documentation/fluid.html @@ -94,17 +94,16 @@ files found to be compiled: </PRE> </UL> <H2>A Short Tutorial</H2> -FLUID is an amazingly powerful little program. However, -this power comes at a price, it is not always obvious how -to accomplish seemingly simple tasks with it. This -tutorial will show you how to generate a complete user -interface class with FLUID. -<P> -<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0> -<TR VALIGN=TOP> -<TD> -The program shown to the right is called CubeView. The window you see -is of class CubeViewUI, and is completely generated by FLUID, including + +FLUID is an amazingly powerful little program. However, this power +comes at a price, as it is not always obvious how to accomplish seemingly +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 +program below. + +<P ALIGN=CENTER><IMG SRC="cubeview.gif"></P> + +<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 subclass of Fl_Gl_Window called CubeView. CubeViewUI manages CubeView using callbacks from the various sliders and rollers to manipulate the @@ -120,10 +119,7 @@ classes. href="Fl_Gl_Window.html#Fl_Gl_Window"><TT>Fl_Gl_Window</TT></A> to suit your purposes. </ol> -</TD> -<TD><IMG SRC="cubeview.gif"></TD> -</TR> -</TABLE> + <h3>The CubeView Class</h3> The CubeView class is a subclass of Fl_Gl_Window. It has methods for setting the zoom, the <i>x</i> and <i>y</i> pan, and the rotation angle @@ -216,42 +212,85 @@ CubeView::CubeView(int x,int y,int w,int h,const char *l) void CubeView::drawCube() { /* Draw a colored cube */ - glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv0); - v3f(boxv1); v3f(boxv2); v3f(boxv3); glEnd(); - - glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv5); - v3f(boxv4); v3f(boxv7); v3f(boxv6); glEnd(); +#define ALPHA 0.5 + glShadeModel(GL_FLAT); + + glBegin(GL_QUADS); + glColor4f(0.0, 0.0, 1.0, ALPHA); + glVertex3fv(boxv0); + glVertex3fv(boxv1); + glVertex3fv(boxv2); + glVertex3fv(boxv3); + + glColor4f(1.0, 1.0, 0.0, ALPHA); + glVertex3fv(boxv0); + glVertex3fv(boxv4); + glVertex3fv(boxv5); + glVertex3fv(boxv1); + + glColor4f(0.0, 1.0, 1.0, ALPHA); + glVertex3fv(boxv2); + glVertex3fv(boxv6); + glVertex3fv(boxv7); + glVertex3fv(boxv3); + + glColor4f(1.0, 0.0, 0.0, ALPHA); + glVertex3fv(boxv4); + glVertex3fv(boxv5); + glVertex3fv(boxv6); + glVertex3fv(boxv7); + + glColor4f(1.0, 0.0, 1.0, ALPHA); + glVertex3fv(boxv0); + glVertex3fv(boxv3); + glVertex3fv(boxv7); + glVertex3fv(boxv4); + + glColor4f(0.0, 1.0, 0.0, ALPHA); + glVertex3fv(boxv1); + glVertex3fv(boxv5); + glVertex3fv(boxv6); + glVertex3fv(boxv2); + glEnd(); + + glColor3f(1.0, 1.0, 1.0); + glBegin(GL_LINES); + glVertex3fv(boxv0); + glVertex3fv(boxv1); - glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv0); - v3f(boxv4); v3f(boxv5); v3f(boxv1); glEnd(); + glVertex3fv(boxv1); + glVertex3fv(boxv2); - glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv2); - v3f(boxv6); v3f(boxv7); v3f(boxv3); glEnd(); + glVertex3fv(boxv2); + glVertex3fv(boxv3); - glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv0); - v3f(boxv3); v3f(boxv7); v3f(boxv4); glEnd(); + glVertex3fv(boxv3); + glVertex3fv(boxv0); - glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv1); - v3f(boxv5); v3f(boxv6); v3f(boxv2); glEnd(); + glVertex3fv(boxv4); + glVertex3fv(boxv5); -#define ALPHA 128 - glBegin(GL_QUADS); glColor4ub( 0, 0, 255, ALPHA); v3f(boxv0); - v3f(boxv1); v3f(boxv2); v3f(boxv3); glEnd(); + glVertex3fv(boxv5); + glVertex3fv(boxv6); - glBegin(GL_QUADS); glColor4ub(255, 255, 0, ALPHA); v3f(boxv0); - v3f(boxv4); v3f(boxv5); v3f(boxv1); glEnd(); + glVertex3fv(boxv6); + glVertex3fv(boxv7); - glBegin(GL_QUADS); glColor4ub( 0, 255, 255, ALPHA); v3f(boxv2); - v3f(boxv6); v3f(boxv7); v3f(boxv3); glEnd(); + glVertex3fv(boxv7); + glVertex3fv(boxv4); - glBegin(GL_QUADS); glColor4ub(255, 0, 0, ALPHA); v3f(boxv4); - v3f(boxv5); v3f(boxv6); v3f(boxv7); glEnd(); + glVertex3fv(boxv0); + glVertex3fv(boxv4); - glBegin(GL_QUADS); glColor4ub(255, 0, 255, ALPHA); v3f(boxv0); - v3f(boxv3); v3f(boxv7); v3f(boxv4); glEnd(); + glVertex3fv(boxv1); + glVertex3fv(boxv5); - glBegin(GL_QUADS); glColor4ub( 0, 255, 0, ALPHA); v3f(boxv1); - v3f(boxv5); v3f(boxv6); v3f(boxv2); glEnd(); + glVertex3fv(boxv2); + glVertex3fv(boxv6); + + glVertex3fv(boxv3); + glVertex3fv(boxv7); + glEnd(); };//drawCube void CubeView::draw() { @@ -305,9 +344,7 @@ CubeViewUI. <p>We will talk about the <tt>show()</tt> method that is highlighted shortly. <h4><a name="addcube">Adding the CubeView Widget</a></h4> -<table cellpadding=0 cellspacing=0> -<tr valign=top> -<td> + What we have is nice, but does little to show our cube. We have already defined the CubeView class and we would like to show it within the CubeViewUI. @@ -323,10 +360,9 @@ Code:" field enter <tt>#include "CubeView.h"</tt> <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. -</td> -<td><img src="fluid3.gif"></td> -</tr> -</table> + +<p align=center><img src="fluid3.gif"></p> + <h4><a name="defcall">Defining the Callbacks</a></h4> Each of the widgets we defined before adding CubeView can have callbacks that call CubeView methods. You can call an external @@ -345,9 +381,6 @@ more than one view change only redrawing once saves a lot of time. enter these callbacks. FLUID assumes you are smart enough not to refer to members or functions that don't exist. <h4><a name="addmeth">Adding a Class Method</a></h4> -<table cellpadding=0 cellspacing=0> -<tr valign=top> -<td> You can add class methods within FLUID that have nothing to do with the GUI. An an example add a show function so that CubeViewUI can actually appear on the screen. @@ -356,12 +389,9 @@ appear on the screen. <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 type of <tt>void</tt>. +<p align=center><img src="fluid4.gif"></p> <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. -</td> -<td><img src="fluid4.gif"></td> -</tr> -</table> <h3><a name="addconst">Adding Constructor Initialization Code</a></h3> If you need to add code to initialize class, for example setting @@ -488,9 +518,13 @@ to reorder functions, classes, and windows within functions. <H4>Edit/Later (F3)</H4> Moves all of the selected widgets one later in order among the children of their parent (if possible). +<P> +<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0> +<TR> +<TD VALIGN=TOP> <H4>Edit/Group (F7)</H4> Creates a new <tt>Fl_Group</tt> and make all the currently selected widgets -children of it. +children of it. <H4>Edit/Ungroup (F8)</H4> Deletes the parent group if all the children of a group are selected. <H4>Edit/Overlays on/off (Alt+Shift+O)</H4> @@ -499,21 +533,17 @@ selection. This makes it easier to see box borders and how the layout looks. The overlays will be forced back on if you change the selection. <H4>Edit/Preferences (Alt+p)</H4> -<TABLE WIDTH=100%> -<TR> -<TD VALIGN=TOP> Displays the preferences panel. The alignment preferences control the 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 to actually change. - -<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 -file will include the header file automatically. </TD> <TD VALIGN=TOP><IMG SRC="fluid_prefs.gif"></TD> </TR> </TABLE> +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 +file will include the header file automatically. <H4>New/Code/Function</H4> Creates a new C function. You will be asked for a name for the @@ -550,28 +580,28 @@ which is described later in this chapter. </P> <H4>Help/About FLUID</H4> Pops up a panel showing the version of FLUID. <H3>The Widget Panel</H3> -<TABLE cellpadding=0 cellspacing=0> +<TABLE cellpadding=0 cellspacing=0 width=100%> <TR><TD>When you double-click on a widget or a set of widgets you will get the "widget attribute panel". <P>When you change attributes using this panel, the changes are reflected immediately in the window. It is useful to hit the "no overlay" button (or type Alt+Shift+O) to hide the red overlay so you can see -the widgets more accurately, especially when setting the box type. </P> +the widgets more accurately, especially when setting the box type. <P>If you have several widgets selected, they may have different values for the fields. In this case the value for <I>one</I> of the widgets is shown. But if you change this value, <I>all</I> of the selected -widgets are changed to the new value. </P> +widgets are changed to the new value. <P>Hitting "OK" makes the changes permanent. Selecting a different widget also makes the changes permanent. FLUID checks for simple syntax errors such as mismatched parenthesis in any code before -saving any text. </P> -</TD><TD><IMG src=fluid_widget.gif width=225></TD></TR> -</TABLE> -"Revert" or "Cancel" put everything back to when you last brought up +saving any text. +<P>"Revert" or "Cancel" put everything back to when you last brought up the panel or hit OK. However in the current version of FLUID, changes to "visible" attributes (such as the color, label, box) are not undone by revert or cancel. Changes to code like the callbacks are undone, however. +</TD><TD><IMG src="fluid_widget.gif"></TD></TR> +</TABLE> <H3><A name=widget_attributes>Widget Attributes</A></H3> <H4>Name (text field)</H4> Name of a variable to declare, and to store a pointer to this |
