ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/item-worldmap.ext
(Generate patch)

Comparing deliantra/server/ext/item-worldmap.ext (file contents):
Revision 1.1 by root, Sat Jul 21 18:01:26 2007 UTC vs.
Revision 1.3 by root, Sun Jul 22 14:17:58 2007 UTC

7 my $info = { }; 7 my $info = { };
8 8
9 $info->{ws} = my $ws = $ns->new_widgetset; 9 $info->{ws} = my $ws = $ns->new_widgetset;
10 10
11 $info->{toplevel} = my $w = $ws->new (Toplevel => 11 $info->{toplevel} = my $w = $ws->new (Toplevel =>
12 title => "Worldmap",
13 name => "server_item_worldmap",
12 force_w => 400, 14 force_w => 400,
13 force_h => 400, 15 force_h => 400,
14 x => "center", 16 x => "center",
15 y => "center", 17 y => "center",
16 title => "Worldmap",
17 has_close_button => 1, 18 has_close_button => 1,
18 on_delete => sub { shift->hide }, 19 on_delete => sub { shift->hide },
19 ); 20 );
20 21
21 my $face = cf::face::find "res/worldmap.jpg"; 22 my $face = cf::face::find "res/worldmap.jpg";
22 $ns->send_face ($face); 23 $ns->send_face ($face);
24 $ns->flush_fx;
23 25
24 $w->add (my $sw = $ws->new (ScrolledWindow => scroll_x => 1, scroll_y => 1)); 26 $w->add (my $sw = $ws->new (ScrolledWindow => scroll_x => 1, scroll_y => 1));
25 $sw->add (my $fixed = $ws->new (Fixed => expand => 1)); 27 $sw->add (my $canvas = $ws->new (Canvas => expand => 1));
26 $fixed->add ($ws->new (Face => expand => 1, size_w => undef, size_h => undef, face => $face), abs => 0, 0, rel => 1, 1); 28 $canvas->add_fixed ($ws->new (Face => expand => 1, size_w => undef, size_h => undef, face => $face), abs => 0, 0, rel => 1, 1);
27 $fixed->add ($ws->new (Label => text => "lb1"), abs => 10, 10, rel => 1, 1); 29 $canvas->add_fixed ($ws->new (Label => text => "lb1"), abs => 10, 10, rel => 1, 1);
28 30
29 $info 31 $info
30} 32}
31 33
32# this module implements a rather fancy worldmap 34# this module implements a rather fancy worldmap
34cf::object::attachment item_worldmap => 36cf::object::attachment item_worldmap =>
35 on_apply => sub { 37 on_apply => sub {
36 my ($self, $who) = @_; 38 my ($self, $who) = @_;
37 39
38 my $ns = $who->contr->ns; 40 my $ns = $who->contr->ns;
39 my $ws = $ns->{ws_worldmap} ||= create_widgets $ns;
40 41
42 if ($ns->{can_widget}) {
43 my $ws = $ns->{ws_worldmap} ||= create_widgets $ns;
41 $ws->{toplevel}->show; 44 $ws->{toplevel}->show;
42 warn "worldmap apply\n"; 45 } else {
46 $ns->send_msg ("log", "Your client doesn't support the (required) widget extension. Try CFPlus at http://crossfire.schmorp.de/.", cf::NDI_RED);
47 }
43 48
44 cf::override 1; 49 cf::override 1;
45 }, 50 },
46; 51;
47 52

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines