… | |
… | |
618 | delete $child->{parent}; |
618 | delete $child->{parent}; |
619 | $child->hide; |
619 | $child->hide; |
620 | |
620 | |
621 | $self->{children} = [ grep $_ != $child, @{ $self->{children} } ]; |
621 | $self->{children} = [ grep $_ != $child, @{ $self->{children} } ]; |
622 | |
622 | |
623 | $self->check_size; |
623 | $self->check_size (1); |
624 | $self->update; |
624 | $self->update; |
625 | } |
625 | } |
626 | |
626 | |
627 | sub clear { |
627 | sub clear { |
628 | my ($self) = @_; |
628 | my ($self) = @_; |
… | |
… | |
1101 | col_expand => [], |
1101 | col_expand => [], |
1102 | @_, |
1102 | @_, |
1103 | ) |
1103 | ) |
1104 | } |
1104 | } |
1105 | |
1105 | |
|
|
1106 | sub children { |
|
|
1107 | grep $_, map @$_, grep $_, @{ $_[0]{children} } |
|
|
1108 | } |
|
|
1109 | |
1106 | sub add { |
1110 | sub add { |
1107 | my ($self, $x, $y, $child) = @_; |
1111 | my ($self, $x, $y, $child) = @_; |
1108 | |
1112 | |
1109 | $child->set_parent ($self); |
1113 | $child->set_parent ($self); |
1110 | $self->{children}[$y][$x] = $child; |
1114 | $self->{children}[$y][$x] = $child; |
1111 | |
1115 | |
1112 | $child->check_size; |
1116 | $self->check_size (1); |
1113 | } |
1117 | } |
1114 | |
1118 | |
1115 | sub children { |
|
|
1116 | grep $_, map @$_, grep $_, @{ $_[0]{children} } |
|
|
1117 | } |
|
|
1118 | |
|
|
1119 | # TODO: move to container class maybe? send childs a signal on removal? |
1119 | # TODO: move to container class maybe? send children a signal on removal? |
1120 | sub clear { |
1120 | sub clear { |
1121 | my ($self) = @_; |
1121 | my ($self) = @_; |
1122 | |
1122 | |
1123 | my @children = $self->children; |
1123 | my @children = $self->children; |
1124 | delete $self->{children}; |
1124 | delete $self->{children}; |
… | |
… | |
1126 | for (@children) { |
1126 | for (@children) { |
1127 | delete $_->{parent}; |
1127 | delete $_->{parent}; |
1128 | $_->hide; |
1128 | $_->hide; |
1129 | } |
1129 | } |
1130 | |
1130 | |
|
|
1131 | $self->check_size (1); |
1131 | $self->update; |
1132 | $self->update; |
1132 | } |
1133 | } |
1133 | |
1134 | |
1134 | sub get_wh { |
1135 | sub get_wh { |
1135 | my ($self) = @_; |
1136 | my ($self) = @_; |