ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.220 by root, Mon May 22 03:28:55 2006 UTC vs.
Revision 1.223 by elmex, Tue May 23 18:10:51 2006 UTC

206 %$self = (); 206 %$self = ();
207} 207}
208 208
209sub show { 209sub show {
210 my ($self) = @_; 210 my ($self) = @_;
211
212 return if $self->{parent}; 211 return if $self->{parent};
213 212
214 $CFClient::UI::ROOT->add ($self); 213 $CFClient::UI::ROOT->add ($self);
214}
215
216sub show_centered {
217 my ($self) = @_;
218 return if $self->{parent};
219
220 $self->show;
221
222 $CFClient::UI::ROOT->on_post_alloc (
223 "centered $self" => sub {
224 $self->move (($::WIDTH - $self->{w}) * 0.5, ($::HEIGHT - $self->{h}) * 0.5);
225 },
226 );
215} 227}
216 228
217sub hide { 229sub hide {
218 my ($self) = @_; 230 my ($self) = @_;
219 231
427 Scalar::Util::weaken ($self->{parent} = $parent); 439 Scalar::Util::weaken ($self->{parent} = $parent);
428 440
429 # TODO: req_w _does_change after ->reconfigure 441 # TODO: req_w _does_change after ->reconfigure
430 $self->check_size 442 $self->check_size
431 unless exists $self->{req_w}; 443 unless exists $self->{req_w};
444
445 $self->show;
432} 446}
433 447
434sub check_size { 448sub check_size {
435 my ($self, $forced) = @_; 449 my ($self, $forced) = @_;
436 450
2525 $self 2539 $self
2526} 2540}
2527 2541
2528sub size_request { 2542sub size_request {
2529 (32, 8) 2543 (32, 8)
2544}
2545
2546sub update {
2547 my ($self) = @_;
2548
2549 return unless $self->{visible};
2550
2551 $self->SUPER::update;
2530} 2552}
2531 2553
2532sub _draw { 2554sub _draw {
2533 my ($self) = @_; 2555 my ($self) = @_;
2534 2556
2988 $child->{x} = int $child->{x}; 3010 $child->{x} = int $child->{x};
2989 $child->{y} = int $child->{y}; 3011 $child->{y} = int $child->{y};
2990 } 3012 }
2991 3013
2992 $self->SUPER::add (@children); 3014 $self->SUPER::add (@children);
3015
3016 while (@children) {
3017 my $w = pop @children;
3018 push @children, $w->children;
3019 $w->{visible} = 1;
3020 }
3021}
3022
3023sub remove {
3024 my ($self, @children) = @_;
3025
3026 $self->SUPER::remove (@children);
3027
3028 while (@children) {
3029 my $w = pop @children;
3030 push @children, $w->children;
3031 delete $w->{visible};
3032 }
2993} 3033}
2994 3034
2995sub on_refresh { 3035sub on_refresh {
2996 my ($self, $id, $cb) = @_; 3036 my ($self, $id, $cb) = @_;
2997 3037

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines