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.2 by root, Sat Jul 21 19:04:44 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);
23 24
24 $w->add (my $sw = $ws->new (ScrolledWindow => scroll_x => 1, scroll_y => 1)); 25 $w->add (my $sw = $ws->new (ScrolledWindow => scroll_x => 1, scroll_y => 1));
25 $sw->add (my $fixed = $ws->new (Fixed => expand => 1)); 26 $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); 27 $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); 28 $canvas->add_fixed ($ws->new (Label => text => "lb1"), abs => 10, 10, rel => 1, 1);
28 29
29 $info 30 $info
30} 31}
31 32
32# this module implements a rather fancy worldmap 33# this module implements a rather fancy worldmap
34cf::object::attachment item_worldmap => 35cf::object::attachment item_worldmap =>
35 on_apply => sub { 36 on_apply => sub {
36 my ($self, $who) = @_; 37 my ($self, $who) = @_;
37 38
38 my $ns = $who->contr->ns; 39 my $ns = $who->contr->ns;
39 my $ws = $ns->{ws_worldmap} ||= create_widgets $ns;
40 40
41 if ($ns->{can_widget}) {
42 my $ws = $ns->{ws_worldmap} ||= create_widgets $ns;
41 $ws->{toplevel}->show; 43 $ws->{toplevel}->show;
42 warn "worldmap apply\n"; 44 } else {
45 $ns->send_msg ("log", "Your client doesn't support the (required) widget extension. Try CFPlus at http://crossfire.schmorp.de/.", cf::NDI_RED);
46 }
43 47
44 cf::override 1; 48 cf::override 1;
45 }, 49 },
46; 50;
47 51

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines