… | |
… | |
206 | %$self = (); |
206 | %$self = (); |
207 | } |
207 | } |
208 | |
208 | |
209 | sub show { |
209 | sub show { |
210 | my ($self) = @_; |
210 | my ($self) = @_; |
211 | |
|
|
212 | return if $self->{parent}; |
211 | return if $self->{parent}; |
213 | |
212 | |
214 | $CFClient::UI::ROOT->add ($self); |
213 | $CFClient::UI::ROOT->add ($self); |
215 | } |
214 | } |
216 | |
215 | |
… | |
… | |
427 | Scalar::Util::weaken ($self->{parent} = $parent); |
426 | Scalar::Util::weaken ($self->{parent} = $parent); |
428 | |
427 | |
429 | # TODO: req_w _does_change after ->reconfigure |
428 | # TODO: req_w _does_change after ->reconfigure |
430 | $self->check_size |
429 | $self->check_size |
431 | unless exists $self->{req_w}; |
430 | unless exists $self->{req_w}; |
|
|
431 | |
|
|
432 | $self->show; |
432 | } |
433 | } |
433 | |
434 | |
434 | sub check_size { |
435 | sub check_size { |
435 | my ($self, $forced) = @_; |
436 | my ($self, $forced) = @_; |
436 | |
437 | |
… | |
… | |
2525 | $self |
2526 | $self |
2526 | } |
2527 | } |
2527 | |
2528 | |
2528 | sub size_request { |
2529 | sub size_request { |
2529 | (32, 8) |
2530 | (32, 8) |
|
|
2531 | } |
|
|
2532 | |
|
|
2533 | sub update { |
|
|
2534 | my ($self) = @_; |
|
|
2535 | |
|
|
2536 | return unless $self->{visible}; |
|
|
2537 | |
|
|
2538 | $self->SUPER::update; |
2530 | } |
2539 | } |
2531 | |
2540 | |
2532 | sub _draw { |
2541 | sub _draw { |
2533 | my ($self) = @_; |
2542 | my ($self) = @_; |
2534 | |
2543 | |
… | |
… | |
2988 | $child->{x} = int $child->{x}; |
2997 | $child->{x} = int $child->{x}; |
2989 | $child->{y} = int $child->{y}; |
2998 | $child->{y} = int $child->{y}; |
2990 | } |
2999 | } |
2991 | |
3000 | |
2992 | $self->SUPER::add (@children); |
3001 | $self->SUPER::add (@children); |
|
|
3002 | |
|
|
3003 | while (@children) { |
|
|
3004 | my $w = pop @children; |
|
|
3005 | push @children, $w->children; |
|
|
3006 | $w->{visible} = 1; |
|
|
3007 | } |
|
|
3008 | } |
|
|
3009 | |
|
|
3010 | sub remove { |
|
|
3011 | my ($self, @children) = @_; |
|
|
3012 | |
|
|
3013 | $self->SUPER::remove (@children); |
|
|
3014 | |
|
|
3015 | while (@children) { |
|
|
3016 | my $w = pop @children; |
|
|
3017 | push @children, $w->children; |
|
|
3018 | delete $w->{visible}; |
|
|
3019 | } |
2993 | } |
3020 | } |
2994 | |
3021 | |
2995 | sub on_refresh { |
3022 | sub on_refresh { |
2996 | my ($self, $id, $cb) = @_; |
3023 | my ($self, $id, $cb) = @_; |
2997 | |
3024 | |