… | |
… | |
530 | |
530 | |
531 | $self |
531 | $self |
532 | } |
532 | } |
533 | |
533 | |
534 | sub add { |
534 | sub add { |
535 | my ($self, $child) = @_; |
535 | my ($self, @widgets) = @_; |
536 | |
536 | |
537 | $child->set_parent ($self); |
537 | $_->set_parent ($self) |
|
|
538 | for @widgets; |
538 | |
539 | |
539 | use sort 'stable'; |
540 | use sort 'stable'; |
540 | |
541 | |
541 | $self->{children} = [ |
542 | $self->{children} = [ |
542 | sort { $a->{z} <=> $b->{z} } |
543 | sort { $a->{z} <=> $b->{z} } |
543 | @{$self->{children}}, $child |
544 | @{$self->{children}}, @widgets |
544 | ]; |
545 | ]; |
545 | |
546 | |
546 | $child->check_size; |
547 | $_->check_size |
|
|
548 | for @widgets; |
|
|
549 | |
547 | $self->update; |
550 | $self->update; |
548 | } |
551 | } |
549 | |
552 | |
550 | sub children { |
553 | sub children { |
551 | @{ $_[0]{children} } |
554 | @{ $_[0]{children} } |
… | |
… | |
2702 | my $old_h = $self->{old_h}; |
2705 | my $old_h = $self->{old_h}; |
2703 | |
2706 | |
2704 | if ($old_w && $old_h) { |
2707 | if ($old_w && $old_h) { |
2705 | for my $child ($self->children) { |
2708 | for my $child ($self->children) { |
2706 | $child->{x} = int 0.5 + $child->{x} * $w / $old_w; |
2709 | $child->{x} = int 0.5 + $child->{x} * $w / $old_w; |
2707 | $child->{w} = int 0.5 + $child->{req_w} * $w / $old_w; |
2710 | $child->{w} = int 0.5 + $child->{w} * $w / $old_w; |
2708 | $child->{req_w} = int 0.5 + $child->{req_w} * $w / $old_w if exists $child->{req_w}; |
2711 | $child->{req_w} = int 0.5 + $child->{req_w} * $w / $old_w if exists $child->{req_w}; |
2709 | $child->{user_w} = int 0.5 + $child->{user_w} * $w / $old_w if exists $child->{user_w}; |
2712 | $child->{user_w} = int 0.5 + $child->{user_w} * $w / $old_w if exists $child->{user_w}; |
2710 | $child->{y} = int 0.5 + $child->{y} * $h / $old_h; |
2713 | $child->{y} = int 0.5 + $child->{y} * $h / $old_h; |
2711 | $child->{h} = int 0.5 + $child->{h} * $h / $old_h; |
2714 | $child->{h} = int 0.5 + $child->{h} * $h / $old_h; |
2712 | $child->{req_h} = int 0.5 + $child->{req_h} * $h / $old_h if exists $child->{req_h}; |
2715 | $child->{req_h} = int 0.5 + $child->{req_h} * $h / $old_h if exists $child->{req_h}; |