NAME
Tickit::Builder - widget layout definition from Perl structure or file
VERSION
version 0.001
SYNOPSIS
use Tickit::Async;
use Tickit::Builder;
my $layout = Tickit::Builder->new;
$layout->run({
widget => {
type => 'VBox',
children => [
{ widget => { type => "Menu", bg => 'blue', children => [
{ widget => { type => "Menu::Item", text => "File" } },
{ widget => { type => "Menu::Item", text => "Edit" } },
{ widget => { type => "Menu::Spacer", text => " " }, expand => 1 },
{ widget => { type => "Menu::Item", text => "Help" } },
] }},
{ widget => { type => "HBox", text => "Static entry", children => [
{ widget => { type => "VBox", children => [
{ widget => { type => "Static", text => "Left panel" } },
] }, expand => 0.15 },
{ widget => { type => "VBox", children => [
{ widget => { type => "Frame", style => 'single', children => [
{ widget => { type => "Static", text => "Centre bit", fg => 'yellow' }, expand => 1 },
] }, expand => 1 },
{ widget => { type => "VBox", children => [
{ widget => { type => "Static", text => "lower panel" } },
] } },
] }, expand => 0.85 },
] }, expand => 1 },
{ widget => { type => "Static", text => "Status bar", bg => 0x04, fg => 'white', } },
],
}
});
DESCRIPTION
Very basic helper class for reading a widget layout definition and instantiating the required objects. Intended to be used with the web-based or Tickit-based layout editor.
METHODS
new
Instantiate a new Tickit::Builder object. Takes no parameters.
report
Debug output.
parse_widget
Parse a widget definition from a hashref.
by_id
Returns the widget with the given ID.
by_class
Returns a list of all widgets matching the given classname.
parse
Parse the top-level layout spec (hashref).
apply_layout
Apply the given layout to the Tickit instance.
Takes two parameters:
$tickit - a Tickit instance.
$layout - a hashref representing the requested layout.
run
Helper method to parse and run the layout definition using Tickit::Async.
parse_file
Parse definition from a file.
AUTHOR
Tom Molesworth <cpan@entitymodel.com>
LICENSE
Copyright Tom Molesworth 2011. Licensed under the same terms as Perl itself.