Tickit...oatBox(3pm)

πŸ“¦
version 0.11 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Tickit::Widget::FloatBox πŸ’–

okay bestie, gather round, because this one is so cute and so useful and it's literally called Tickit::Widget::FloatBox (a 3pm manual page, for the record) and it's here to manage a whole lil collection of floating widgets for you. no cap. πŸ¦‹


✨ SYNOPSIS ✨

TODO

yes girl, the synopsis is literally just TODO. iconic of the author honestly. moving on πŸ’…


🌸 DESCRIPTION 🌸

so this container widget is basically the girl who holds everyone's stuff β€” it keeps a collection of floating widgets, and those floats can be displayed over the top of a single base widget. the box itself? entirely occupied by the base widget. periodt.

and by default β€” like, when no floats have been created or displayed β€” it behaves essentially invisibly. it's giving ghost. it's giving "was the box even there??" because it acts as though the box weren't there at all and the base widget was just an immediate child of whatever container the floatbox is sitting inside. sneaky. invisible. slay. πŸ‘‘


πŸŽ€ CONSTRUCTOR πŸŽ€

new

$floatbox = Tickit::Widget::FloatBox->new( %args )

constructs a brand-new Tickit::Widget::FloatBox object. fresh out the box, literally. ✨

it 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. 🫢
⚠️ okay so this argument is now discouraged because it complicates the construction of subclasses. instead, bestie, use the set_base_child method, used as a chaining mutator. trust. πŸ’€

πŸ’œ ACCESSORS πŸ’œ

base_child / set_base_child

$base_child = $floatbox->base_child

$floatbox->set_base_child( $base_child )

returns or sets the base widget to use. simple as that. 🌈

the mutator method returns the container widget instance itself, which makes it perfect for chaining β€” like this:

my $container = Tickit::Widget::FloatBox->new( ... )
   ->set_base_child( Tickit::Widget::Box->new ... );

chain it, queen. πŸ”₯


add_float

$float = $floatbox->add_float( %args )

adds a widget as a floating child and hands you back a brand-new Float object. 🎁 it takes these arguments:

  • child => Tickit::Widget β€” the child widget. the actual star of the show.
  • top, bottom, left, right => INT β€” the initial geometry of the floating area. these behave exactly the same way as the move method on the Float object. same rules, same energy. πŸ“
  • hidden => BOOL β€” optional. if it's true, the float starts off hidden initally, and you gotta call the show method before it becomes visible. peekaboo, but make it Unix. πŸ™ˆ

πŸ¦‹ FLOATS πŸ¦‹

these are the objects that represent a floating region, as returned by the add_float method. your float babies. πŸ’–

child

$child = $float->child

returns the child widget in the region. that's it, that's the whole method. 🌸


move

$float->move( %args )

redefines the area geometry of the region. it takes arguments named top, bottom, left and right, and each one should either be a numeric value or undef. πŸ“

here's the rules, bestie, listen up:

  • the region must have at least one of top or bottom, and at least one of left or right defined β€” that's what fixes the position of one corner of the region.
  • if the size isn't 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. counting backwards?? yes. it's giving math but make it fashion. πŸ’…

for example:

# 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 you don't pass will be left unchanged. and if you specifically wanna clear the current value? pass a value of undef. periodt. ⭐


remove

$float->remove

removes the float from the FloatBox. bye bestie, it was real. 😭


hide

$float->hide

hides the float by hiding the window of its child widget. so the child's window is what actually dips out. πŸ«₯


show

$float->show

shows the float by showing the window of its child widget. this is the undo of hide β€” undoes the effect of hide, exactly. back from the dead, iconic. ✨


is_visible

$visible = $float->is_visible

returns true if the float is currently visible. vibe check on your float. πŸ‘€


🌈 TODO 🌈

things on the to-do list, in list form:

  • support adjusting stacking order of floats. (one day. we believe. πŸ™)

πŸ‘‘ AUTHOR πŸ‘‘

Paul Evans <leonerd@leonerd.org.uk>


and that's the whole page, bestie!! πŸŽ€ this one's perl v5.36.0, dated 2022-12-17, and it lives under User Contributed Perl Documentation. go forth and float. πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from