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

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.10 by root, Mon Apr 24 03:19:42 2006 UTC vs.
Revision 1.11 by root, Mon Apr 24 03:33:51 2006 UTC

236 $self->{command_widget} ||= 236 $self->{command_widget} ||=
237 new CFClient::MapWidget::Command:: 237 new CFClient::MapWidget::Command::
238 command => $self->{command}, 238 command => $self->{command},
239 can_focus => 1, 239 can_focus => 1,
240 connect_execute => sub { 240 connect_execute => sub {
241 # todo: support callback instead of user_send
241 $::CONN->user_send ($_[1]); 242 $::CONN->user_send ($_[1][1]);
242 }, 243 },
243 connect_close => sub { 244 connect_close => sub {
244 (delete $self->{command_widget})->hide; 245 (delete $self->{command_widget})->hide;
245 $self->focus_in; 246 $self->focus_in;
246 }, 247 },
264 $::CONN->user_send ("run_stop"); 265 $::CONN->user_send ("run_stop");
265 } 266 }
266} 267}
267 268
268sub add_command { 269sub add_command {
269 my ($self, $command, $widget, $cb) = @_; 270 my ($self, $command, $tooltip, $widget, $cb) = @_;
270 271
271 (my $abbrev = $command) =~ s/(\S)[^[:space:]_]*[[:space:]_]+/$1/g; 272 (my $abbrev = $command) =~ s/(\S)[^[:space:]_]*[[:space:]_]+/$1/g;
272 273
273 push @{$self->{command}}, [$abbrev, $command]; 274 push @{$self->{command}}, [$abbrev, $command, $tooltip, $widget, $cb];
274 #warn "$command|$abbrev|$widget\n";#d#
275} 275}
276 276
277package CFClient::MapWidget::Command; 277package CFClient::MapWidget::Command;
278 278
279use strict; 279use strict;
287 287
288 my $self = $class->SUPER::new ( 288 my $self = $class->SUPER::new (
289 @_, 289 @_,
290 children => [map 290 children => [map
291 CFClient::UI::Label->new ( 291 CFClient::UI::Label->new (
292 can_hover => 1, 292 can_hover => 1,
293 can_events => 1,
293 fontsize => $_, 294 fontsize => $_,
294 ), 1, 1, 0.8, 0.8, 0.8, 0.8, 0.8 295 ), 1, 1, 0.8, 0.8, 0.8, 0.8, 0.8
295 ], 296 ],
296 ); 297 );
297 298
298 $self 299 $self
326 327
327 $self->{children}[0]->set_text ("$self->{search}_"); 328 $self->{children}[0]->set_text ("$self->{search}_");
328 329
329 for (0..5) { 330 for (0..5) {
330 $self->{children}[$_ + 1]->set_text ($found[$_] ? "$found[$_][0] ($found[$_][1][1])" : ""); 331 $self->{children}[$_ + 1]->set_text ($found[$_] ? "$found[$_][0] ($found[$_][1][1])" : "");
332 $self->{children}[$_ + 1]{tooltip} = ($found[$_] ? $found[$_][1][2] : "");
331 } 333 }
332 334
333 $self->{select} = $found[0][1][1] 335 $self->{select} = $found[0][1]
334 if @found; 336 if @found;
335 337
336 if (@found > 6) { 338 if (@found > 6) {
337 $self->{children}[6]->set_text ("..."); 339 $self->{children}[6]->set_text ("...");
338 } 340 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines