SIMPLE SOLUTIONS

LAYOUT::MANAGER::GRID(3PM) - Linux man page online | Library functions

Simple grid-based layout manager.

Chapter
2016-04-27
Layout::Manager::Grid(3pm) User Contributed Perl Documentation Layout::Manager::Grid(3pm)

NAME

Layout::Manager::Grid - Simple grid-based layout manager.

DESCRIPTION

Layout::Manager::Grid is a layout manager places components into evenly divided cells. When you instantiate a Grid manager, you must supply it with a count of how many rows and columns it will have. For example, a Grid with 1 column and 2 rows would look like: +--------------------------------+ | | | component 1 | | | +--------------------------------+ | | | component 2 | | | +--------------------------------+ The container is divided into as many <rows> * <columns> cells, with each taking up an equal amount of space. A grid with 3 columns and 2 rows would create 6 cells that consume 33% of the width and 50% of the height. Components are 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 a something else will cause the component to consume that many rows or columns worth of space. Grid is similar to Java's GridLayout <http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html>.

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. The simple way for me to avoid writing a long explanation is to say it works similar to HTML tables. Rows will become as big as their biggest consituent, as will columns. It is common to add a Grid-managed component to a scene with only one of it's dimensions set.

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.

AUTHOR

Cory Watson, "<@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.
perl v5.22.1 2016-04-27 Layout::Manager::Grid(3pm)
Download raw manual
Main page User Contributed Perl Documentation (+23303) perl v5.22.1 (+747) № 3 (+68044)
Go top