DRC | 2ff39b8 | 2011-07-28 08:38:59 +0000 | [diff] [blame] | 1 | // |
| 2 | // "$Id: Fl_Tile.H 7981 2010-12-08 23:53:04Z greg.ercolano $" |
| 3 | // |
| 4 | // Tile header file for the Fast Light Tool Kit (FLTK). |
| 5 | // |
| 6 | // Copyright 1998-2010 by Bill Spitzak and others. |
| 7 | // |
| 8 | // This library is free software; you can redistribute it and/or |
| 9 | // modify it under the terms of the GNU Library General Public |
| 10 | // License as published by the Free Software Foundation; either |
| 11 | // version 2 of the License, or (at your option) any later version. |
| 12 | // |
| 13 | // This library is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | // Library General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU Library General Public |
| 19 | // License along with this library; if not, write to the Free Software |
| 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 21 | // USA. |
| 22 | // |
| 23 | // Please report all bugs and problems on the following page: |
| 24 | // |
| 25 | // http://www.fltk.org/str.php |
| 26 | // |
| 27 | |
| 28 | /* \file |
| 29 | Fl_Tile widget . */ |
| 30 | |
| 31 | #ifndef Fl_Tile_H |
| 32 | #define Fl_Tile_H |
| 33 | |
| 34 | #include "Fl_Group.H" |
| 35 | |
| 36 | /** |
| 37 | The Fl_Tile class lets you resize the children by dragging |
| 38 | the border between them: |
| 39 | |
| 40 | <P ALIGN=CENTER>\image html Fl_Tile.png </P> |
| 41 | \image latex Fl_Tile.png "Fl_Tile" width=4cm |
| 42 | |
| 43 | <P>For the tiling to work correctly, the children of an |
| 44 | Fl_Tile must cover the entire area of the widget, but not |
| 45 | overlap. This means that all children must touch each |
| 46 | other at their edges, and no gaps can't be left inside the |
| 47 | Fl_Tile. |
| 48 | |
| 49 | <P>Fl_Tile does not normailly draw any graphics of its own. |
| 50 | The "borders" which can be seen in the snapshot above |
| 51 | are actually part of the children. Their boxtypes have been set |
| 52 | to FL_DOWN_BOX creating the impression of |
| 53 | "ridges" where the boxes touch. What you see are |
| 54 | actually two adjacent FL_DOWN_BOX's drawn next to each |
| 55 | other. All neighboring widgets share the same edge - the widget's |
| 56 | thick borders make it appear as though the widgets aren't actually |
| 57 | touching, but they are. If the edges of adjacent widgets do not |
| 58 | touch, then it will be impossible to drag the corresponding |
| 59 | edges.</P> |
| 60 | |
| 61 | <P>Fl_Tile allows objects to be resized to zero dimensions. |
| 62 | To prevent this you can use the resizable() to limit where |
| 63 | corners can be dragged to.</P> |
| 64 | |
| 65 | <P>Even though objects can be resized to zero sizes, they must |
| 66 | initially have non-zero sizes so the Fl_Tile can figure out |
| 67 | their layout. If desired, call position() after creating the |
| 68 | children but before displaying the window to set the borders where you |
| 69 | want. |
| 70 | |
| 71 | <P>Note on resizable(Fl_Widget &w) : |
| 72 | The "resizable" child widget (which should be invisible) limits where the |
| 73 | border can be dragged to. If you don't set it, it will be possible to |
| 74 | drag the borders right to the edge, and thus resize objects on the edge |
| 75 | to zero width or height. The resizable() widget is not |
| 76 | resized by dragging any borders. See also void Fl_Group::resizable(Fl_Widget &w) |
| 77 | |
| 78 | */ |
| 79 | class FL_EXPORT Fl_Tile : public Fl_Group { |
| 80 | public: |
| 81 | int handle(int); |
| 82 | /** |
| 83 | Creates a new Fl_Tile widget using the given position, size, |
| 84 | and label string. The default boxtype is FL_NO_BOX. |
| 85 | |
| 86 | <P>The destructor <I>also deletes all the children</I>. This allows a |
| 87 | whole tree to be deleted at once, without having to keep a pointer to |
| 88 | all the children in the user code. A kludge has been done so the |
| 89 | Fl_Tile and all of it's children can be automatic (local) |
| 90 | variables, but you must declare the Fl_Tile <I>first</I>, so |
| 91 | that it is destroyed last. |
| 92 | */ |
| 93 | Fl_Tile(int X,int Y,int W,int H,const char*l=0) : Fl_Group(X,Y,W,H,l) {} |
| 94 | void resize(int, int, int, int); |
| 95 | void position(int, int, int, int); |
| 96 | }; |
| 97 | |
| 98 | #endif |
| 99 | |
| 100 | // |
| 101 | // End of "$Id: Fl_Tile.H 7981 2010-12-08 23:53:04Z greg.ercolano $". |
| 102 | // |