class HexaPDF:: Layout:: ColumnBox
Parent | HexaPDF::Layout::Box |
---|
A ColumnBox
arranges boxes in one or more columns.
The number and width of the columns as well as the size of the gap between the columns can be modified. Additionally, the contents can either fill the columns one after the other or the columns can be made equally high.
If the column box has padding and/or borders specified, they are handled like with any other box. This means they are around all columns and their contents and are not used separately for each column.
The following style properties are used (additionally to those used by the parent class):
Style#position
-
If this is set to :flow, the frames created for the columns will take the shape of the frame into account. This also means that the
available_width
andavailable_height
arguments are ignored.
Attributes
The columns definition.
If the value is an array, it needs to contain the widths of the columns. The size of the array determines the number of columns. Otherwise, if the value is an integer, the value defines the number of equally sized columns, i.e. a value of N
is equal to [-1]*N.
If a negative integer is used for the width, the column is auto-sized. Such columns split the remaining width (after substracting the widths of the fixed columns) proportionally among them. For example, if the definition is [-1, -2, -2], the first column is a fifth of the width and the other columns are each two fifth of the width.
Examples:
composer.box(:column, columns: 2, gaps: 10,
children: [composer.document.layout.lorem_ipsum_box])
composer.box(:column, columns: [50, -2, -1], gaps: [10, 5],
children: [composer.document.layout.lorem_ipsum_box])
Public Class Methods
Creates a new ColumnBox
object for the given child boxes in children
.
columns
-
Can either simply integer specify the number of columns or be a full column definition (see
columns
for details). gaps
-
Can either be a simply integer specifying the width between two columns or a full gap definition (see gap for details).
equal_height
-
If
true
, thefit
method tries to balance the columns in terms of their height. Otherwise the columns are filled from the left.
HexaPDF::Layout::Box::new
Public Instance Methods
Returns true
if no box was fitted into the columns.
HexaPDF::Layout::Box#empty?
Returns true
as the ‘position’ style property value :flow is supported.