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

Comparing deliantra/server/ext/widget.ext (file contents):
Revision 1.11 by root, Sat Jul 21 18:01:26 2007 UTC vs.
Revision 1.12 by root, Sun Jul 22 20:08:38 2007 UTC

125 my $id = ++$self->{id}; 125 my $id = ++$self->{id};
126 126
127 my $ws = bless { 127 my $ws = bless {
128 id => $id, 128 id => $id,
129 ns => $self, 129 ns => $self,
130 w => {}, 130 _w => {},
131 }, "ext::widget::set"; 131 }, "ext::widget::set";
132 132
133 $ws->msg (ws_n => id => $id); 133 $ws->msg (ws_n => id => $id);
134 134
135 $ws 135 $ws
164sub new { 164sub new {
165 my ($self, $class, %args) = @_; 165 my ($self, $class, %args) = @_;
166 166
167 my $id = ++$self->{ns}{id}; 167 my $id = ++$self->{ns}{id};
168 168
169 my $proxy = $self->{w}{$id} = bless { 169 my $proxy = $self->{_w}{$id} = bless {
170 id => $id, 170 id => $id,
171 }, "ext::widget::proxy"; 171 }, "ext::widget::proxy";
172 172
173 Scalar::Util::weaken ($proxy->{ws} = $self); 173 Scalar::Util::weaken ($proxy->{ws} = $self);
174 Scalar::Util::weaken ($proxy->{ns} = $self->{ns}); 174 Scalar::Util::weaken ($proxy->{ns} = $self->{ns});
178 push @{$proxy->{ev}{$ev}}, $args{$ev}; 178 push @{$proxy->{ev}{$ev}}, $args{$ev};
179 $args{$ev} = 0; 179 $args{$ev} = 0;
180 } 180 }
181 181
182 $self->msg (ws_c => 182 $self->msg (ws_c =>
183 ws => $self->{w}{id}, 183 ws => $proxy->{id},
184 id => $id, 184 id => $id,
185 class => $class, 185 class => $class,
186 args => \%args, 186 args => \%args,
187 ); 187 );
188 188
196sub DESTROY { 196sub DESTROY {
197 my ($self) = @_; 197 my ($self) = @_;
198 198
199 delete $self->{ns}{widget}{$self->{id}}; 199 delete $self->{ns}{widget}{$self->{id}};
200 200
201 #warn "DES<$self> $self->{ws}\n";#d#
201 if (my $ws = $self->{ws}) { 202 if (my $ws = $self->{ws}) {
202 delete $ws->{w}{$self->{id}};
203 $self->msg (w_c => name => "destroy"); 203 $self->msg (w_c => name => "destroy");
204 delete $ws->{_w}{$self->{id}};
204 } 205 }
205} 206}
206 207
207sub msg { 208sub msg {
208 my ($self, $type, %msg) = @_; 209 my ($self, $type, %msg) = @_;
243 244
244 () 245 ()
245} 246}
246 247
247sub set { 248sub set {
248 my ($self, $member, $value) = @_; 249 my ($self, @kv) = @_;
249 250
250 $self->msg (w_s => attr => [ [$member, $value] ]); 251 $self->msg (w_s => attr => \@kv);
251} 252}
252 253
253sub get { 254sub get {
254 my ($self, $member, $cb) = @_; 255 my ($self, $member, $cb) = @_;
255 256

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines