diff --git a/FL/Fl_Tile.H b/FL/Fl_Tile.H index 2792c4150..f794a9c62 100644 --- a/FL/Fl_Tile.H +++ b/FL/Fl_Tile.H @@ -3,10 +3,10 @@ // // Tile header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2014 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this +// the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php @@ -16,71 +16,19 @@ // http://www.fltk.org/str.php // -/* \file - Fl_Tile widget . */ - #ifndef Fl_Tile_H #define Fl_Tile_H #include "Fl_Group.H" -/** - The Fl_Tile class lets you resize the children by dragging - the border between them: - -
\image html Fl_Tile.png
- \image latex Fl_Tile.png "Fl_Tile" width=4cm - -For the tiling to work correctly, the children of an - Fl_Tile must cover the entire area of the widget, but not - overlap. This means that all children must touch each - other at their edges, and no gaps can't be left inside the - Fl_Tile. - -
Fl_Tile does not normailly draw any graphics of its own. - The "borders" which can be seen in the snapshot above - are actually part of the children. Their boxtypes have been set - to FL_DOWN_BOX creating the impression of - "ridges" where the boxes touch. What you see are - actually two adjacent FL_DOWN_BOX's drawn next to each - other. All neighboring widgets share the same edge - the widget's - thick borders make it appear as though the widgets aren't actually - touching, but they are. If the edges of adjacent widgets do not - touch, then it will be impossible to drag the corresponding - edges.
- -Fl_Tile allows objects to be resized to zero dimensions. - To prevent this you can use the resizable() to limit where - corners can be dragged to.
- -Even though objects can be resized to zero sizes, they must - initially have non-zero sizes so the Fl_Tile can figure out - their layout. If desired, call position() after creating the - children but before displaying the window to set the borders where you - want. - -
Note on resizable(Fl_Widget &w) : - The "resizable" child widget (which should be invisible) limits where the - border can be dragged to. If you don't set it, it will be possible to - drag the borders right to the edge, and thus resize objects on the edge - to zero width or height. The resizable() widget is not - resized by dragging any borders. See also void Fl_Group::resizable(Fl_Widget &w) - +/* + The Fl_Tile class lets you resize its children by dragging + the border between them. */ + class FL_EXPORT Fl_Tile : public Fl_Group { public: int handle(int); - /** - Creates a new Fl_Tile widget using the given position, size, - and label string. The default boxtype is FL_NO_BOX. - -
The destructor also deletes all the children. This allows a
- whole tree to be deleted at once, without having to keep a pointer to
- all the children in the user code. A kludge has been done so the
- Fl_Tile and all of it's children can be automatic (local)
- variables, but you must declare the Fl_Tile first, so
- that it is destroyed last.
- */
Fl_Tile(int X,int Y,int W,int H,const char*l=0);
void resize(int, int, int, int);
void position(int, int, int, int);
diff --git a/documentation/src/Fl_Tile.png b/documentation/src/Fl_Tile.png
index eafa59c99..20d90deed 100644
Binary files a/documentation/src/Fl_Tile.png and b/documentation/src/Fl_Tile.png differ
diff --git a/src/Fl_Tile.cxx b/src/Fl_Tile.cxx
index f89edcdbc..be231fab0 100644
--- a/src/Fl_Tile.cxx
+++ b/src/Fl_Tile.cxx
@@ -3,10 +3,10 @@
//
// Tile widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2014 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
-// the file "COPYING" which should have been included with this file. If this
+// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// http://www.fltk.org/COPYING.php
@@ -16,23 +16,81 @@
// http://www.fltk.org/str.php
//
+/**
+ \class Fl_Tile
-// Group of 2 or 4 "tiles" that can be resized by dragging border
-// The size of the first child determines where the resize border is.
-// The resizebox is used to limit where the border can be dragged to.
+ The Fl_Tile class lets you resize its children by dragging
+ the border between them.
+
+ \image html Fl_Tile.png
+ \image latex Fl_Tile.png "Fl_Tile" width=5cm
+
+ For the tiling to work correctly, the children of an Fl_Tile must
+ cover the entire area of the widget, but not overlap.
+ This means that all children must touch each other at their edges,
+ and no gaps can be left inside the Fl_Tile.
+
+ Fl_Tile does not normally draw any graphics of its own.
+ The "borders" which can be seen in the snapshot above are actually
+ part of the children. Their boxtypes have been set to FL_DOWN_BOX
+ creating the impression of "ridges" where the boxes touch. What
+ you see are actually two adjacent FL_DOWN_BOX's drawn next to each
+ other. All neighboring widgets share the same edge - the widget's
+ thick borders make it appear as though the widgets aren't actually
+ touching, but they are. If the edges of adjacent widgets do not
+ touch, then it will be impossible to drag the corresponding edges.
+
+ Fl_Tile allows objects to be resized to zero dimensions.
+ To prevent this you can use the resizable() to limit where
+ corners can be dragged to. For more information see note below.
+
+ Even though objects can be resized to zero sizes, they must initially
+ have non-zero sizes so the Fl_Tile can figure out their layout.
+ If desired, call position() after creating the children but before
+ displaying the window to set the borders where you want.
+
+ Note on resizable(Fl_Widget &w):
+ The "resizable" child widget (which should be invisible) limits where
+ the borders can be dragged to. All dragging will be limited inside the
+ resizable widget's borders. If you don't set it, it will be possible
+ to drag the borders right to the edges of the Fl_Tile widget, and thus
+ resize objects on the edges to zero width or height. When the entire
+ Fl_Tile widget is resized, the resizable() widget will keep its border
+ distance to all borders the same (this is normal resize behavior), so
+ that you can effectively set a border width that will never change.
+
+ Note:
+ You can still resize widgets \b inside the resizable() to zero width and/or
+ height, i.e. box \b 2b above to zero width and box \b 3a to zero height.
+
+ \see void Fl_Group::resizable(Fl_Widget &w)
+
+ Example for resizable with 20 pixel border distance:
+ \code
+ int dx = 20, dy = dx;
+ Fl_Tile tile(50,50,300,300);
+ // ... create widgets inside tile (see test/tile.cxx) ...
+ // create resizable() box
+ Fl_Box r(tile.x()+dx,tile.y()+dy,tile.w()-2*dx,tile.h()-2*dy);
+ tile.resizable(r);
+ tile.end();
+ \endcode
+
+ See also the complete example program in test/tile.cxx.
+*/
#include