ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.195 by root, Thu May 11 23:54:31 2006 UTC vs.
Revision 1.196 by root, Fri May 12 00:16:34 2006 UTC

24 24
25 my $tip = $widget->{tooltip}; 25 my $tip = $widget->{tooltip};
26 26
27 $tip = $tip->($widget) if CODE:: eq ref $tip; 27 $tip = $tip->($widget) if CODE:: eq ref $tip;
28 28
29 $TOOLTIP->set_markup ($widget->{tooltip}, $widget->{tooltip_font}); 29 $TOOLTIP->set_tooltip_from ($widget);
30
31 $TOOLTIP->show; 30 $TOOLTIP->show;
32 31
33 my ($x, $y) = $widget->coord2global ($widget->{w}, 0); 32 my ($x, $y) = $widget->coord2global ($widget->{w}, 0);
34 33
35 if ($x + $TOOLTIP->{w} > $::WIDTH) { 34 if ($x + $TOOLTIP->{w} > $::WIDTH) {
2367 @_, 2366 @_,
2368 can_events => 0, 2367 can_events => 0,
2369 ) 2368 )
2370} 2369}
2371 2370
2372sub set_markup { 2371sub set_tooltip_from {
2373 my ($self, $text, $font) = @_; 2372 my ($self, $widget) = @_;
2374 2373
2375 $self->{label} = new CFClient::UI::Label 2374 $self->{label} = new CFClient::UI::Label
2375 markup => $widget->{tooltip},
2376 max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH,
2376 fontsize => 0.8, 2377 fontsize => 0.8,
2377 fg => [0, 0, 0], 2378 fg => [0, 0, 0, 1],
2378 font => ($font || $::FONT_PROP); 2379 font => ($widget->{tooltip_font} || $::FONT_PROP);
2379 2380
2380 $self->{label}->set_max_size ($::WIDTH * 0.3);
2381 $self->{label}->set_markup ($text);
2382 $self->add ($self->{label}); 2381 $self->add ($self->{label});
2383} 2382}
2384 2383
2385sub size_request { 2384sub size_request {
2386 my ($self) = @_; 2385 my ($self) = @_;
2673 my $len = int 30 / $item->{fontsize}; 2672 my $len = int 30 / $item->{fontsize};
2674 substr $_, $len, length, "…" if $len < length; 2673 substr $_, $len, length, "…" if $len < length;
2675 } 2674 }
2676 2675
2677 new CFClient::UI::Label 2676 new CFClient::UI::Label
2678 markup => $short, 2677 markup => $short,
2679 tooltip => delete $item->{tooltip}, 2678 tooltip => delete $item->{tooltip},
2679 tooltip_font => $::FONT_PROP,
2680 tooltip_width => 0.75,
2680 fontsize => delete $item->{fontsize}, 2681 fontsize => delete $item->{fontsize},
2681 color => delete $item->{color}, 2682 color => delete $item->{color},
2682 can_events => 1, 2683 can_events => 1,
2683 can_hover => 1, 2684 can_hover => 1,
2684 }; 2685 };
2685 } 2686 }
2686 2687
2687 $self->clear; 2688 $self->clear;
2688 $self->SUPER::add (@widgets); 2689 $self->SUPER::add (@widgets);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines