From 661c41a09e39a182865e0b51e34cc995a0dc96e8 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 12 May 2010 16:54:37 +0000 Subject: move tlperl.straw to tlperl git-svn-id: svn://tug.org/texlive/trunk@18210 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/tlperl/lib/Tk/composite.pod | 171 +++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100755 Master/tlpkg/tlperl/lib/Tk/composite.pod (limited to 'Master/tlpkg/tlperl/lib/Tk/composite.pod') diff --git a/Master/tlpkg/tlperl/lib/Tk/composite.pod b/Master/tlpkg/tlperl/lib/Tk/composite.pod new file mode 100755 index 00000000000..a493b5ee1f2 --- /dev/null +++ b/Master/tlpkg/tlperl/lib/Tk/composite.pod @@ -0,0 +1,171 @@ +# $Id: composite.pod 1.2 Wed, 12 Nov 1997 00:30:45 +0100 ach $ + +=head1 NAME + +Tk::composite - Defining a new composite widget class + +=for category Derived Widgets + +=head1 SYNOPSIS + + package Tk::MyNewWidget; + + use Tk:widgets qw/ list of Tk widgets /; + use base qw/ Tk::Frame /; # or Tk::Toplevel + + Construct Tk::Widget 'MyNewWidget'; + + sub ClassInit { + my( $class, $mw ) = @_; + #... e.g., class bindings here ... + $class->SUPER::ClassInit( $mw ); + } + + sub Populate { + my( $self, $args ) = @_; + + my $flag = delete $args->{-flag}; + if( defined $flag ) { + # handle -flag => xxx which can only be done at create + # time the delete above ensures that new() does not try + # and do $self->configure( -flag => xxx ); + } + + $self->SUPER::Populate( $args ); + + $self = $self->Component( ... ); + + $self->Delegates( ... ); + + $self->ConfigSpecs( + '-cursor' => [ SELF, 'cursor', 'Cursor', undef ], + '-something' => [ METHOD, dbName, dbClass, default ], + '-text' => [ $label, dbName, dbClass, default ], + '-heading' => [ {-text => $head}, + heading, Heading, 'My Heading' ], + ); + } + + sub something { + my( $self, $value) = @_; + if ( @_ > 1 ) { + # set it + } + return # current value + } + + 1; + + __END__ + + + =head1 NAME + + Tk::Whatever - a whatever widget + + =head1 SYNOPSIS + + use Tk::Whatever; + + $widget = $parent->Whatever(...); + + =head1 DESCRIPTION + + ... + +=head1 DESCRIPTION + +The intention behind a composite is to create a higher-level widget, +sometimes called a "super-widget" or "mega-widget". Most often, +a composite will be +built upon other widgets by B them, as opposed to specializing on them. +For example, the supplied composite widget B is I an +B and a B