… | |
… | |
40 | if (!$GRAB) { |
40 | if (!$GRAB) { |
41 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
41 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
42 | if (length $widget->{tooltip}) { |
42 | if (length $widget->{tooltip}) { |
43 | |
43 | |
44 | if ($TOOLTIP->{owner} != $widget) { |
44 | if ($TOOLTIP->{owner} != $widget) { |
|
|
45 | $TOOLTIP->hide; |
|
|
46 | |
45 | $TOOLTIP->{owner} = $widget; |
47 | $TOOLTIP->{owner} = $widget; |
46 | |
48 | |
47 | my $tip = $widget->{tooltip}; |
49 | my $tip = $widget->{tooltip}; |
48 | |
50 | |
49 | $tip = $tip->($widget) if CODE:: eq ref $tip; |
51 | $tip = $tip->($widget) if CODE:: eq ref $tip; |
50 | |
52 | |
51 | $TOOLTIP->set_tooltip_from ($widget); |
53 | $TOOLTIP->set_tooltip_from ($widget); |
52 | |
|
|
53 | my ($x, $y) = $widget->coord2global ($widget->{w}, 0); |
|
|
54 | |
|
|
55 | ($x, $y) = $widget->coord2global (-$TOOLTIP->{w}, 0) |
|
|
56 | if $x + $TOOLTIP->{w} > $::WIDTH; |
|
|
57 | |
|
|
58 | $TOOLTIP->move ($x, $y); |
|
|
59 | $TOOLTIP->show; |
54 | $TOOLTIP->show; |
60 | } |
55 | } |
61 | |
56 | |
62 | return; |
57 | return; |
63 | } |
58 | } |
… | |
… | |
2639 | my ($self, $w, $h, $changed) = @_; |
2634 | my ($self, $w, $h, $changed) = @_; |
2640 | |
2635 | |
2641 | return unless $changed; |
2636 | return unless $changed; |
2642 | |
2637 | |
2643 | $self->SUPER::size_allocate ($w - 4, $h - 4, $changed); |
2638 | $self->SUPER::size_allocate ($w - 4, $h - 4, $changed); |
|
|
2639 | } |
|
|
2640 | |
|
|
2641 | sub visibility_change { |
|
|
2642 | my ($self, $visible) = @_; |
|
|
2643 | |
|
|
2644 | return unless $visible; |
|
|
2645 | |
|
|
2646 | $self->{root}->on_post_alloc ("move_$self" => sub { |
|
|
2647 | my $widget = $self->{owner}; |
|
|
2648 | |
|
|
2649 | my ($x, $y) = $widget->coord2global ($widget->{w}, 0); |
|
|
2650 | |
|
|
2651 | ($x, $y) = $widget->coord2global (-$self->{w}, 0) |
|
|
2652 | if $x + $self->{w} > $::WIDTH; |
|
|
2653 | |
|
|
2654 | $self->move ($x, $y); |
|
|
2655 | }); |
2644 | } |
2656 | } |
2645 | |
2657 | |
2646 | sub _draw { |
2658 | sub _draw { |
2647 | my ($self) = @_; |
2659 | my ($self) = @_; |
2648 | |
2660 | |