Tickit::Widget::FloatBox - manage a collection of floating widgets
This container widget maintains a collection of floating widgets that can be displayed over the top of a single base widget. The box itself is entirely occupied by the base widget, and by default when no floats are created or displayed it will behave essentially invisibly, as though the box were not there and the base widget was an immediate child of the container the floatbox is inside.
$floatbox = Tickit::Widget::FloatBox->new( %args )
Constructs a new
Takes the following named arguments in addition to those taken by the base Tickit::ContainerWidget constructor.
- base_child => Tickit::Widget
The main Tickit::Widget instance to use as the base.
This argument is now discouraged as it complicates the construction of subclasses; see instead the "set_base_child" method used as a chaining mutator.
$base_child = $floatbox->base_child $floatbox->set_base_child( $base_child )
Returns or sets the base widget to use.
The mutator method returns the container widget instance itself making it suitable to use as a chaining mutator; e.g.
my $container = Tickit::Widget::FloatBox->new( ... ) ->set_base_child( Tickit::Widget::Box->new ... );
$float = $floatbox->add_float( %args )
Adds a widget as a floating child and returns a new
Float object. Takes the following arguments:
- child => Tickit::Widget
The child widget
The initial geometry of the floating area. These follow the same behaviour as the
movemethod on the Float object.
Optional. If true, the float starts off hidden initally, and must be shown by the
showmethod before it becomes visible.
The following objects represent a floating region as returned by the
$child = $float->child
Returns the child widget in the region.
$float->move( %args )
Redefines the area geometry of the region. Takes arguments named
right, each of which should either be a numeric value, or
The region must have at least one of
bottom and at least one of
right defined, which will then fix the position of one corner of the region. If the size is not otherwise determined by the geometry, it will use the preferred size of the child widget. Any geometry argument may be negative to count backwards from the limits of the parent.
# top-left corner $float->move( top => 0, left => 0 ) # top-right corner $float->move( top => 0, right => -1 ) # bottom 3 lines, flush left $float->move( left => 0, top => -3, bottom => -1 )
Any arguments not passed will be left unchanged; to specifically clear the current value pass a value of
Removes the float from the FloatBox.
Hide the float by hiding the window of its child widget.
Show the float by showing the window of its child widget. Undoes the effect of
$visible = $float->is_visible
Return true if the float is currently visible.
Support adjusting stacking order of floats.
Paul Evans <email@example.com>