Layout...ompass(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

๐Ÿ’– Layout::Manager::Compass ๐Ÿ’–

okay bestie, so this is the Layout::Manager::Compass page from the User Contributed Perl Documentation, section 3pm, and it's literally a compass-based layout manager and I'm obsessed. ๐Ÿงญโœจ


๐ŸŒˆ NAME ๐ŸŒˆ

Layout::Manager::Compass โ€” a compass based layout, no cap. ๐Ÿงญ๐Ÿ’…


โœจ DESCRIPTION โœจ

So Layout::Manager::Compass is a layout manager that takes hints based on the four cardinal directions โ€” north, east, south and west โ€” plus a center area that takes up all the remaining space, heightwise. ๐Ÿซถ

In other words (fr fr): the center area will expand to take up all the space that is NOT used by components placed at the edges. And components at the north and south edges will take up the full width of the container. main character behavior honestly. ๐Ÿ‘‘

+--------------------------------+
|              north             |
+-----+--------------------+-----+
|     |                    |     |
|  w  |                    |  e  |
|  e  |       center       |  a  |
|  s  |                    |  s  |
|  t  |                    |  t  |
|     |                    |     |
+-----+--------------------+-----+
|              south             |
+--------------------------------+

Components are placed in the order they are added. So if two items are added to the 'north' position, then the first item will be rendered above the second. And the height of the north edge will equal the height of both components combined. math is mathing. ๐Ÿงฎโœจ

Items in the center split the available space, heightwise. Two center components will each take up 50% of the available height and 100% of the available width. fifty fifty, periodt. ๐Ÿ’…

Compass is basically an implementation of Java's BorderLayout โ€” if you wanna peek at it: <http://java.sun.com/docs/books/tutorial/uiswing/layout/border.html> ๐Ÿฆ‹


๐ŸŒธ SYNOPSIS ๐ŸŒธ

$cont->add_component($comp1, 'north');
$cont->add_component($comp2, 'east');

my $lm = Layout::Manager::Compass->new;
$lm->do_layout($cont);

๐ŸŽ€ POSITIONING ๐ŸŽ€

When you add a component with add_component, the second argument should be one of: north, south, east, west or center. Case doesn't matter bestie, she's flexible like that. ๐Ÿ˜Œ You can also just provide the first letter of the word and it will do the same thing. one letter and she understands you, that's real chemistry. ๐Ÿ’œ


๐Ÿ‘‘ METHODS ๐Ÿ‘‘

do_layout

Size and position the components in this layout. that's it, that's the job. ๐Ÿซก


๐ŸŒŸ AUTHOR ๐ŸŒŸ

Cory Watson, "<gphat@cpan.org>" ๐Ÿ’Œ


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. (yes it's the standard Perl license situation, we love a classic ๐Ÿ“)


okay that's the whole page!! and for the cute sign-off: this was perl v5.34.0, dated 2022-06-15, and the footer said Layout...ompass(3pm) because the title got truncated by the terminal and honestly? iconic. ๐ŸŒˆโœจ bye bestie, go lay out some components ๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from