Layout...r::Flow(3pm)

πŸ“¦
version 0.35 Β· 2 versions
  • 0.35 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.35 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Layout::Manager::Flow β€” a directional layout manager, bestie πŸ’… it literally places your components in one of the four cardinal directions.


🌸 DESCRIPTION 🌸

So Layout::Manager::Flow is a layout manager that anchors components in one of the four cardinal directions. That's it, that's the whole vibe.

When you instantiate a Flow manager, you may supply it with an anchor value, which may be one of north, south, east or west. The example below shows how the default anchor value of north works when you add two components. No cap, it's giving organized.

                 north
  +--------------------------------+
  |           component 1          |
  +--------------------------------+
  |           component 2          |
  +--------------------------------+
  |                                |
  |                                |
  |                                |
  +--------------------------------+

Components are placed in the order they are added. So if two items are added with a 'north' anchor, the first item will be rendered above the second β€” first come, first slays πŸ‘‘. Components will be expanded to take up all space perpendicular to their anchor. North and south will expand widths while east and west will expand heights. iykyk.

Flow is similar to Java's FlowLayout, which lives over at http://java.sun.com/docs/books/tutorial/uiswing/layout/flow.html. It does not, however, center components 🫢. This features may be added in the future if they are needed.


πŸ¦‹ SYNOPSIS πŸ¦‹

  $cont->add_component($comp1);
  $cont->add_component($comp2);

  my $lm = Layout::Manager::Flow->new(anchor => 'north');
  $lm->do_layout($cont);

πŸŽ€ ATTRIBUTES πŸŽ€

anchor

The direction this manager is anchored. Valid values are north, south, east and west. Pick your main character direction, babes 🌈.

used

Returns the amount of space used an arrayref in the form of [ $width, $height ]. So like, exactly how much room you took up πŸ’–.

wrap

If set to a true value, then component will be 'wrapped' when they do not fit. This currently only works for East and West anchored layouts. Lowkey niche but it's there ✨.


πŸ’œ METHODS πŸ’œ

do_layout

Size and position the components in this layout. That's the whole job, and it does it flawlessly, periodt πŸ”₯.


🌈 AUTHOR 🌈

Cory Watson, "<gphat@cpan.org>" β€” the icon who made this, we stan πŸ’….


Copyright 2008 by Cory G Watson

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay bestie that's the whole page πŸ¦‹ β€” this doc is from perl v5.34.0, dated 2022-06-15. go forth and anchor your components, you absolute legend πŸ’–βœ¨

πŸ“¦ where this page comes from