Tk::Multi::Frame - A TFrame widget managed by Tk::Multi


Tk-Multi documentation Contained in the Tk-Multi distribution.

Index


Code Index:

NAME

Top

  Tk::Multi::Frame - A TFrame widget managed by Tk::Multi

SYNOPSIS

Top

 use Tk::Multi::Manager;

 use Tk::Multi::Frame ; 

 my $manager = $yourWindow -> MultiManager 
  (
   menu => $menu_ref , # optionnal
   printSub => $sub_ref ,  # optionnal
   title => "windows" # optionnal
  ) -> pack ();

 # Don't pack it, the manager will do it
 my $w1 = $manager -> newSlave('type' => 'MultiFrame', 
                               'title' => 'a_label');

DESCRIPTION

Top

This composite widget features :

This widget will forward all unrecognize commands to the Frame object.

Note that this widget should be created only by the Multi::Manager.

WIDGET-SPECIFIC OPTIONS

Top

title

The frame title (See Tk::TFrame)

printSub

By itself, a frame cannot be printed. So if the user wants to print some informations related to what's packed inside the frame, he must provide a sub ref which will return a string. This string will be printed as is by the widget.

WIDGET-SPECIFIC METHODS

Top

print

doPrint

Print the label and the content of the text window. The print is invoked by dumping the text content into a piped command.

You may want to set up a new command to print correctly on your machine. You may do it by using the setPrintCmd method or by invoking the 'print' method.

setPrintCmd('print command')

Will set the $printCmd class variable to the passed string. You may use this method to set the appropriate print command on your machine. Note that using this method will affect all other Tk::Multi::Frame object since the modified variable is not an instance variable but a class variable.

Delegated methods

Top

By default all widget method are delegated to the TFrame widget. Excepted :

command(-label => 'some text', -command => sub {...} )

Delegated to the menu entry managed by Multi::Manager. Will add a new command to the aforementionned menu.

NOTE

Top

If you want to use a scrolled frame, you pack a Tk::Pane within the frame provided by this widget. See Tk::Pane.

TO DO

Top

I'm not really satisfied with print management. May be one day, I'll write a print management composite widget which will look like Netscape's print window. But that's quite low on my priority list. Any volunteer ?

Defines ressources for the config options.

AUTHOR

Top

Dominique Dumont, domi@komarr.grenoble.hp.com

 Copyright (c) 1997-1999,2002,2004 Dominique Dumont. All rights
 reserved.  This program is free software; you can redistribute it
 and/or modify it under the same terms as Perl itself.

SEE ALSO

Top

perl(1), Tk, Tk::Multi, Tk::Multi::Manager, Tk::TFrame, Tk::Pane


Tk-Multi documentation Contained in the Tk-Multi distribution.

# Copyright (c) 1997-1998 Dominique Dumont. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.

package Tk::Multi::Frame ;

use strict;

use vars qw($printCmd $defaultPrintCmd $VERSION);

use base qw(Tk::Derived Tk::TFrame Tk::Multi::Any);

$VERSION = sprintf "%d.%03d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/;

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

$printCmd = $defaultPrintCmd = 'lp -ol70 -otl66 -o12 -olm10' ;

Tk::Widget->Construct('MultiFrame');

# Preloaded methods go here.

# Autoload methods go after =cut, and are processed by the autosplit program.

sub Populate
  {
    my ($cw,$args) = @_ ;
    Tk::Multi::Any::normalize($cw,$args) ;

    require Tk::Label;
    require Tk::Frame;

    $cw->{_printCmdRef} = \$printCmd ;

    my $title = $cw ->{'title'} = delete $args->{'-title'} || 'anonymous';
    $args->{-label} = [ -text => $title ]; # for TFrame;
    $cw->{printSub} = delete $args->{-print};

    my $menu = delete $args->{'-menu_button'};
    die "Multi window $title: missing menu_button argument\n" 
      unless defined $menu ;

    $menu->command(-label=>'print...', -command => [$cw, 'print' ]) 
      if defined $cw->{printSub};

    # print stuff
    $cw->{_printToFile} = 0;
    $cw->{_printFile} = '';

    my $subref = sub {$menu->Popup(-popover => 'cursor', -popanchor => 'nw')};

    $cw -> bind('<Button-3>', $subref);

    $cw->ConfigSpecs(
                     '-borderwidth' => [$cw, undef, undef, 2 ],
                     -relief => [$cw, undef, undef,'groove'],
                     'DEFAULT' => [$cw]
                    ) ;

    $cw->Delegates('-command' => $menu, 
                   DEFAULT => $cw) ;

    $cw->SUPER::Populate($args);
  }

sub resetPrintCmd
  {
    my $cw=shift ;
    $printCmd=$defaultPrintCmd ;
  }

sub printableDump
  {
    my $cw= shift ;
    return  &{$cw->{printSub}} ;
  }

1;
__END__


# Below is the stub of documentation for your module. You better edit it!