home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / auto / Tk / Widget / Descendants.al < prev    next >
Encoding:
Text File  |  1997-08-10  |  638 b   |  23 lines

  1. # NOTE: Derived from blib\lib\Tk\Widget.pm.  Changes made here will be lost.
  2. package Tk::Widget;
  3.  
  4. sub Descendants
  5. {
  6.  # Return a list of widgets derived from a parent widget and all its
  7.  # descendants of a particular class.  
  8.  # If class is not passed returns the entire widget hierarchy.
  9.  
  10.  my($widget, $class) = @_;
  11.  my(@widget_tree)    = ();
  12.  
  13.  $widget->Walk(
  14.                sub { my ($widget,$list,$class) = @_;
  15.                      push(@$list, $widget) if  (!defined($class) or $class eq $widget->class);
  16.                    }, 
  17.                \@widget_tree, $class
  18.               );
  19.  return @widget_tree;
  20.  
  21. 1;
  22.