Layout...r::Grid(3pm)
π Layout::Manager::Grid β the vibe β¨
ok so bestie, this is Layout::Manager::Grid, and it lives in the User Contributed Perl Documentation corner of the perl universe π«Ά
πΈ NAME πΈ
Layout::Manager::Grid β a simple grid-based layout manager. that's it, that's the whole name, she's lowkey humble π
π¦ DESCRIPTION π¦
okay so Layout::Manager::Grid is a layout manager that places components into evenly divided cells. it's giving spreadsheet, it's giving tic-tac-toe board, it's giving structure β¨
the way it works: when you instantiate a Grid manager, you must supply it with a count of how many rows and columns it's gonna have. no rows-and-columns, no grid, periodt. for example, a Grid with 1 column and 2 rows would look like this:
+--------------------------------+
| |
| component 1 |
| |
+--------------------------------+
| |
| component 2 |
| |
+--------------------------------+
so the container gets divided into <rows> * <columns> cells, and every single one takes up an equal amount of space. no favourites here, everyone gets the same slice π° a grid with 3 columns and 2 rows would create 6 cells that consume 33% of the width and 50% of the height. math ate, honestly.
components get placed by specifying the cell they reside in via the row and column number:
$container->add_component($comp, { row => 0, column => 3 });
$container->add_component($comp, { row => 0, column => 2, height => 2 });
optionally, you may choose to override the default "width" or "height" of 1. setting it to something else will cause the component to consume that many rows or columns worth of space. so yeah, your component can absolutely claim extra real estate if it wants to be the main character π
Grid is similar to Java's GridLayout <http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html> β iykyk π§
β SYNOPSIS β
$cont->add_component($comp1, { row => 0, column => 1 });
$cont->add_component($comp2, { row => 0, column => 2 });
my $lm = Layout::Manager::Grid->new(rows => 1, columns => 2);
$lm->do_layout($con);
π DYNAMIC SIZING π
if the container that the Grid is manging does not have one or both of it's dimensions set, Grid will compute the appropriate sizes. and honestly? the simple way for me to avoid writing a long explanation is to just say it works similar to HTML tables. Rows will become as big as their biggest consituent, as will columns. it's the same energy as a table cell stretching to fit the tallest thing in its row π«Ά
it is common to add a Grid-managed component to a scene with only one of it's dimensions set. no cap.
π ATTRIBUTES π
π columns
The number of columns in this Grid.
π rows
The number of rows in this Grid.
π₯ METHODS π₯
β¨ do_layout
Size and position the components in this layout. that's the whole job description bestie, and she does it flawlessly π
π AUTHOR π
Cory Watson, "<gphat@cpan.org>"
π COPYRIGHT & LICENSE π
Copyright 2008 - 2010 Cory G Watson
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
ok so that's the whole page! every flag, every default, every path, every permission clause β nothing skipped, nothing invented, all facts intact π―
and that's a wrap on Layout...r::Grid(3pm) from perl v5.34.0, dated 2022-06-15, brought to you by User Contributed Perl Documentation. go forth and lay out ur components, bestie, u got this π¦β¨π
π¦ where this page comes from
- debian bookworm: liblayout-manager-perl 0.35-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: liblayout-manager-perl 0.35-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: liblayout-manager-perl 0.35-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblayout-manager-perl 0.35-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liblayout-manager-perl 0.35-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms