ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/item-worldmap.ext
Revision: 1.2
Committed: Sat Jul 21 19:04:44 2007 UTC (16 years, 10 months ago) by root
Branch: MAIN
Changes since 1.1: +11 -7 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #! perl # depends=widget
2 #! perl
3
4 sub create_widgets {
5 my ($ns) = @_;
6
7 my $info = { };
8
9 $info->{ws} = my $ws = $ns->new_widgetset;
10
11 $info->{toplevel} = my $w = $ws->new (Toplevel =>
12 title => "Worldmap",
13 name => "server_item_worldmap",
14 force_w => 400,
15 force_h => 400,
16 x => "center",
17 y => "center",
18 has_close_button => 1,
19 on_delete => sub { shift->hide },
20 );
21
22 my $face = cf::face::find "res/worldmap.jpg";
23 $ns->send_face ($face);
24
25 $w->add (my $sw = $ws->new (ScrolledWindow => scroll_x => 1, scroll_y => 1));
26 $sw->add (my $canvas = $ws->new (Canvas => expand => 1));
27 $canvas->add_fixed ($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 (Label => text => "lb1"), abs => 10, 10, rel => 1, 1);
29
30 $info
31 }
32
33 # this module implements a rather fancy worldmap
34
35 cf::object::attachment item_worldmap =>
36 on_apply => sub {
37 my ($self, $who) = @_;
38
39 my $ns = $who->contr->ns;
40
41 if ($ns->{can_widget}) {
42 my $ws = $ns->{ws_worldmap} ||= create_widgets $ns;
43 $ws->{toplevel}->show;
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 }
47
48 cf::override 1;
49 },
50 ;
51