FLTK 1.3.0
|
The Fl_Tile class lets you resize the children by dragging the border between them: More...
#include <Fl_Tile.H>
Public Member Functions | |
Fl_Tile (int X, int Y, int W, int H, const char *l=0) | |
Creates a new Fl_Tile widget using the given position, size, and label string. | |
int | handle (int) |
Handles the specified event. | |
void | position (int, int, int, int) |
Drag the intersection at from_x,from_y to to_x,to_y. | |
void | resize (int, int, int, int) |
Resizes the Fl_Group widget and all of its children. |
The Fl_Tile class lets you resize the children by dragging the border between them:
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)
Fl_Tile::Fl_Tile | ( | int | X, |
int | Y, | ||
int | W, | ||
int | H, | ||
const char * | l = 0 |
||
) | [inline] |
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.
int Fl_Tile::handle | ( | int | event | ) | [virtual] |
Handles the specified event.
You normally don't call this method directly, but instead let FLTK do it when the user interacts with the widget.
When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise.
Most of the time, you want to call the inherited handle() method in your overridden method so that you don't short-circuit events that you don't handle. In this last case you should return the callee retval.
[in] | event | the kind of event received |
0 | if the event was not used or understood |
1 | if the event was used and can be deleted |
Reimplemented from Fl_Group.
void Fl_Tile::position | ( | int | oix, |
int | oiy, | ||
int | newx, | ||
int | newy | ||
) |
Drag the intersection at from_x,from_y to to_x,to_y.
This redraws all the necessary children.
void Fl_Tile::resize | ( | int | X, |
int | Y, | ||
int | W, | ||
int | H | ||
) | [virtual] |
Resizes the Fl_Group widget and all of its children.
The Fl_Group widget first resizes itself, and then it moves and resizes all its children according to the rules documented for Fl_Group::resizable(Fl_Widget*)
Reimplemented from Fl_Group.