The following documentation is automatically generated. Please do not edit this file, but rather the original, inline with Tickit::Widget::Layout::Desktop at lib/Tickit/Widget/Layout/Desktop.pm (on the system that originally ran this). If you do edit this file, and don't want your changes to be removed, make sure you change the first line.
Tickit::Widget::Layout::Desktop - provides a holder for "desktop-like" widget behaviour
#!/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;
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
Clears the exposed area. All rendering happens in the floating windows on top of this widget.
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
Records our initial window geometry when the Tickit::Window is first attached.
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
window
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.
Makes the requested Tickit::Widget::Layout::Desktop::Window active - brings it to the front of the stack and gives it focus.
Returns $self.
"Welds" edges of windows together.
Takes 4 parameters:
Source widget edge
Source widget
Destination edge
Destination widget
For example:
$desktop->weld( right => $left_panel, left => $right_panel, );
Given a two-panel layout, this would mean any changes to the right edge of the panel on the left would adjust the left edge of the panel on the right, and vice versa.
As you increase the size of the left panel, the right panel shrinks, so instead of the normal behaviour where the widget on the left would start to overlap the one on the right, this maintains the relative positioning by resizing the target widget. This can be used to provide movable dividers between desktop panels, allowing temporary resize without disrupting the layout.
Returns $self for chaining.
$self
Deal with reshape requests.
Since our windows are positioned directly, we're going to lose some information if shrink then expand the parent window again. This isn't ideal but hopefully we can get away with it for now.
Arrange all the windows in a cascade (first at 1,1, second at 2,2, etc.).
Tiles all the windows. Tries to lay them out so things don't overlap. Since we're resizing, things may end up ridiculously small.
Pass overlap => 1 to have overlapping edges.
Close all the windows.
Tickit::Widget::FloatBox - eventually ::Desktop will probably start using FloatBox for the float management
add, child_opts, child_resized, children_changed, find_child, new, remove, set_child_opts, window_lost
get_style_pen, get_style_text, get_style_values, key_focus_next_after, key_focus_next_before, parent, pen, redraw, requested_cols, requested_lines, requested_size, resized, set_parent, set_requested_size, set_style, set_style_tag, set_window, style_classes, take_focus, window
Tom Molesworth <TEAM@cpan.org>
Copyright Tom Molesworth 2011-2020. Licensed under the same terms as Perl itself.
To install Tickit::Widget::Layout::Desktop, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit::Widget::Layout::Desktop
CPAN shell
perl -MCPAN -e shell install Tickit::Widget::Layout::Desktop
For more information on module installation, please visit the detailed CPAN module installation guide.