… | |
… | |
206 | %$self = (); |
206 | %$self = (); |
207 | } |
207 | } |
208 | |
208 | |
209 | sub show { |
209 | sub show { |
210 | my ($self) = @_; |
210 | my ($self) = @_; |
211 | |
|
|
212 | for (my @w = $self; @w; ) { |
|
|
213 | my $w = pop @w; |
|
|
214 | push @w, $w->children; |
|
|
215 | $w->{visible} = 1; |
|
|
216 | } |
|
|
217 | |
|
|
218 | return if $self->{parent}; |
211 | return if $self->{parent}; |
219 | |
212 | |
220 | $CFClient::UI::ROOT->add ($self); |
213 | $CFClient::UI::ROOT->add ($self); |
221 | } |
214 | } |
222 | |
215 | |
223 | sub hide { |
216 | sub hide { |
224 | my ($self) = @_; |
217 | my ($self) = @_; |
225 | |
|
|
226 | for (my @w = $self; @w; ) { |
|
|
227 | my $w = pop @w; |
|
|
228 | push @w, $w->children; |
|
|
229 | $w->{visible} = 1; |
|
|
230 | } |
|
|
231 | |
218 | |
232 | undef $GRAB if $GRAB == $self; |
219 | undef $GRAB if $GRAB == $self; |
233 | undef $HOVER if $HOVER == $self; |
220 | undef $HOVER if $HOVER == $self; |
234 | |
221 | |
235 | $self->{parent}->remove ($self) |
222 | $self->{parent}->remove ($self) |
… | |
… | |
2539 | $self |
2526 | $self |
2540 | } |
2527 | } |
2541 | |
2528 | |
2542 | sub size_request { |
2529 | sub size_request { |
2543 | (32, 8) |
2530 | (32, 8) |
|
|
2531 | } |
|
|
2532 | |
|
|
2533 | sub update { |
|
|
2534 | my ($self) = @_; |
|
|
2535 | |
|
|
2536 | return unless $self->{visible}; |
|
|
2537 | |
|
|
2538 | $self->SUPER::update; |
2544 | } |
2539 | } |
2545 | |
2540 | |
2546 | sub _draw { |
2541 | sub _draw { |
2547 | my ($self) = @_; |
2542 | my ($self) = @_; |
2548 | |
2543 | |
… | |
… | |
3002 | $child->{x} = int $child->{x}; |
2997 | $child->{x} = int $child->{x}; |
3003 | $child->{y} = int $child->{y}; |
2998 | $child->{y} = int $child->{y}; |
3004 | } |
2999 | } |
3005 | |
3000 | |
3006 | $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 | } |
3007 | } |
3020 | } |
3008 | |
3021 | |
3009 | sub on_refresh { |
3022 | sub on_refresh { |
3010 | my ($self, $id, $cb) = @_; |
3023 | my ($self, $id, $cb) = @_; |
3011 | |
3024 | |