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.223 by elmex, Tue May 23 18:10:51 2006 UTC vs.
Revision 1.224 by elmex, Tue May 23 20:00:55 2006 UTC

2628 2628
2629 my $self = $class->SUPER::new ( 2629 my $self = $class->SUPER::new (
2630 can_hover => 1, 2630 can_hover => 1,
2631 can_events => 1, 2631 can_events => 1,
2632 tooltip => ((CFClient::UI::Label::escape $desc) 2632 tooltip => ((CFClient::UI::Label::escape $desc)
2633 . "\n<small>leftclick - pick up\nmiddle click - apply\nrightclick - menu</small>"), 2633 . "\n<small>leftclick - examine\nshift+leftclick - move/pickup/drop\nmiddle click - apply\nrightclick - menu</small>"),
2634 connect_button_down => sub { 2634 connect_button_down => sub {
2635 my ($self, $ev, $x, $y) = @_; 2635 my ($self, $ev, $x, $y) = @_;
2636 2636
2637 # todo: maybe put examine on 1? but should just be a tooltip :( 2637 # todo: maybe put examine on 1? but should just be a tooltip :(
2638 if ($ev->{button} == 1) { 2638 if (($ev->{mod} & CFClient::KMOD_SHIFT) && $ev->{button} == 1) {
2639 my $targ = $::CONN->{player}{tag}; 2639 my $targ = $::CONN->{player}{tag};
2640 2640
2641 if ($item->{container} == $::CONN->{player}{tag}) { 2641 if ($item->{container} == $::CONN->{player}{tag}) {
2642 $targ = $main::OPENCONT; 2642 $targ = $main::OPENCONT;
2643 } 2643 }
2644 2644
2645 $::CONN->send ("move $targ $item->{tag} 0"); 2645 $::CONN->send ("move $targ $item->{tag} 0");
2646 } elsif ($ev->{button} == 1) {
2647 $::CONN->send ("examine $item->{tag}");
2646 } elsif ($ev->{button} == 2) { 2648 } elsif ($ev->{button} == 2) {
2647 $::CONN->send ("apply $item->{tag}"); 2649 $::CONN->send ("apply $item->{tag}");
2648 } elsif ($ev->{button} == 3) { 2650 } elsif ($ev->{button} == 3) {
2649 my @menu_items = ( 2651 my @menu_items = (
2650 ["examine", sub { $::CONN->send ("examine $item->{tag}") }], 2652 ["examine", sub { $::CONN->send ("examine $item->{tag}") }],
2703 2705
2704sub new { 2706sub new {
2705 my $class = shift; 2707 my $class = shift;
2706 2708
2707 my $self = $class->SUPER::new ( 2709 my $self = $class->SUPER::new (
2708 scrolled => (new CFClient::UI::VBox), 2710 scrolled => (new CFClient::UI::Table),
2709 @_, 2711 @_,
2710 ); 2712 );
2711 2713
2712 $self 2714 $self
2713} 2715}
2724 } @$items; 2726 } @$items;
2725 2727
2726 $self->{real_items} = \@items; 2728 $self->{real_items} = \@items;
2727 2729
2728 for my $item (@items) { 2730 for my $item (@items) {
2731 $item->{item} = $item;
2729 $item = $item->{widget} ||= new CFClient::UI::InventoryItem item => $item; 2732 $item = $item->{widget} ||= new CFClient::UI::InventoryItem item => $item;
2730 $item->update_item (); 2733 $item->update_item ();
2731 } 2734 }
2732 2735
2736 my $i = 0;
2737 for (@items) {
2733 $self->{scrolled}->add (@items); 2738 $self->{scrolled}->add (0, $i, $_);
2739 my $nrof = $_->{item}->{nrof} || 1;
2740 $self->{scrolled}->add (1, $i++, new CFClient::UI::Label text => ($_->{item}->{weight} * $nrof) / 1000);
2741 }
2734 2742
2735# $range->{range} = [$self->{pos}, 0, $self->{max_pos}, $page]; 2743# $range->{range} = [$self->{pos}, 0, $self->{max_pos}, $page];
2736} 2744}
2737 2745
2738sub size_request { 2746sub size_request {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines