Tickit-Widget-Layout-Desktop
view release on metacpan or search on metacpan
lib/Tickit/Widget/Layout/Desktop.pod view on Meta::CPAN
use warnings;
use Tickit;
use Tickit::Widget::Placegrid;
use Tickit::Widget::Layout::Desktop;
my $tickit = Tickit->new;
my $desktop = Tickit::Widget::Layout::Desktop->new;
$tickit->later(sub {
my $left = int($desktop->window->cols * rand);
my $top = int($desktop->window->lines * rand);
my $cols = 20 + int(10 * rand);
my $lines = 5 + int(20 * rand);
$left = $desktop->window->cols - $cols if $left + $cols >= $desktop->window->cols;
$top = $desktop->window->lines - $lines if $top + $lines >= $desktop->window->lines;
$desktop->create_panel(
label => 'widget',
left => $left,
top => $top,
cols => $cols,
lines => $lines,
)->add(Tickit::Widget::Placegrid->new);
});
$tickit->set_root_widget($desktop);
$tickit->run;
=head1 DESCRIPTION
Experimental release for a container that provides move/resize/minimize/maximize "window" behaviour.
=begin HTML
<p><img src="http://tickit.perlsite.co.uk/cpan-screenshot/tickit-widget-layout-desktop1.gif" alt="Desktop widget in action" width="539" height="315"></p>
=end HTML
Constructed of:
=over 4
=item * L<Tickit::Widget::Layout::Desktop::Window> - the window implementation
=item * this class - background desktop on which the floats are displayed
=back
and maybe later:
=over 4
=item * ::Desktop::Taskbar - a subclass of statusbar which provides
window lists and launchers
=back
=head1 METHODS
=head2 render_to_rb
Clears the exposed area. All rendering happens in the
floating windows on top of this widget.
=head2 overlay
Render all window outlines on top of the target widget.
Takes the following parameters:
=over 4
=item * $rb - the L<Tickit::RenderBuffer> we will be drawing into
=item * $exclude - the current L<Tickit::Widget> we are drawing - this will be used
to check for intersections so we don't waste time drawing unrelated areas
=back
=head2 window_gained
Records our initial window geometry when the L<Tickit::Window> is first attached.
=head2 create_panel
Creates a L<Tickit::Widget::Layout::Desktop::Window> on this L<Tickit::Widget::Layout::Desktop>.
Takes the following named parameters:
=over 4
=item * top - offset from top of desktop
=item * left - offset from desktop left margin
=item * lines - how many lines the new widget will have, should be >2 to display anything useful
=item * cols - how many columns the new widget will have, should be >2 to display anything useful
=item * label - what label to use, default is the uninspiring text C<window>
=back
=head1 API METHODS
These methods are provided as an API for the L<Tickit::Widget::Layout::Desktop::Window> children.
They allow widgets to interact with the desktop for requesting focus etc.
=head2 make_active
Makes the requested L<Tickit::Widget::Layout::Desktop::Window> active - brings it to the front of
the stack and gives it focus.
Returns $self.
=head2 weld
"Welds" edges of windows together.
Takes 4 parameters:
=over 4
=item * Source widget edge
( run in 0.835 second using v1.01-cache-2.11-cpan-39bf76dae61 )