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.249 by root, Sun May 28 01:40:02 2006 UTC vs.
Revision 1.250 by root, Sun May 28 02:31:03 2006 UTC

221 } 221 }
222 222
223 $self 223 $self
224} 224}
225 225
226sub toggle_visibility {
227 my ($self) = @_;
228
229 if ($self->{visible}) {
230 $self->hide;
231 } else {
232 $self->show;
233 }
234}
235
236sub destroy { 226sub destroy {
237 my ($self) = @_; 227 my ($self) = @_;
238 228
239 $self->hide; 229 $self->hide;
240 %$self = (); 230 %$self = ();
290 $self->focus_out; 280 $self->focus_out;
291 281
292 $self->emit (visibility_change => 0); 282 $self->emit (visibility_change => 0);
293} 283}
294 284
285sub set_visibility {
286 my ($self, $visible) = @_;
287
288 return if $self->{visible} == $visible;
289
290 $visible ? $self->hide
291 : $self->show;
292}
293
294sub toggle_visibility {
295 my ($self) = @_;
296
297 $self->{visible}
298 ? $self->hide
299 : $self->show;
300}
301
295sub hide { 302sub hide {
296 my ($self) = @_; 303 my ($self) = @_;
297 304
298 $self->set_invisible; 305 $self->set_invisible;
299 306
345 $self->{y} = $y; 352 $self->{y} = $y;
346 $self->update; 353 $self->update;
347 } 354 }
348 355
349 if ($self->{w} != $w || $self->{h} != $h) { 356 if ($self->{w} != $w || $self->{h} != $h) {
350 $CFClient::UI::ROOT->{size_alloc}{$self} = [$self, $w, $h]; 357 $CFClient::UI::ROOT->{size_alloc}{$self+0} = [$self, $w, $h];
351 } 358 }
352} 359}
353 360
354sub size_allocate { 361sub size_allocate {
355 # nothing to be done 362 # nothing to be done
3008 if exists $child->{req_x}; 3015 if exists $child->{req_x};
3009 3016
3010 $Y = $child->{req_y} > 0 ? $child->{req_y} : $h - $H - $child->{req_y} + 1 3017 $Y = $child->{req_y} > 0 ? $child->{req_y} : $h - $H - $child->{req_y} + 1
3011 if exists $child->{req_y}; 3018 if exists $child->{req_y};
3012 3019
3013 delete @$child{qw(req_x req_y)}; 3020 #delete @$child{qw(req_x req_y)};#d# def_x, def_y
3014 3021
3015 $X = List::Util::max 0, List::Util::min $w - $W, int $X + 0.5; 3022 $X = List::Util::max 0, List::Util::min $w - $W, int $X + 0.5;
3016 $Y = List::Util::max 0, List::Util::min $h - $H, int $Y + 0.5; 3023 $Y = List::Util::max 0, List::Util::min $h - $H, int $Y + 0.5;
3017 3024
3018 $child->configure ($X, $Y, $W, $H); 3025 $child->configure ($X, $Y, $W, $H);
3091 } 3098 }
3092 3099
3093 if ($self->{check_size}) { 3100 if ($self->{check_size}) {
3094 my @queue; 3101 my @queue;
3095 3102
3096 for (;;) { 3103 while () {
3097 if ($self->{check_size}) { 3104 if ($self->{check_size}) {
3098 #TODO use array-of-depth approach 3105 #TODO use array-of-depth approach
3099 3106
3100 @queue = sort { $a->{visible} <=> $b->{visible} } 3107 @queue = sort { $a->{visible} <=> $b->{visible} }
3101 @queue, values %{delete $self->{check_size}}; 3108 @queue, values %{delete $self->{check_size}};
3122 if $widget->{parent}; 3129 if $widget->{parent};
3123 } 3130 }
3124 } 3131 }
3125 } 3132 }
3126 3133
3127 while ($self->{size_alloc}) { 3134 while (my $size_alloc = delete $self->{size_alloc}) {
3128 for ( 3135 my @queue = sort $b->[0]{visible} <=> $a->[0]{visible},
3129 sort { $a->[0]{visible} <=> $b->[0]{visible} } 3136 values %$size_alloc;
3130 values %{delete $self->{size_alloc}} 3137
3131 ) { 3138 while () {
3132 my ($widget, $w, $h) = @$_; 3139 my ($widget, $w, $h) = @{ pop @queue or last };
3133 3140
3134 $w = 0 if $w < 0; 3141 $w = 0 if $w < 0;
3135 $h = 0 if $h < 0; 3142 $h = 0 if $h < 0;
3136 3143
3137 $widget->{w} = $w; 3144 $widget->{w} = $w;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines