ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/item-worldmap.ext
Revision: 1.1
Committed: Sat Jul 21 18:01:26 2007 UTC (16 years, 10 months ago) by root
Branch: MAIN
Log Message:
implement simplistic/slow/safe object merging for objects with perl data, start of a worldmap item

File Contents

# User Rev Content
1 root 1.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     force_w => 400,
13     force_h => 400,
14     x => "center",
15     y => "center",
16     title => "Worldmap",
17     has_close_button => 1,
18     on_delete => sub { shift->hide },
19     );
20    
21     my $face = cf::face::find "res/worldmap.jpg";
22     $ns->send_face ($face);
23    
24     $w->add (my $sw = $ws->new (ScrolledWindow => scroll_x => 1, scroll_y => 1));
25     $sw->add (my $fixed = $ws->new (Fixed => 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     $fixed->add ($ws->new (Label => text => "lb1"), abs => 10, 10, rel => 1, 1);
28    
29     $info
30     }
31    
32     # this module implements a rather fancy worldmap
33    
34     cf::object::attachment item_worldmap =>
35     on_apply => sub {
36     my ($self, $who) = @_;
37    
38     my $ns = $who->contr->ns;
39     my $ws = $ns->{ws_worldmap} ||= create_widgets $ns;
40    
41     $ws->{toplevel}->show;
42     warn "worldmap apply\n";
43    
44     cf::override 1;
45     },
46     ;
47