--- deliantra/Deliantra-Client/DC/UI.pm 2006/05/25 16:24:44 1.234 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/05/25 16:35:42 1.235 @@ -2711,92 +2711,6 @@ ############################################################################# -package CFClient::UI::InventoryItem; - -our @ISA = CFClient::UI::HBox::; - -sub new { - my $class = shift; - - my %args = @_; - - my $item = delete $args{item}; - - my $desc = CFClient::Item::desc_string $item; - - my $self = $class->SUPER::new ( - can_hover => 1, - can_events => 1, - tooltip => ((CFClient::UI::Label::escape $desc) - . "\nleftclick - examine\nshift+leftclick - move/pickup/drop\nmiddle click - apply\nrightclick - menu"), - connect_button_down => sub { - my ($self, $ev, $x, $y) = @_; - - # todo: maybe put examine on 1? but should just be a tooltip :( - if (($ev->{mod} & CFClient::KMOD_SHIFT) && $ev->{button} == 1) { - my $targ = $::CONN->{player}{tag}; - - if ($item->{container} == $::CONN->{player}{tag}) { - $targ = $main::OPENCONT; - } - - $::CONN->send ("move $targ $item->{tag} 0"); - } elsif ($ev->{button} == 1) { - $::CONN->send ("examine $item->{tag}"); - } elsif ($ev->{button} == 2) { - $::CONN->send ("apply $item->{tag}"); - } elsif ($ev->{button} == 3) { - my @menu_items = ( - ["examine", sub { $::CONN->send ("examine $item->{tag}") }], - ["mark", sub { $::CONN->send ("mark ". pack "N", $item->{tag}) }], - ["apply", sub { $::CONN->send ("apply $item->{tag}") }], - ( - $item->{flags} & Crossfire::Protocol::F_LOCKED - ? ( - ["unlock", sub { $::CONN->send ("lock " . pack "CN", 0, $item->{tag}) }], - ) - : ( - ["lock", sub { $::CONN->send ("lock " . pack "CN", 1, $item->{tag}) }], - ["drop", sub { $::CONN->send ("move $main::OPENCONT $item->{tag} 0") }], - ) - ), - ); - - CFClient::UI::Menu->new (items => \@menu_items)->popup ($ev); - } - - 1 - }, - %args - ); - - - $self->add (new CFClient::UI::Face - can_events => 0, - face => $item->{face}, - anim => $item->{anim}, - animspeed => $item->{animspeed}, - ); - - $self->add ($self->{name_lbl} = new CFClient::UI::Label can_events => 0); - - $self->{item} = $item; - - $self->update_item; - - $self -} - -sub update_item { - my ($self) = @_; - - my $desc = CFClient::Item::desc_string ($self->{item}); - - $self->{name_lbl}->set_text ($desc); -} - -############################################################################# - package CFClient::UI::Inventory; our @ISA = CFClient::UI::ScrolledWindow::;