Tom Molesworth > Tickit-Widget-Layout-Relative-0.005 > Tickit::Widget::Layout::Relative

Download:
Tickit-Widget-Layout-Relative-0.005.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.005   Source  

NAME ^

Tickit::Widget::Layout::Relative - apply sizing to a group of Tickit widgets

VERSION ^

version 0.005

SYNOPSIS ^

 my $l = Tickit::Widget::Layout::Relative->new;
 $l->add(
  title  => 'Little panel',
  id     => 'second',
  border => 'round dashed single',
  width  => '33%',
  height => '5em',
 );
 $l->add(
  title     => 'Another panel',
  id        => 'first',
  below     => 'second',
  top_align => 'second',
  border    => 'round dashed single',
  width     => '33%',
  height    => '10em',
 );
 $l->add(
  title        => 'Something on the right',
  id           => 'overview',
  right_of     => 'first',
  bottom_align => 'first',
  margin_top   => '1em',
  margin_right => '3em',
 );
 Tickit->new(root => $l)->run;

DESCRIPTION ^

A container widget which provides 'relative' layout for widgets: specify the relations between the widget locations and this will attempt to fit them to the available space.

Relative layout

METHODS ^

new

Instantiate a new layout. Takes a single named parameter:

layout

Returns the Tickit::Layout::Relative instance.

lines

Returns the number of lines, carefully calculated using science.

cols

Number of columns.

add

Adds the given widget. Also takes a plethora of named options to help decide where to put said widget and how it should be rendered:

Don't rely on the return value. It may change in future.

Example:

 $layout->add(
  Tickit::Widget::Static->new(text => '...'),
  title  => 'Some panel',
  id     => 'send',
  border => 'single',
  width  => '85%',
  height => '15em',
 )

render_to_rb

Renders the layout to the given Tickit::RenderBuffer. Used internally.

render_corners

Render the corners. Purely for aesthetic reasons (rounded corners look better than the usual square corners formed by vline/hline). Used internally.

window_gained

When we get a window, we perform some unfortunate hacks to allow focus notification. Most of this is highly likely to change in future.

reshape

Called when our main window changes shape. We recalculate layout to match the new dimensions then update all child widgets accordingly.

INHERITED METHODS ^

Tickit::ContainerWidget

child_opts, child_resized, children_changed, find_child, focus_next, remove, set_child_opts, window_lost

Tickit::Widget

get_style_pen, get_style_text, get_style_values, key_focus_next_after, key_focus_next_before, on_pen_changed, parent, pen, redraw, requested_cols, requested_lines, requested_size, resized, set_parent, set_pen, set_requested_size, set_style, set_style_tag, set_window, style_classes, take_focus, window

AUTHOR ^

Tom Molesworth <cpan@entitymodel.com>

LICENSE ^

Copyright Tom Molesworth 2012-2014. Licensed under the same terms as Perl itself.

syntax highlighting: