From 4b8754ace4ce4974e7ef8a83f3c830d56aa7f1d0 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sat, 30 Jan 1999 17:30:09 +0000 Subject: Updated Fl_Browser documentation Added widget hierarchy to Appendix A. Fixed doubled-up fl_input and fl_choice links (names are not case sensitive...) Added FLUID tutorial from Craig P. Earls (none of the sources yet, just the docos and images) git-svn-id: file:///fltk/svn/fltk/trunk@258 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- documentation/Fl_Browser.html | 28 ++- documentation/editor.html | 2 +- documentation/fluid.html | 474 +++++++++++++++++++++++++++++++----------- documentation/fluid1.gif | Bin 0 -> 9570 bytes documentation/fluid2.gif | Bin 0 -> 37056 bytes documentation/fluid3.gif | Bin 0 -> 17584 bytes documentation/fluid4.gif | Bin 0 -> 5976 bytes documentation/functions.html | 4 +- documentation/widgets.html | 88 +++++++- 9 files changed, 454 insertions(+), 142 deletions(-) create mode 100644 documentation/fluid1.gif create mode 100644 documentation/fluid2.gif create mode 100644 documentation/fluid3.gif create mode 100644 documentation/fluid4.gif diff --git a/documentation/Fl_Browser.html b/documentation/Fl_Browser.html index cfd6c9ba8..26207eebf 100644 --- a/documentation/Fl_Browser.html +++ b/documentation/Fl_Browser.html @@ -50,39 +50,31 @@ subclass of Fl_Browser_.

- - - +
  • middleline
  • - -
    @@ -97,6 +89,8 @@ int, const char * = 0) the strdup() function. It may also be NULL to make a blank line. The void * argument is returned as the data() of the new item. +

    void Fl_Browser::bottomline(int n)

    +Scrolls the browser so the bottom line in the browser is n.

    void Fl_Browser::clear()

    Remove all the lines in the browser.

    uchar Fl_Browser::column_char() const @@ -170,6 +164,8 @@ string then this just clears the browser. This returns zero if there was any error in opening or reading the file, in which case errno is set to the system error. The data() of each line is set to NULL. +

    void Fl_Browser::middleline(int n)

    +Scrolls the browser so the middle line in the browser is n.

    void Fl_Browser::move(int to, int from)

    Line from is removed and reinserted at to; to is calculated after the line is removed. @@ -178,6 +174,7 @@ to NULL. The first form returns the current vertical scrollbar position, where 0 corresponds to the top. If there is not vertical scrollbar then this will always return 0. +

    The second form sets the vertical scrollbar position to p.

    void Fl_Browser::remove(int n)

    Remove line n and make the browser one line shorter.

    void Fl_Browser::show(int n)

    @@ -192,9 +189,8 @@ out of range it returns NULL.

    The second form sets the text for line n.

    int Fl_Browser::topline() const
    void Fl_Browser::topline(int n)

    - The first form returns the current top line in the browser. If there +The first form returns the current top line in the browser. If there is no vertical scrollbar then this will always return 1. -

    The second form sets the top line in the browser to n.

    -

    The second form sets the vertical scrollbar position to p.

    +

    The second form scrolls the browser so the top line in the browser is n.

    int Fl_Browser::visible(int n) const

    - Returns a non-zero value if line n is visible. \ No newline at end of file + Returns a non-zero value if line n is visible. diff --git a/documentation/editor.html b/documentation/editor.html index 8da7c9a5c..b76dd81af 100644 --- a/documentation/editor.html +++ b/documentation/editor.html @@ -186,7 +186,7 @@ void delete_cb(void) {

    find_cb()

    - This callback function asks for a search string using the + This callback function asks for a search string using the fl_input() convenience function and then calls the find2_cb() function to find the string: -

    The Widget Browser

    - - -
    The main window shows a menu bar and a scrolling browser of all +

    A Short Tutorial

    +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. +

    + + + + + +
    +The program shown to the right is called CubeView. The window you see +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 +viewing angle and zoom of CubeView. +

    At the completion of this tutorial you will (hopefully) understand +how to: +

      +
    1. Use FLUID to create a complete user interface class, including +constructor and any member functions necessary. +
    2. Use FLUID to set callbacks member functions of a custom widget +classes. +
    3. Subclass an Fl_Gl_Window to suit +your purposes. +
    +
    +

    The CubeView Class

    +The CubeView class is a subclass of Fl_Gl_Window. It has methods for +setting the zoom, the x and y pan, and the rotation angle +about the x and yaxes. +

    You can safely skip this section as long as you realize the CubeView +is a sublass of Fl_Gl_Window and will respond to calls from +CubeViewUI, generated by FLUID. +

    The CubeView Class Definition

    +Here is the CubeView class definition, as given by its header file +"test/CubeView.hpp": +
      +class CubeView : public Fl_Gl_Window {
      +  public:
      +    CubeView(int x,int y,int w,int h,const char *l=0);
      +    // this value determines the scaling factor used to draw the cube.
      +    double size;
      +    /* Set the rotation about the vertical (y ) axis.
      +     *
      +     * This function is called by the horizontal roller in CubeViewUI
      +     * and the initialize button in CubeViewUI.
      +     */
      +    void v_angle(float angle){vAng=angle;};
      +    // Return the rotation about the vertical (y ) axis.
      +    float v_angle(){return vAng;};
      +    /* Set the rotation about the horizontal (x ) axis.
      +     *
      +     * This function is called by the vertical roller in CubeViewUI
      +       and the
      +     * initialize button in CubeViewUI.
      +     */
      +    void h_angle(float angle){hAng=angle;};
      +    // the rotation about the horizontal (x ) axis.
      +    float h_angle(){return hAng;};
      +    /* Sets the x shift of the cube view camera.
      +     *
      +     * This function is called by the slider in CubeViewUI and the
      +     * initialize button in CubeViewUI.
      +     */
      +    void panx(float x){xshift=x;};
      +    /* Sets the y shift of the cube view camera.
      +     *
      +     * This function is called by the slider in CubeViewUI and the
      +     * initialize button in CubeViewUI.
      +     */
      +    void pany(float y){yshift=y;};
      +    /* The widget class draw() override.
      +     * The draw() function initialize Gl for another round of
      +     * drawing then calls specialized functions for drawing each
      +     * of the entities displayed in the cube view.
      +     */
      +    void draw();
      +
      +  private:
      +    /* Draw the cube boundaries
      +     * Draw the faces of the cube using the boxv[] vertices, using
      +     * GL_LINE_LOOP for the faces. The color is #defined by
      +     * CUBECOLOR.
      +     */
      +    void drawCube();
      +    
      +    float vAng,hAng; float xshift,yshift;
      +
      +    float boxv0[3];float boxv1[3]; float boxv2[3];float boxv3[3];
      +    float boxv4[3];float boxv5[3]; float boxv6[3];float boxv7[3];
      +};
      +
    +

    The CubeView Class Implementation

    +Here is the CubeView implementation. It is very similar to the +"cube" demo included with FLTK. +
      +#include "CubeView.hpp"
      +#include <math.h>
      +
      +CubeView::CubeView(int x,int y,int w,int h,const char *l)
      +            : Fl_Gl_Window(x,y,w,h,l)
      +{
      +    vAng = 0.0; hAng=0.0; size=10.0;
      +    /* The cube definition. These are the vertices of a unit cube
      +     * centered on the origin.*/
      +    boxv0[0] = -0.5; boxv0[1] = -0.5; boxv0[2] = -0.5; boxv1[0] = 0.5;
      +    boxv1[1] = -0.5; boxv1[2] = -0.5; boxv2[0] = 0.5; boxv2[1] = 0.5;
      +    boxv2[2] = -0.5; boxv3[0] = -0.5; boxv3[1] = 0.5; boxv3[2] = -0.5;
      +    boxv4[0] = -0.5; boxv4[1] = -0.5; boxv4[2] = 0.5; boxv5[0] = 0.5;
      +    boxv5[1] = -0.5; boxv5[2] = 0.5; boxv6[0] = 0.5; boxv6[1] = 0.5;
      +    boxv6[2] = 0.5; boxv7[0] = -0.5; boxv7[1] = 0.5; boxv7[2] = 0.5;
      +};
      +
      +// The color used for the edges of the bounding cube.
      +#define CUBECOLOR 255,255,255,255
      +
      +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();
      +
      +    glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv0);
      +    v3f(boxv4); v3f(boxv5); v3f(boxv1); glEnd();
      +
      +    glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv2);
      +    v3f(boxv6); v3f(boxv7); v3f(boxv3); glEnd();
      +
      +    glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv0);
      +    v3f(boxv3); v3f(boxv7); v3f(boxv4); glEnd();
      +
      +    glBegin(GL_LINE_LOOP); glColor4ub(CUBECOLOR); v3f(boxv1);
      +    v3f(boxv5); v3f(boxv6); v3f(boxv2); glEnd();
      +
      +#define ALPHA 128
      +    glBegin(GL_QUADS); glColor4ub( 0, 0, 255, ALPHA); v3f(boxv0);
      +    v3f(boxv1); v3f(boxv2); v3f(boxv3); glEnd();
      +
      +    glBegin(GL_QUADS); glColor4ub(255, 255, 0, ALPHA); v3f(boxv0);
      +    v3f(boxv4); v3f(boxv5); v3f(boxv1); glEnd();
      +
      +    glBegin(GL_QUADS); glColor4ub( 0, 255, 255, ALPHA); v3f(boxv2);
      +    v3f(boxv6); v3f(boxv7); v3f(boxv3); glEnd();
      +
      +    glBegin(GL_QUADS); glColor4ub(255, 0, 0, ALPHA); v3f(boxv4);
      +    v3f(boxv5); v3f(boxv6); v3f(boxv7); glEnd();
      +
      +    glBegin(GL_QUADS); glColor4ub(255, 0, 255, ALPHA); v3f(boxv0);
      +    v3f(boxv3); v3f(boxv7); v3f(boxv4); glEnd();
      +
      +    glBegin(GL_QUADS); glColor4ub( 0, 255, 0, ALPHA); v3f(boxv1);
      +    v3f(boxv5); v3f(boxv6); v3f(boxv2); glEnd();
      +};//drawCube
      +
      +void CubeView::draw() {
      +    if (!valid()) {
      +        glLoadIdentity(); glViewport(0,0,w(),h());
      +        glOrtho(-10,10,-10,10,-20000,10000); glEnable(GL_BLEND);
      +        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      +    }
      +
      +    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      +    glPushMatrix(); glTranslatef(xshift, yshift, 0);
      +    glRotatef(hAng,0,1,0); glRotatef(vAng,1,0,0);
      +    glScalef(float(size),float(size),float(size)); drawCube();
      +    glPopMatrix();
      +};
      +
    + +

    The CubeViewUI Class

    +We will completely construct a window to display and control the +CubeView defined in the previous section using FLUID. +

    Defining the CubeViewUI Class

    +Once you have started FLUID, the first step in defining a class is to +create a new class within FLUID using the 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 +browser window. +

    +

    Adding the Class Constructor

    +Click on the CubeViewUI class in the FLUID window and add a new method +by selecting New->Code->Function/Method. The name of the +function will also be CubeViewUI. FLUID will understands that this will +be the constructor for the class and will generate the appropriate +code. Make sure you declare the constructor public. +

    Then add a window to the CubeViewUI class. Highlight the name of +the constructor in the FLUID browser window and click on +New->Group->Window. In a similar manner add the +following to the CubeViewUI constructor: +

      +
    • A horizontal roller named hrot +
    • A vertical roller named vrot +
    • A horizontal slider named xpan +
    • A vertical slider named ypan +
    • A horizontal value slider named zoom +
    +None of these additions need be public. And they shouldn't be +unless you plan to expose them as part of the interface for +CubeViewUI. +

    When you are finished you should have something like this: +

    +

    We will talk about the show() method that is highlighted +shortly. +

    Adding the CubeView Widget

    + + + + + +
    +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. +

    The CubeView class inherits the Fl_Gl_Window class, which +is created in the same way as a Fl_Box widget. Use +New->Other->Box to add a square box to the main window. +This will be no ordinary box, however. +

    The Box properties window will appear. The key to letting CubeViewUI +display CubeView is to enter CubeView in the "Class:" text +entry box. This tells FLUID that it is not an Fl_Box, but a +similar widget with the same constructor. In the "Extra +Code:" field enter #include "CubeView.hpp" +

    This #include is important, as we have just included +CubeView as a member of CubeViewUI, so any public CubeView methods are +now available to CubeViewUI. +

    +

    Defining the Callbacks

    +Each of the widgets we defined before adding CubeView can have +callbacks that call CubeView methods. You can call an external +function or put in a short amount of code in the "Callback" +field of the widget panel. For example, the callback for the +ypan slider is: +
      +cube->pany(((Fl_Slider *)o)->value());
      +cube->redraw();
      +
    +We call cube->redraw() after changing the value to update +the CubeView window. CubeView could easily be modified to do this, but +it is nice to keep this exposed in the case where you may want to do +more than one view change only redrawing once saves a lot of time. +

    There is no reason no wait until after you have added CubeView to +enter these callbacks. FLUID assumes you are smart enough not to refer +to members or functions that don't exist. +

    Adding a Class Method

    + + + + + +
    +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. +

    Make sure the top level CubeViewUI is selected and select +New->Code->Function/Method. Just use the name +show(). 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 void. +

    Once the new method has been added, highlight its name and select +New->Code->Code. Enter the method's code in the code window. +

    + +

    Adding Constructor Initialization Code

    +If you need to add code to initialize class, for example setting +initial values of the horizontal and vertical angles in the +CubeView, you can simply highlight the Constructor and select +New->Code->Code. Add any required code. + +

    Generating the Code

    +Now that we have completely defined the CubeViewUI, we have to generate +the code. There is one last trick to ensure this all works. Open the +preferences dialog from Edit->Preferences. +

    At the bottom of the preferences dialog box is the key: "Include +Header from Code". Select that option and set your desired file +extensions and you are in business. You can include the CubeViewUI.h +(or whatever extension you prefer) as you would any other C++ class. +


    +

    FLUID Reference

    + +

    The Widget Browser

    +The main window shows a menu bar and a scrolling browser of all the defined widgets. The name of the .fl file being edited is shown in the window title.

    The widgets are stored in a hierarchy. You can open and close a @@ -166,9 +402,7 @@ well-known file-card tab interface.

    Widgets are shown in the browser by either their name (such as "main_panel" in the example), or by their type and label (such as "Button "the green"").

    -
    - You select widgets by clicking on their names, which highlights +

    You select widgets by clicking on their names, which highlights them (you can also select widgets from any displayed window). You can select many widgets by dragging the mouse across them, or by using Shift+Click to toggle them on and off. To select no widgets, click in @@ -177,11 +411,11 @@ be selected even when there is no visual indication of this.

    You open widgets by double-clicking on them, or (to open several widgets you have picked) by typing the F1 key. A control panel will appear so you can change the widget(s).

    -

    Menu Items

    +

    Menu Items

    The menu bar at the top is duplicated as a pop-up menu on any displayed window. The shortcuts for all the menu items work in any window. The menu items are:

    -

    File/Open... (Alt+o)

    +

    File/Open... (Alt+o)

    Discards the current editing session and reads in a different .fl file. You are asked for confirmation if you have changed the current file.

    FLUID can also read .fd files produced by the Forms and @@ -192,37 +426,37 @@ terminal for all data it does not understand. You will probably need to edit the resulting setup to fix these errors. Be careful not to save the file without changing the name, as FLUID will write over the .fd file with its own format, which fdesign cannot read!

    -

    File/Save (Alt+s)

    +

    File/Save (Alt+s)

    Writes the current data to the .fl file. If the file is unnamed then FLUID will ask for a filename. -

    File/Save As...(Alt+Shift+S)

    +

    File/Save As...(Alt+Shift+S)

    Asks for a new filename and saves the file. -

    File/Merge... (Alt+i)

    +

    File/Merge... (Alt+i)

    Inserts the contents of another .fl file, without changing the name of the current .fl file. All the functions (even if they have the same names as the current ones) are added, and you will have to use cut/paste to put the widgets where you want. -

    File/Write Code (Alt+Shift+C)

    +

    File/Write Code (Alt+Shift+C)

    "Compiles" the data into a .cxx and .h file. These are exactly the same as the files you get when you run FLUID with the -c switch.

    The output file names are the same as the .fl file, with the leading directory and trailing ".fl" stripped, and ".h" or ".cxx" appended.

    -

    File/Quit (Alt+q)

    +

    File/Quit (Alt+q)

    Exits FLUID. You are asked for confirmation if you have changed the current data. -

    Edit/Undo (Alt+z)

    +

    Edit/Undo (Alt+z)

    This isn't implemented yet. You should do save often so you can recover from any mistakes you make. -

    Edit/Cut (Alt+x)

    +

    Edit/Cut (Alt+x)

    Deletes the selected widgets and all of their children. These are saved to a "clipboard" file and can be pasted back into any FLUID window. -

    Edit/Copy (Alt+c)

    +

    Edit/Copy (Alt+c)

    Copies the selected widgets and all of their children to the "clipboard" file. -

    Edit/Paste (Alt+c)

    +

    Edit/Paste (Alt+c)

    Pastes the widgets from the clipboard file.

    If the widget is a window, it is added to whatever function is selected, or contained in the current selection.

    @@ -232,39 +466,39 @@ is the parent of the current selection.

    To avoid confusion, it is best to select exactly one widget before doing a paste.

    Cut/paste is the only way to change the parent of a widget.

    -

    Edit/Select All (Alt+a)

    +

    Edit/Select All (Alt+a)

    Selects all widgets in the same group as the current selection.

    If they are all selected already then this selects all widgets in that group's parent. Repeatedly typing Alt+a will select larger and larger groups of widgets until everything is selected.

    -

    Edit/Open... (F1 or double click)

    +

    Edit/Open... (F1 or double click)

    Displays the current widget in the attributes panel. If the widget is a window and it is not visible then the window is shown instead. -

    Edit/Sort

    +

    Edit/Sort

    Sorts the selected widgets into left to right, top to bottom order. You need to do this to make navigation keys in FLTK work correctly. You may then fine-tune the sorting with "Earlier" and "Later". This does not affect the positions of windows or functions. -

    Edit/Earlier (F2)

    +

    Edit/Earlier (F2)

    Moves all of the selected widgets one earlier in order among the children of their parent (if possible). This will affect navigation order, and if the widgets overlap it will affect how they draw, as the later widget is drawn on top of the earlier one. You can also use this to reorder functions, classes, and windows within functions. -

    Edit/Later (F3)

    +

    Edit/Later (F3)

    Moves all of the selected widgets one later in order among the children of their parent (if possible). -

    Edit/Group (F7)

    +

    Edit/Group (F7)

    Creates a new Fl_Group and make all the currently selected widgets children of it. -

    Edit/Ungroup (F8)

    +

    Edit/Ungroup (F8)

    Deletes the parent group if all the children of a group are selected. -

    Edit/Overlays on/off (Alt+Shift+O)

    +

    Edit/Overlays on/off (Alt+Shift+O)

    Toggles the display of the red overlays off, without changing the 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. -

    Edit/Preferences (Alt+p)

    +

    Edit/Preferences (Alt+p)

    @@ -281,7 +515,7 @@ file will include the header file automatically.
    -

    New/Code/Function

    +

    New/Code/Function

    Creates a new C function. You will be asked for a name for the function. This name should be a legal C++ function template, without the return type. You can pass arguments which can be referred to by @@ -298,14 +532,14 @@ will call show() on all the windows it creates and then call Fl::run(). This can also be used to test resize behavior or other parts of the user interface.

    You can change the function name by double-clicking on the function.

    -

    New/Window

    +

    New/Window

    Creates a new Fl_Window widget. The window is added to the currently selected function, or to the function containing the currently selected item. The window will appear, sized to 100x100. You can resize it to whatever size you require.

    The widget panel will also appear and is described later in this chapter.

    -

    New/...

    +

    New/...

    All other items on the New menu are subclasses of Fl_Widget. Creating them will add them to the currently selected group or window, or the group or window containing the currently selected widget. The initial @@ -313,9 +547,9 @@ dimensions and position are chosen by copying the current widget, if possible.

    When you create the widget you will get the widget's control panel, which is described later in this chapter.

    -

    Help/About FLUID

    +

    Help/About FLUID

    Pops up a panel showing the version of FLUID. -

    The Widget Panel

    +

    The Widget Panel

    +
    When you double-click on a widget or a set of widgets you will get the "widget attribute panel". @@ -331,15 +565,15 @@ widgets are changed to the new value.

    widget also makes the changes permanent. FLUID checks for simple syntax errors such as mismatched parenthesis in any code before saving any text.

    -
    "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. -

    Widget Attributes

    -

    Name (text field)

    +

    Widget Attributes

    +

    Name (text field)

    Name of a variable to declare, and to store a pointer to this widget into. This variable will be of type "<class>*". If the name is blank then no variable is created. @@ -347,10 +581,10 @@ blank then no variable is created. etc. This will cause FLUID to declare an array of pointers. The array is big enough that the highest number found can be stored. All widgets that in the array must be the same type.

    -

    Type (upper-right pulldown menu)

    +

    Type (upper-right pulldown menu)

    Some classes have subtypes that modify their appearance or behavior. You pick the subtype off of this menu. -

    Box (pulldown menu)

    +

    Box (pulldown menu)

    The boxtype to draw as a background for the widget.

    Many widgets will work, and draw faster, with a "frame" instead of a "box". A frame does not draw the colored interior, leaving whatever @@ -361,17 +595,17 @@ by changing the window's box type to "NO_BOX". FLUID will display a checkerboard for any areas that are not colored in by boxes. Note that this checkerboard is not drawn by the resulting program. Instead random garbage will be displayed.

    -

    Color

    +

    Color

    The color to draw the box with.

    -

    Color2

    +

    Color2

    Some widgets will use this color for certain parts. FLUID does not always show the result of this: this is the color buttons draw in when pushed down, and the color of input fields when they have the focus.

    -

    Label

    +

    Label

    String to print next to or inside the button.

    You can put newlines into the string to make multiple lines. The easiest way is by typing Ctrl+j.

    -

    Label style (pull down menu)

    +

    Label style (pull down menu)

    How to draw the label. Normal, shadowed, engraved, and embossed change the appearance of the text. "symbol" requires the label to start with an '@' sign to draw a named @@ -379,30 +613,30 @@ symbol.

    From this menu you can also pick "Image...". This lets you use the contents of a GIF, XPM, or XBM image file to label the widget.

    -

    Label Alignment (Buttons)

    +

    Label Alignment (Buttons)

    Where to draw the label. The arrows put it on that side of the widget, you can combine the to put it in the corner. The "box" button puts the label inside the widget, rather than outside. -

    Label Font

    +

    Label Font

    Font to draw the label in. Ignored by symbols, bitmaps, and pixmaps. Your program can change the actual font used by these "slots" in case you want some font other than the 16 provided. -

    Label Size

    +

    Label Size

    Pixel size (height) for the font to draw the label in. Ignored by symbols, bitmaps, and pixmaps. To see the result without dismissing the panel, type the new number and then Tab. -

    Label Color

    +

    Label Color

    Color to draw the label. Ignored by pixmaps (bitmaps, however, do use this color as the foreground color). -

    Text Font, Size, and Color

    +

    Text Font, Size, and Color

    Some widgets display text, such as input fields, pull-down menus, and browsers. -

    Visible

    +

    Visible

    If you turn this off then the widget is hidden initially. Don't change this for windows or for the immediate children of a Tabs group. -

    Active

    +

    Active

    If you turn this off then the widget is deactivated initially. -

    Resizable

    +

    Resizable

    If a window is resizable or has an immediate child that is resizable, then the user will be able to resize it. In addition all the size changes of a window or group will go "into" the resizable child. If @@ -414,7 +648,7 @@ the other children.

    resizable widget, or by using hierarchies of groups. Unfortunately the only way to test it is to compile the program. Resizing the FLUID window is not the same as what will happen in the user program.

    -

    Hotspot

    +

    Hotspot

    Each window may have exactly one hotspot (turning this on will turn off any others). This will cause it to be positioned with that widget centered on the mouse. This position is determined when the FLUID @@ -422,7 +656,7 @@ function is called, so you should call it immediately before showing the window. If you want the window to hide and then reappear at a new position, you should have your program set the hotspot itself just before show(). -

    Subclass

    +

    Subclass

    This is how you use your own subclasses of Fl_Widget. Whatever identifier you type in here will be the class that is instantiated.

    In addition, no #include header file is put in the .h file. You @@ -433,7 +667,7 @@ does not have to be a subclass. It is sometimes useful to change this to another FLTK class. Currently the only way to get a double-buffered window is to change this field for the window to "Fl_Double_Window" and to add "#include <FL/Fl_Double_Window.h>" to the extra code.

    -

    Extra Code

    +

    Extra Code

    These four fields let you type in literal lines of code to dump into the .h or .cxx files.

    If the text starts with a # or the word extern then FLUID thinks @@ -449,7 +683,7 @@ does not do much other error checking. Be careful here, as it may be hard to figure out what widget is producing an error in the compiler. If you need more than four lines you probably should call a function in your own .cxx code.

    -

    Callback

    +

    Callback

    This can either be the name of a function, or a small snippet of code. If you enter anything but letters, numbers, and the underscore then FLUID treats it as code. @@ -463,17 +697,17 @@ check for matching parenthesis, braces, and quotes, but does not do much other error checking. Be careful here, as it may be hard to figure out what widget is producing an error in the compiler.

    If the callback is blank then no callback is set.

    -

    user_data

    +

    user_data

    This is a value for the user_data() of the widget. If blank the default value of zero is used. This can be any piece of C code that can be cast to a void pointer. -

    User Data Type

    +

    User Data Type

    The void * in the callback function prototypes is replaced with this. You may want to use long for old XForms code. Be warned that anything other than void * is not guaranteed to work! However on most architectures other pointer types are ok, and long is usually ok, too. -

    When

    +

    When

    When to do the callback. This can be "never", "changed", "release", "enter key", or "no change". The value of "enter key" is only useful for text input fields. The "no @@ -482,7 +716,7 @@ the data is not changed.

    There are other rare but useful values for the when() field that are not in the menu. You should use the extra code fields to put these values in.

    -

    Selecting and Moving Widgets

    +

    Selecting and Moving Widgets

    Double-clicking a window name in the browser will display it, if not displayed yet. From this display you can select widgets, sets of widgets, and move or resize them. To close a window either @@ -522,16 +756,16 @@ widgets may be different.

    The panel for the window (which you get by double-clicking it) is almost identical to the panel for any other Fl_Widget. There are three extra items:

    -

    Border

    +

    Border

    This button turns the window manager border on or off. On most window managers you will have to close the window and reopen it to see the effect. -

    xclass

    +

    xclass

    The string typed into here is passed to the X window manager as the class. This can change the icon or window decorations. On most (all?) window managers you will have to close the window and reopen it to see the effect. -

    Image Labels

    +

    Image Labels

    Selecting "Image..." off the label style pull-down menu will bring up a file chooser from which you pick the image file. If an image has already been chosen, you can change the image used by picking @@ -546,7 +780,7 @@ the .fl file you need the image files as well. Filenames are relative to the location the .fl file is (not necessarily the current directory). I recommend you either put the images in the same directory as the .fl file, or use absolute path names.

    -

    Notes for all image types

    +

    Notes for all image types

    FLUID runs using the default visual of your X server. This may be 8 bits, which will give you dithered images. You may get better results in your actual program by adding the code "Fl::visual(FL_RGB)" to your @@ -568,7 +802,7 @@ and text label on the same widget. If your widget is a button, and you want the image inside it, you must change the button's boxtype to FL_UP_FRAME (or another frame), otherwise when it is pushed it will erase the image.

    -

    XBM (X bitmap files)

    +

    XBM (X bitmap files)

    FLUID will read X bitmap files. These files have C source code to define a bitmap. Sometimes they are stored with the ".h" or ".bm" extension rather than the standard ".xbm". @@ -578,7 +812,7 @@ label color of the widget. You can change the color in FLUID. The '0' bits are transparent.

    The program "bitmap" on the X distribution does an ok job of editing bitmaps.

    -

    XPM (X pixmap files)

    +

    XPM (X pixmap files)

    FLUID will read X pixmap files as used by the libxpm library. These files have C source code to define a pixmap. The filenames usually have a ".xpm" extension. @@ -595,7 +829,7 @@ pixmaps I have used XPaint. This (and most other) painting programs are designed for large full color images and are difficult to use to edit an image of small size and few colors.

    -

    GIF files

    +

    GIF files

    FLUID will also read GIF image files. These files are often used on html documents to make icons. This lets you use nice icons that you steal off the net in your user interface. @@ -605,4 +839,4 @@ as for xpm files. Notice that the conversion removes the compression, so the code may be much bigger than the .gif file. Only the first image of an animated gif file is used.

    Behavior and performance with large .gif files is not guaranteed!

    - + diff --git a/documentation/fluid1.gif b/documentation/fluid1.gif new file mode 100644 index 000000000..a6526a292 Binary files /dev/null and b/documentation/fluid1.gif differ diff --git a/documentation/fluid2.gif b/documentation/fluid2.gif new file mode 100644 index 000000000..c780d83c5 Binary files /dev/null and b/documentation/fluid2.gif differ diff --git a/documentation/fluid3.gif b/documentation/fluid3.gif new file mode 100644 index 000000000..81672704f Binary files /dev/null and b/documentation/fluid3.gif differ diff --git a/documentation/fluid4.gif b/documentation/fluid4.gif new file mode 100644 index 000000000..00e8d0806 Binary files /dev/null and b/documentation/fluid4.gif differ diff --git a/documentation/functions.html b/documentation/functions.html index d8943d3b7..ba205236d 100644 --- a/documentation/functions.html +++ b/documentation/functions.html @@ -48,7 +48,7 @@ button and waits for the user to hit a button. The return value is 1 if the user hits Yes, 0 if they pick No. The enter key is a shortcut for Yes and ESC is a shortcut for No.

    -

    int fl_choice(const char *q, const char *b0, +

    int fl_choice(const char *q, const char *b0, const char *b1, const char *b2, ...)

    Shows the message with three buttons below it marked with the strings @@ -59,7 +59,7 @@ positioned "backwards" You can hide buttons by passing NULL as their labels.

    -

    const char *fl_input(const char *label, const char +

    const char *fl_input(const char *label, const char *deflt = 0, ...)

    Pops up a window displaying a string, lets the user edit it, and return the new value. The cancel button returns NULL. The diff --git a/documentation/widgets.html b/documentation/widgets.html index 452d709b7..78f1c93cc 100644 --- a/documentation/widgets.html +++ b/documentation/widgets.html @@ -5,12 +5,11 @@ This appendix describes all of the widget classes in FLTK. For a description of the fl_ functions and Fl:: methods, see Appendix B. -

    List of Classes

    +

    Alphabetical List of Classes

    -
    +

    Class Hierarchy

    + + + -- cgit v1.2.3