NAME

Rui::Widget::Panel - composite widget


SYNOPSIS

  $panel = $someWindow->Panel;
  $panel->layoutManager(name => 'grid', numCols => 3);
  $panel->Label(value => 'foo');


SUPERCLASS

the Rui::Widget::Base manpage


DESCRIPTION

A Panel lets you create widgets inside it and lay them out according to some layout manager.


LAYOUT

You do not set size or location explicitly for widgets, unless you are using the rarely used null layout manager. Instead you set a layout manager on the parent composite, configure it, and configure any layout hints on the child widget. The layout manager will layout the widget according to its configuration and the hints of the children. Layout will occur after any relevant change to the composite or to the children, and when the user resizes the window. The layout algorithm operates automatically, so there is no need to explicitly start layout.

Here is the list of layout managers, and the hints with which they can be configured.

row

Children are layed out in a horizontal row.

Layout manager keys:

pack
Boolean. If true, children are sized at their minimum sizes. If false, children are equally sized at the maximum of their minimum sizes.

justify
Boolean. If true, children are spread out to fill available space in the composite. If false, they remain in their initial positions, as close to each other as possible, left aligned.

spacing
Integer. Number of pixels to put between children.

Default is pack=true, justify=false, spacing=3

Layout manager hints:

height, width
Integer. This size will be used on the child, instead of the layout policy.

box

Children are layed out in a in a box, horizontal or vertical. You can set size and flex on children for the axis of the container orientation. Children are fully stretched on the axis perpendicular to the container orientation.

Layout manager keys:

orient
horizontal/vertical.

Layout manager hints:

height, width
Integer. Integer. This size will be used on the child, overriding the layout policy. You should only set the one parallel to the container orientation.

flex
Integer. How greedy is this child for space?

fill

Children fill the parent completely. Space is divided equally between them.

Layout manager keys:

orient
horizontal/vertical.

grid

Children are layed out in a grid.

Layout manager keys:

numCols
Integer. Number of columns in grid.

equalWidth
Boolean. If true, columns are given the same width, and stretched to fill parent.

hSpacing, vSpacing
Integer. Number of pixels to put between cells.

Default is numCols=1, equalWidth=false, hspacing=vspacing=5

Layout manager hints:

indent
Integer. Number of pixels to indent child from left edge of cell.

hAlign, vAlign
one of: begin, end, center, fill. Alignment of widget in cell.

hSpan, vSpan
Integer. Number of cells to span.

hFlex, vFlex
Boolean. If true widget grabs excess space in the specified direction, i.e. it expands as much as possible.

height, width
Integer. This size will be used on the child, instead of the layout policy.

Default is hAlign=begin, vAlign=center, indent=0, hSpan=vSpan=1, hFlex=vFlex=false