ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/gde/GCE/Util.pm
(Generate patch)

Comparing deliantra/gde/GCE/Util.pm (file contents):
Revision 1.3 by elmex, Sun Mar 12 12:18:55 2006 UTC vs.
Revision 1.4 by elmex, Sun Mar 12 23:32:58 2006 UTC

16use List::Util qw(min max); 16use List::Util qw(min max);
17 17
18use Crossfire; 18use Crossfire;
19use Crossfire::MapWidget; 19use Crossfire::MapWidget;
20 20
21our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall stack_find arch_is_wall arch_is_monster); 21our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall stack_find arch_is_wall arch_is_monster add_table_widget);
22 22
23sub new_arch_pb { 23sub new_arch_pb {
24 # this is awful, is this really the best way? 24 # this is awful, is this really the best way?
25 my $pb = new Gtk2::Gdk::Pixbuf 'rgb', 1, 8, TILESIZE, TILESIZE; 25 my $pb = new Gtk2::Gdk::Pixbuf 'rgb', 1, 8, TILESIZE, TILESIZE;
26 return $pb; 26 return $pb;
162 } 162 }
163 163
164 return \@outstack; 164 return \@outstack;
165} 165}
166 166
167sub add_table_widget {
168 my ($table, $row, $data, $type, $cb) = @_;
169 my $edwid;
170
171 if ($type eq 'string') {
172 $table->attach_defaults (my $lbl = Gtk2::Label->new ($data->[0]), 0, 1, $row, $row + 1);
173 $edwid = Gtk2::Entry->new;
174 $edwid->set_text ($data->[1]);
175 $edwid->signal_connect (changed => sub {
176 $data->[1] = $_[0]->get_text;
177 $cb->($data->[1]) if $cb;
178 });
179 $table->attach_defaults ($edwid, 1, 2, $row, $row + 1);
180
181 } elsif ($type eq 'button') {
182 $table->attach_defaults (my $b = Gtk2::Button->new_with_label ($data), 0, 2, $row, $row + 1);
183 $b->signal_connect (clicked => ($cb || sub {}));
184
185 } elsif ($type eq 'label') {
186 $table->attach_defaults (my $lbl = Gtk2::Label->new ($data->[0]), 0, 1, $row, $row + 1);
187 $edwid = Gtk2::Label->new ($data->[1]);
188 $table->attach_defaults ($edwid, 1, 2, $row, $row + 1);
189
190 } else {
191 $edwid = Gtk2::Label->new ("FOO");
192 }
193}
194
167sub replace_arch_stack_layer { 195sub replace_arch_stack_layer {
168 my ($stack, $arch) = @_; 196 my ($stack, $arch) = @_;
169 197
170 my @outstack; 198 my @outstack;
171 199

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines