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

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

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

revision 1.2 by jlenton, Mon Apr 14 22:31:39 2003 UTC revision 1.3 by fheinz, Tue Apr 15 21:21:32 2003 UTC
# Line 20  sub align Line 20  sub align
20      foreach my $object (@alignees)      foreach my $object (@alignees)
21      {      {
22          # If object's height not set, make it as high as the box          # If object's height not set, make it as high as the box
23          my $height = $object->height || $object->height($self->height);          my $height = $object->height || $object->height($self->contents_height);
24    
25          # Place object in the vertical according to alignment          # Place object in the vertical according to alignment
26          $object->y($self->y + $self->height - $object->height), next if $alignment =~ /^bottom$/i;          $object->y($self->contents_origin_y + $self->contents_height - $object->height), next if $alignment =~ /^bottom$/i;
27          $object->y(int(($self->y + $self->height - $object->height)/2)), next if $alignment =~ /^center$/i;          $object->y(int(($self->contents_origin_y + $self->contents_height - $object->height)/2)), next if $alignment =~ /^center$/i;
28          $object->y($self->y);   # Default case: top alignment          $object->y($self->contents_origin_y);   # Default case: top alignment
29      }      }
30  }  }
31    
# Line 33  sub layout Line 33  sub layout
33  {  {
34      my $self = shift;      my $self = shift;
35      my @alignees = @_;      my @alignees = @_;
36      my $free_space = $self->width;      my $free_space = $self->contents_width;
37      my @stretchable = ();      my @stretchable = ();
38    
39      foreach my $object (@alignees)      foreach my $object (@alignees)
# Line 54  sub layout Line 54  sub layout
54    
55      # Now lay out the elements      # Now lay out the elements
56      my $alignment = $self->halign;      my $alignment = $self->halign;
57      my $cursor = $self->x;      # Default alignment is left      my $cursor = $self->contents_origin_x;      # Default alignment is left
58      $cursor += int($free_space/2) if $alignment =~ /^center$/;      $cursor += int($free_space/2) if $alignment =~ /^center$/; # Advance cursor by free/2: centered
59      $cursor += $free_space if $alignment =~ /^right$/;      $cursor += $free_space if $alignment =~ /^right$/; # dvance cursor by free: flush right
60      map {$_->x($cursor); $cursor += $_->width} @alignees;      map {$_->x($cursor); $cursor += $_->width} @alignees;
61            
62  }  }

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

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