Tickit::Builder - widget layout definition from Perl structure or file
version 0.001
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', } }, ], } });
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.
Instantiate a new Tickit::Builder object. Takes no parameters.
Debug output.
Parse a widget definition from a hashref.
Returns the widget with the given ID.
Returns a list of all widgets matching the given classname.
Parse the top-level layout spec (hashref).
Apply the given layout to the Tickit instance.
Takes two parameters:
$tickit - a Tickit instance.
$layout - a hashref representing the requested layout.
Helper method to parse and run the layout definition using Tickit::Async.
Parse definition from a file.
Tom Molesworth <cpan@entitymodel.com>
Copyright Tom Molesworth 2011. Licensed under the same terms as Perl itself.
To install Tickit::Builder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit::Builder
CPAN shell
perl -MCPAN -e shell install Tickit::Builder
For more information on module installation, please visit the detailed CPAN module installation guide.