ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.235 by root, Thu May 25 16:35:42 2006 UTC vs.
Revision 1.237 by root, Thu May 25 21:36:45 2006 UTC

458sub set_parent { 458sub set_parent {
459 my ($self, $parent) = @_; 459 my ($self, $parent) = @_;
460 460
461 Scalar::Util::weaken ($self->{parent} = $parent); 461 Scalar::Util::weaken ($self->{parent} = $parent);
462 462
463 $self->{root} = $parent->{root};
464 $self->{visible} = $parent->{visible};
465
463 # TODO: req_w _does_change after ->reconfigure 466 # TODO: req_w _does_change after ->reconfigure
464 $self->check_size 467 $self->check_size
465 unless exists $self->{req_w}; 468 unless exists $self->{req_w};
466 469
467 $self->show; 470 $self->show;
618 delete $child->{parent}; 621 delete $child->{parent};
619 $child->hide; 622 $child->hide;
620 623
621 $self->{children} = [ grep $_ != $child, @{ $self->{children} } ]; 624 $self->{children} = [ grep $_ != $child, @{ $self->{children} } ];
622 625
623 $self->check_size; 626 $self->check_size (1);
624 $self->update; 627 $self->update;
625} 628}
626 629
627sub clear { 630sub clear {
628 my ($self) = @_; 631 my ($self) = @_;
1101 col_expand => [], 1104 col_expand => [],
1102 @_, 1105 @_,
1103 ) 1106 )
1104} 1107}
1105 1108
1109sub children {
1110 grep $_, map @$_, grep $_, @{ $_[0]{children} }
1111}
1112
1106sub add { 1113sub add {
1107 my ($self, $x, $y, $child) = @_; 1114 my ($self, $x, $y, $child) = @_;
1108 1115
1109 $child->set_parent ($self); 1116 $child->set_parent ($self);
1110 $self->{children}[$y][$x] = $child; 1117 $self->{children}[$y][$x] = $child;
1111 1118
1112 $child->check_size; 1119 $self->check_size (1);
1113} 1120}
1114 1121
1115sub children {
1116 grep $_, map @$_, grep $_, @{ $_[0]{children} }
1117}
1118
1119# TODO: move to container class maybe? send childs a signal on removal? 1122# TODO: move to container class maybe? send children a signal on removal?
1120sub clear { 1123sub clear {
1121 my ($self) = @_; 1124 my ($self) = @_;
1122 1125
1123 my @children = $self->children; 1126 my @children = $self->children;
1124 delete $self->{children}; 1127 delete $self->{children};
1126 for (@children) { 1129 for (@children) {
1127 delete $_->{parent}; 1130 delete $_->{parent};
1128 $_->hide; 1131 $_->hide;
1129 } 1132 }
1130 1133
1134 $self->check_size (1);
1131 $self->update; 1135 $self->update;
1132} 1136}
1133 1137
1134sub get_wh { 1138sub get_wh {
1135 my ($self) = @_; 1139 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines