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.310 by root, Fri Jun 23 20:28:20 2006 UTC vs.
Revision 1.311 by root, Fri Jun 23 22:35:16 2006 UTC

333} 333}
334 334
335sub size_request { 335sub size_request {
336 require Carp; 336 require Carp;
337 Carp::confess "size_request is abstract"; 337 Carp::confess "size_request is abstract";
338}
339
340sub baseline_shift {
341 0
338} 342}
339 343
340sub configure { 344sub configure {
341 my ($self, $x, $y, $w, $h) = @_; 345 my ($self, $x, $y, $w, $h) = @_;
342 346
1631 }; 1635 };
1632 1636
1633 @{ $self->{size_req} } 1637 @{ $self->{size_req} }
1634} 1638}
1635 1639
1640sub baseline_shift {
1641 $_[0]{layout}->descent
1642}
1643
1636sub invoke_size_allocate { 1644sub invoke_size_allocate {
1637 my ($self, $w, $h) = @_; 1645 my ($self, $w, $h) = @_;
1638 1646
1639 delete $self->{ox}; 1647 delete $self->{ox};
1640 1648
2576} 2584}
2577 2585
2578sub invoke_size_allocate { 2586sub invoke_size_allocate {
2579 my ($self, $w, $h) = @_; 2587 my ($self, $w, $h) = @_;
2580 2588
2581 my (undef, undef, @other) = @{ $self->{children} }; 2589 my ($empty, $slider, @other) = @{ $self->{children} };
2582 $_->configure (@$_{qw(x y req_w req_h)}) for @other; 2590 $_->configure (@$_{qw(x y req_w req_h)}) for @other;
2583 2591
2584 $self->{layout}->set_font ($self->{font}) if $self->{font}; 2592 $self->{layout}->set_font ($self->{font}) if $self->{font};
2585 $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); 2593 $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE);
2586 $self->{layout}->set_width ($self->{children}[0]{w}); 2594 $self->{layout}->set_width ($empty->{w});
2587 $self->{layout}->set_indent ($self->{fontsize} * $::FONTSIZE * $self->{indent}); 2595 $self->{layout}->set_indent ($self->{fontsize} * $::FONTSIZE * $self->{indent});
2588 2596
2589 $self->reflow; 2597 $self->reflow;
2590 2598
2591 $self->SUPER::invoke_size_allocate ($w, $h) 2599 $self->SUPER::invoke_size_allocate ($w, $h)
2595 my ($self, $para) = @_; 2603 my ($self, $para) = @_;
2596 2604
2597 my $layout = $self->{layout}; 2605 my $layout = $self->{layout};
2598 2606
2599 $layout->set_font ($self->{font}) if $self->{font}; 2607 $layout->set_font ($self->{font}) if $self->{font};
2608 $layout->set_foreground (@{$para->{fg}});
2600 $layout->set_height ($self->{fontsize} * $::FONTSIZE); 2609 $layout->set_height ($self->{fontsize} * $::FONTSIZE);
2601 $layout->set_width ($self->{children}[0]{w} - $para->{indent}); 2610 $layout->set_width ($self->{children}[0]{w} - $para->{indent});
2602 $layout->set_indent ($self->{fontsize} * $::FONTSIZE * $self->{indent}); 2611 $layout->set_indent ($self->{fontsize} * $::FONTSIZE * $self->{indent});
2603 $layout->set_markup ($para->{markup}); 2612 $layout->set_markup ($para->{markup});
2604 $layout->set_shapes (map +($_->{req_w}, $_->{req_h}), @{$para->{widget}}); 2613
2614 $layout->set_shapes (
2615 map
2616 +(0, $_->baseline_shift +$_->{padding_y} - $_->{h}, $_->{w}, $_->{h}),
2617 @{$para->{widget}}
2618 );
2605 2619
2606 $layout 2620 $layout
2607} 2621}
2608 2622
2609sub reflow { 2623sub reflow {
2677 for my $para (@{$self->{par}}) { 2691 for my $para (@{$self->{par}}) {
2678 if ($para->{w} != $W && ($para->{wrapped} || $para->{w} > $W)) { 2692 if ($para->{w} != $W && ($para->{wrapped} || $para->{w} > $W)) {
2679 my $layout = $self->get_layout ($para); 2693 my $layout = $self->get_layout ($para);
2680 my ($w, $h) = $layout->size; 2694 my ($w, $h) = $layout->size;
2681 2695
2682 $para->{w} = $w + $para->{indent}; 2696 $para->{w} = $w + $para->{indent};
2683 $para->{h} = $h; 2697 $para->{h} = $h;
2684 $para->{wrapped} = $layout->has_wrapped; 2698 $para->{wrapped} = $layout->has_wrapped;
2685 } 2699 }
2686 2700
2687 $height += $para->{h}; 2701 $height += $para->{h};
2688 } 2702 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines