App-Codit

 view release on metacpan or  search on metacpan

lib/App/Codit/SessionManager.pm  view on Meta::CPAN

package App::Codit::SessionManager;

=head1 NAME

App::Codit::SessionManager - Session manager used by the Sessions plugin

=cut

use strict;
use warnings;
use Carp;
require Tk::YAMessage;
use File::Copy;
use vars qw($VERSION);
$VERSION = '0.19';

use base qw(Tk::Derived Tk::YADialog);
Construct Tk::Widget 'SessionManager';


sub Populate {
	my ($self,$args) = @_;
	
	my $plug = delete $args->{'-plugin'};
	carp 'You must specify the -plugin option' unless defined $plug;

	$self->SUPER::Populate($args);

	my @padding = (-padx => 4, -pady => 4);

	my $art = $plug->extGet('Art');
	
	my @sessions = ();
	$self->{SESSIONS} = \@sessions;
	$self->{PLUGIN} = $plug;
	my $lb = $self->Scrolled('Listbox',
		-scrollbars => 'osoe',
		-listvariable => \@sessions,
		-selectmode => 'single',
	)->pack(-side => 'left', @padding, -fill => 'y',);
	$self->Advertise('Listbox', $lb);

	my $bf = $self->Frame(
		-relief => 'groove',
		-borderwidth => 2,
	)->pack(-side => 'left', -fill => 'y', @padding);

	$bf->Button(
		-image => $art->createCompound(
			-text => 'Open',
			-image => $art->getIcon('document-open', 22),
		),
		-anchor => 'w',
		-command => ['Open', $self],
	)->pack(@padding, -fill => 'x');
	$bf->Button(
		-image => $art->createCompound(
			-text => 'New session',
			-image => $art->getIcon('document-new', 22),
		),
		-anchor => 'w',
		-command => ['NewSession', $self],
	)->pack(@padding, -fill => 'x');
	$bf->Label(-text => ' ')->pack(@padding);
	$bf->Button(
		-image => $art->createCompound(
			-text => 'Duplicate',
			-image => $art->createEmptyImage(22),
		),
		-anchor => 'w',
		-command => ['Duplicate', $self],
	)->pack(@padding, -fill => 'x');
	$bf->Button(
		-image => $art->createCompound(
			-text => 'Rename',
			-image => $art->createEmptyImage(22),
		),
		-anchor => 'w',
		-command => ['Rename', $self],
	)->pack(@padding, -fill => 'x');
	$bf->Label(-text => ' ')->pack(@padding);
	$bf->Button(
		-image => $art->createCompound(
			-text => 'Delete',
			-image => $art->getIcon('edit-delete', 22),
		),
		-anchor => 'w',



( run in 0.417 second using v1.01-cache-2.11-cpan-99c4e6809bf )