… | |
… | |
253 | } |
253 | } |
254 | |
254 | |
255 | sub set_invisible { |
255 | sub set_invisible { |
256 | my ($self) = @_; |
256 | my ($self) = @_; |
257 | |
257 | |
|
|
258 | return unless $self->{visible}; |
|
|
259 | |
258 | # broken show/hide model |
260 | # broken show/hide model |
259 | |
261 | |
260 | delete $self->{root}; |
262 | delete $self->{root}; |
261 | delete $self->{visible}; |
263 | delete $self->{visible}; |
262 | |
264 | |
… | |
… | |
265 | |
267 | |
266 | CFClient::UI::check_tooltip |
268 | CFClient::UI::check_tooltip |
267 | if $CFClient::UI::TOOLTIP->{owner} == $self; |
269 | if $CFClient::UI::TOOLTIP->{owner} == $self; |
268 | |
270 | |
269 | $self->focus_out; |
271 | $self->focus_out; |
|
|
272 | |
|
|
273 | $self->emit (visibility_change => 0); |
270 | } |
274 | } |
271 | |
275 | |
272 | sub hide { |
276 | sub hide { |
273 | my ($self) = @_; |
277 | my ($self) = @_; |
274 | |
278 | |
… | |
… | |
486 | sub set_parent { |
490 | sub set_parent { |
487 | my ($self, $parent) = @_; |
491 | my ($self, $parent) = @_; |
488 | |
492 | |
489 | Scalar::Util::weaken ($self->{parent} = $parent); |
493 | Scalar::Util::weaken ($self->{parent} = $parent); |
490 | |
494 | |
|
|
495 | if ($parent->{visible} || 1) { |
491 | $self->{root} = $parent->{root}; |
496 | $self->{root} = $parent->{root}; |
492 | $self->{visible} = $parent->{visible} + 1; |
497 | $self->{visible} = $parent->{visible} + 1; |
|
|
498 | |
|
|
499 | $self->emit (visibility_change => 1) |
|
|
500 | unless $self->{parent}{visible}; |
|
|
501 | } |
493 | |
502 | |
494 | # TODO: req_w _does_change after ->reconfigure |
503 | # TODO: req_w _does_change after ->reconfigure |
495 | $self->check_size |
504 | $self->check_size |
496 | unless exists $self->{req_w}; |
505 | unless exists $self->{req_w}; |
497 | |
506 | |
… | |
… | |
527 | sub emit { |
536 | sub emit { |
528 | my ($self, $signal, @args) = @_; |
537 | my ($self, $signal, @args) = @_; |
529 | |
538 | |
530 | $self->_emit ($signal, @args) |
539 | $self->_emit ($signal, @args) |
531 | || $self->$signal (@args); |
540 | || $self->$signal (@args); |
|
|
541 | } |
|
|
542 | |
|
|
543 | sub visibility_change { |
|
|
544 | #my ($self, $visible) = @_; |
532 | } |
545 | } |
533 | |
546 | |
534 | sub DESTROY { |
547 | sub DESTROY { |
535 | my ($self) = @_; |
548 | my ($self) = @_; |
536 | |
549 | |
… | |
… | |
3032 | if exists $child->{req_x}; |
3045 | if exists $child->{req_x}; |
3033 | |
3046 | |
3034 | $Y = $child->{req_y} > 0 ? $child->{req_y} : $h - $H - $child->{req_y} + 1 |
3047 | $Y = $child->{req_y} > 0 ? $child->{req_y} : $h - $H - $child->{req_y} + 1 |
3035 | if exists $child->{req_y}; |
3048 | if exists $child->{req_y}; |
3036 | |
3049 | |
|
|
3050 | $X = $self->{user_x} if exists $self->{user_x}; |
|
|
3051 | $Y = $self->{user_y} if exists $self->{user_y}; |
|
|
3052 | |
3037 | $X = List::Util::max 0, List::Util::min $w - $W, int $X + 0.5; |
3053 | $X = List::Util::max 0, List::Util::min $w - $W, int $X + 0.5; |
3038 | $Y = List::Util::max 0, List::Util::min $h - $H, int $Y + 0.5; |
3054 | $Y = List::Util::max 0, List::Util::min $h - $H, int $Y + 0.5; |
3039 | |
3055 | |
3040 | $child->configure ($X, $Y, $W, $H); |
3056 | $child->configure ($X, $Y, $W, $H); |
3041 | } |
3057 | } |