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.62 by root, Thu Jun 15 16:44:20 2006 UTC vs.
Revision 1.63 by root, Sun Jun 18 17:13:11 2006 UTC

62 my ($self) = @_; 62 my ($self) = @_;
63 63
64 %{$self->{completer}{command}} = (); 64 %{$self->{completer}{command}} = ();
65} 65}
66 66
67sub button_down { 67sub invoke_button_down {
68 my ($self, $ev, $x, $y) = @_; 68 my ($self, $ev, $x, $y) = @_;
69 69
70 return unless $::CONN; 70 return unless $::CONN;
71 71
72 $self->focus_in; 72 $self->grab_focus;
73 73
74 if ($ev->{button} == 1) { 74 if ($ev->{button} == 1) {
75 my $x = CFClient::floor +($ev->{x} - $self->{sx0}) / $self->{tilesize} - $self->{sx}; 75 my $x = CFClient::floor +($ev->{x} - $self->{sx0}) / $self->{tilesize} - $self->{sx};
76 my $y = CFClient::floor +($ev->{y} - $self->{sy0}) / $self->{tilesize} - $self->{sy}; 76 my $y = CFClient::floor +($ev->{y} - $self->{sy0}) / $self->{tilesize} - $self->{sy};
77 77
98 } 98 }
99 99
100 1 100 1
101} 101}
102 102
103sub button_up { 103sub invoke_button_up {
104 my ($self, $ev, $x, $y) = @_; 104 my ($self, $ev, $x, $y) = @_;
105 105
106 delete $self->{motion}; 106 delete $self->{motion};
107 107
108 1 108 1
109} 109}
110 110
111sub mouse_motion { 111sub invoke_mouse_motion {
112 my ($self, $ev, $x, $y) = @_; 112 my ($self, $ev, $x, $y) = @_;
113 113
114 if ($self->{motion}) { 114 if ($self->{motion}) {
115 $self->{motion}->($ev, $x, $y); 115 $self->{motion}->($ev, $x, $y);
116 } else { 116 } else {
148 CFClient::SDLK_RIGHT, [3, "east"], 148 CFClient::SDLK_RIGHT, [3, "east"],
149 CFClient::SDLK_DOWN, [5, "south"], 149 CFClient::SDLK_DOWN, [5, "south"],
150 CFClient::SDLK_LEFT, [7, "west"], 150 CFClient::SDLK_LEFT, [7, "west"],
151); 151);
152 152
153sub key_down { 153sub invoke_key_down {
154 my ($self, $ev) = @_; 154 my ($self, $ev) = @_;
155 155
156 return 0 unless $::CONN; 156 return 0 unless $::CONN;
157 157
158 my $mod = $ev->{mod}; 158 my $mod = $ev->{mod};
215 } 215 }
216 216
217 1 217 1
218} 218}
219 219
220sub key_up { 220sub invoke_key_up {
221 my ($self, $ev) = @_; 221 my ($self, $ev) = @_;
222 222
223 my $res = 0; 223 my $res = 0;
224 my $mod = $ev->{mod}; 224 my $mod = $ev->{mod};
225 my $sym = $ev->{sym}; 225 my $sym = $ev->{sym};
380 380
381sub size_request { 381sub size_request {
382 ($::HEIGHT * 0.25, $::HEIGHT * 0.25) 382 ($::HEIGHT * 0.25, $::HEIGHT * 0.25)
383} 383}
384 384
385sub size_allocate { 385sub invoke_size_allocate {
386 my ($self, $w, $h) = @_; 386 my ($self, $w, $h) = @_;
387 387
388 $self->SUPER::size_allocate ($w, $h);
389 $self->update; 388 $self->update;
389
390 1
390} 391}
391 392
392sub update { 393sub update {
393 my ($self) = @_; 394 my ($self) = @_;
394 395
479 ]; 480 ];
480 481
481 $self->{entry} = new CFClient::UI::Entry 482 $self->{entry} = new CFClient::UI::Entry
482 on_changed => sub { 483 on_changed => sub {
483 $self->update_labels; 484 $self->update_labels;
485 0
484 }, 486 },
485 on_button_down => sub { 487 on_button_down => sub {
486 my ($entry, $ev, $x, $y) = @_; 488 my ($entry, $ev, $x, $y) = @_;
487 489
488 if ($ev->{button} == 3) { 490 if ($ev->{button} == 3) {
489 (new CFClient::UI::Menu 491 (new CFClient::UI::Menu
490 items => [ 492 items => [
491 ["bind to a key" => sub { $::BIND_EDITOR->do_quick_binding ([$self->{select}], sub { $entry->focus_in }) }] 493 ["bind to a key" => sub { $::BIND_EDITOR->do_quick_binding ([$self->{select}], sub { $entry->grab_focus }) }]
492 ], 494 ],
493 )->popup ($ev); 495 )->popup ($ev);
494 return 1; 496 return 1;
495 } 497 }
496 0 498 0
561 563
562 $self->{entry}->set_text ($prefix); 564 $self->{entry}->set_text ($prefix);
563 $self->show; 565 $self->show;
564} 566}
565 567
566sub size_allocate { 568sub invoke_size_allocate {
567 my ($self, $w, $h) = @_; 569 my ($self, $w, $h) = @_;
568 570
569 $self->SUPER::size_allocate ($w, $h);
570 $self->move_abs (($::WIDTH - $w) * 0.5, ($::HEIGHT - $h) * 0.6, 10); 571 $self->move_abs (($::WIDTH - $w) * 0.5, ($::HEIGHT - $h) * 0.6, 10);
572
573 $self->SUPER::invoke_size_allocate ($w, $h)
571} 574}
572 575
573sub show { 576sub show {
574 my ($self) = @_; 577 my ($self) = @_;
575 578
576 $self->SUPER::show; 579 $self->SUPER::show;
577 $self->{entry}->focus_in; 580 $self->{entry}->grab_focus;
578} 581}
579 582
580sub hide { 583sub hide {
581 my ($self) = @_; 584 my ($self) = @_;
582 585
583 $self->SUPER::hide; 586 $self->SUPER::hide;
584 $self->{entry}->set_text (""); 587 $self->{entry}->set_text ("");
585} 588}
586 589
587sub key_down { 590sub invoke_key_down {
588 my ($self, $ev) = @_; 591 my ($self, $ev) = @_;
589 592
590 $self->{entry}->key_down ($ev) 593 $self->{entry}->key_down ($ev)
591} 594}
592 595

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines