/[papo]/papo/neb/neb/Tree/VBox.pm
ViewVC logotype

Diff of /papo/neb/neb/Tree/VBox.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by fheinz, Mon Apr 14 19:38:27 2003 UTC revision 1.2 by jlenton, Mon Apr 14 22:31:39 2003 UTC
# Line 17  sub align Line 17  sub align
17      my @alignees = @_;      my @alignees = @_;
18      my $alignment = $self->halign;      my $alignment = $self->halign;
19    
20      foreach my $object in (@alignees)      foreach my $object (@alignees)
21      {      {
22          # If object's width not set, make it as high as the box          # If object's width not set, make it as high as the box
23          my $width = $object->width || $object->width($self->width);          my $width = $object->width || $object->width($self->width);
# Line 29  sub align Line 29  sub align
29      }      }
30  }  }
31    
32  sub layout {}  sub layout
33  {  {
34      my $self = shift;      my $self = shift;
35      my @alignees = @_;      my @alignees = @_;
36      my $free_space = $self->height;      my $free_space = $self->height;
37      my @stretchable = ();      my @stretchable = ();
38    
39      foreach my $object in (@alignees)      foreach my $object (@alignees)
40      {      {
41          my $height = $object->height;          my $height = $object->height;
42          # If height is defined, then that space is taken.          # If height is defined, then that space is taken.
43          # If height undefined, record object to be stretched          # If height undefined, record object to be stretched
44          defined($height) ? $free_space -= $height : push(@stretchable, $object);          defined($height) ? $free_space -= $height : push(@stretchable, $object);
45      }      }
46      $free_space < 0 && $free_space = 0; # make sure free space not negative      $free_space < 0 and $free_space = 0;        # make sure free space not negative
47    
48      # Distribute free space among stretchable items, if any      # Distribute free space among stretchable items, if any
49      if (0 < @stretchable)      if (0 < @stretchable)
# Line 53  sub layout {} Line 53  sub layout {}
53      }      }
54    
55      # Now lay out the elements      # Now lay out the elements
56      my $alignment = = $self->valign;      my $alignment = $self->valign;
57      my $cursor = $self->y;      # Default alignment is left      my $cursor = $self->y;      # Default alignment is left
58      $cursor += int($free_space/2) if $alignment =~ /^center$/;      $cursor += int($free_space/2) if $alignment =~ /^center$/;
59      $cursor += $free_space if $alignment =~ /^right$/;      $cursor += $free_space if $alignment =~ /^right$/;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26