… | |
… | |
22 | our $TOOLTIP_WATCHER = Event->idle (min => 1/60, cb => sub { |
22 | our $TOOLTIP_WATCHER = Event->idle (min => 1/60, cb => sub { |
23 | if (!$GRAB) { |
23 | if (!$GRAB) { |
24 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
24 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
25 | if (length $widget->{tooltip}) { |
25 | if (length $widget->{tooltip}) { |
26 | if ($TOOLTIP->{owner} != $widget) { |
26 | if ($TOOLTIP->{owner} != $widget) { |
|
|
27 | $TOOLTIP->{owner}->emit ("tooltip_hide") if $TOOLTIP->{owner}; |
27 | $TOOLTIP->hide; |
28 | $TOOLTIP->hide; |
28 | |
29 | |
29 | $TOOLTIP->{owner} = $widget; |
30 | $TOOLTIP->{owner} = $widget; |
|
|
31 | $TOOLTIP->{owner}->emit ("tooltip_show") if $TOOLTIP->{owner}; |
30 | |
32 | |
31 | return if $ENV{CFPLUS_DEBUG} & 8; |
33 | return if $ENV{CFPLUS_DEBUG} & 8; |
32 | |
34 | |
33 | my $tip = $widget->{tooltip}; |
35 | my $tip = $widget->{tooltip}; |
34 | |
36 | |
… | |
… | |
42 | } |
44 | } |
43 | } |
45 | } |
44 | } |
46 | } |
45 | |
47 | |
46 | $TOOLTIP->hide; |
48 | $TOOLTIP->hide; |
|
|
49 | $TOOLTIP->{owner}->emit ("tooltip_hide") if $TOOLTIP->{owner}; |
47 | delete $TOOLTIP->{owner}; |
50 | delete $TOOLTIP->{owner}; |
48 | }); |
51 | }); |
49 | |
52 | |
50 | sub get_layout { |
53 | sub get_layout { |
51 | my $layout; |
54 | my $layout; |
… | |
… | |
2830 | #font => default_font |
2833 | #font => default_font |
2831 | @_, |
2834 | @_, |
2832 | |
2835 | |
2833 | layout => (new CFPlus::Layout), |
2836 | layout => (new CFPlus::Layout), |
2834 | par => [], |
2837 | par => [], |
|
|
2838 | max_par => 0, |
2835 | height => 0, |
2839 | height => 0, |
2836 | children => [ |
2840 | children => [ |
2837 | (new CFPlus::UI::Empty expand => 1), |
2841 | (new CFPlus::UI::Empty expand => 1), |
2838 | (new CFPlus::UI::Slider vertical => 1), |
2842 | (new CFPlus::UI::Slider vertical => 1), |
2839 | ], |
2843 | ], |
… | |
… | |
2962 | wrapped => 1, |
2966 | wrapped => 1, |
2963 | }; |
2967 | }; |
2964 | |
2968 | |
2965 | $self->add (@{ $para->{widget} }) if @{ $para->{widget} }; |
2969 | $self->add (@{ $para->{widget} }) if @{ $para->{widget} }; |
2966 | push @{$self->{par}}, $para; |
2970 | push @{$self->{par}}, $para; |
|
|
2971 | } |
|
|
2972 | |
|
|
2973 | if (my $max = $self->{max_par}) { |
|
|
2974 | shift @{$self->{par}} while @{$self->{par}} > $max; |
2967 | } |
2975 | } |
2968 | |
2976 | |
2969 | $self->{need_reflow}++; |
2977 | $self->{need_reflow}++; |
2970 | $self->update; |
2978 | $self->update; |
2971 | } |
2979 | } |