Tickit-Widget-Layout-Desktop
view release on metacpan or search on metacpan
NAME
Tickit::Widget::Layout::Desktop - provides a holder for "desktop-like"
widget behaviour
SYNOPSIS
#!/usr/bin/env perl
use strict;
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;
DESCRIPTION
Experimental release for a container that provides
move/resize/minimize/maximize "window" behaviour.
Constructed of:
* Tickit::Widget::Layout::Desktop::Window - the window implementation
* this class - background desktop on which the floats are displayed
and maybe later:
* ::Desktop::Taskbar - a subclass of statusbar which provides window
lists and launchers
METHODS
render_to_rb
Clears the exposed area. All rendering happens in the floating windows
on top of this widget.
overlay
Render all window outlines on top of the target widget.
Takes the following parameters:
* $rb - the Tickit::RenderBuffer we will be drawing into
* $exclude - the current Tickit::Widget we are drawing - this will be
used to check for intersections so we don't waste time drawing
unrelated areas
window_gained
Records our initial window geometry when the Tickit::Window is first
attached.
create_panel
Creates a Tickit::Widget::Layout::Desktop::Window on this
Tickit::Widget::Layout::Desktop.
Takes the following named parameters:
* top - offset from top of desktop
* left - offset from desktop left margin
* lines - how many lines the new widget will have, should be >2 to
display anything useful
* cols - how many columns the new widget will have, should be >2 to
display anything useful
* label - what label to use, default is the uninspiring text window
API METHODS
These methods are provided as an API for the
Tickit::Widget::Layout::Desktop::Window children. They allow widgets to
interact with the desktop for requesting focus etc.
make_active
Makes the requested Tickit::Widget::Layout::Desktop::Window active -
brings it to the front of the stack and gives it focus.
Returns $self.
weld
"Welds" edges of windows together.
Takes 4 parameters:
* Source widget edge
* Source widget
* Destination edge
( run in 1.875 second using v1.01-cache-2.11-cpan-39bf76dae61 )