Tk-ObjEditor
view release on metacpan or search on metacpan
lib/Tk/ObjEditorDialog.pm view on Meta::CPAN
#
# This file is part of Tk-ObjEditor
#
# This software is copyright (c) 2014 by Dominique Dumont.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
package Tk::ObjEditorDialog;
$Tk::ObjEditorDialog::VERSION = '2.010';
use strict;
use warnings;
use Carp;
use Tk::ObjEditor;
use vars qw/$VERSION @ISA/;
#use Storable qw(dclone);
use base qw(Tk::Derived Tk::DialogBox);
Tk::Widget->Construct('ObjEditorDialog');
sub Populate {
my ( $cw, $args ) = @_;
my $data = delete $args->{'caller'} || delete $args->{'-caller'};
$cw->{direct} = delete $args->{'direct'} || delete $args->{'-direct'} || 0;
# need to add different button for clone ????
my $buttons = $cw->{direct} ? ['done'] : [qw/OK cancel/];
$args->{-buttons} = $buttons;
$cw->SUPER::Populate($args);
$cw->add( 'ObjEditor', caller => $data, -direct => $cw->{direct} )->pack;
return $cw;
}
sub Show {
my $cw = shift;
my $hit = $cw->SUPER::Show(@_);
if ( $hit eq 'OK' ) {
# no direct edit
return $cw->Subwidget("objeditor")->get_data();
}
else {
return $cw->Subwidget("objeditor")->get_orig_data();
}
}
=head1 NAME
Tk::ObjEditorDialog - Tk composite widget obj editor popup dialog
=head1 SYNOPSIS
use Tk::ObjEditorDialog;
my $editor = $mw->ObjEditorDialog( caller => $object,
direct => [1|0],
[title=>"windows"]) ;
$editor -> Show;
=head1 DESCRIPTION
This widget is a L<ObjEditor> within a L<DialogBox> widget. I.e. it
will appear in its own toplevel window when you invoke the Show()
method like the FileDialog widget.
=head1 Constructor parameters
=over 4
( run in 0.777 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )