… | |
… | |
369 | $self->{force_h} = List::Util::min $h, ($self->{max_h} || $::HEIGHT); |
369 | $self->{force_h} = List::Util::min $h, ($self->{max_h} || $::HEIGHT); |
370 | |
370 | |
371 | $self->realloc; |
371 | $self->realloc; |
372 | } |
372 | } |
373 | |
373 | |
374 | # traverse the widget chain up to find the maximum "physical" size constraints |
374 | ## traverse the widget chain up to find the maximum "physical" size constraints |
375 | sub get_max_wh { |
375 | #sub get_max_wh { |
376 | my ($self) = @_; |
376 | # my ($self) = @_; |
377 | |
377 | # |
378 | my ($w, $h) = @$self{qw(max_w max_h)}; |
378 | # my ($w, $h) = @$self{qw(max_w max_h)}; |
379 | |
379 | # |
380 | if ($w <= 0 || $h <= 0) { |
380 | # if ($w <= 0 || $h <= 0) { |
381 | my ($mw, $mh) = $self->{parent} |
381 | # my ($mw, $mh) = $self->{parent} |
382 | ? $self->{parent}->get_max_wh |
382 | # ? $self->{parent}->get_max_wh |
383 | : ($::WIDTH, $::HEIGHT); |
383 | # : ($::WIDTH, $::HEIGHT); |
384 | |
384 | # |
385 | $w = $mw if $w <= 0; |
385 | # $w = $mw if $w <= 0; |
386 | $h = $mh if $h <= 0; |
386 | # $h = $mh if $h <= 0; |
387 | } |
387 | # } |
388 | |
388 | # |
389 | ($w, $h) |
389 | # ($w, $h) |
390 | } |
390 | #} |
391 | |
391 | |
392 | sub size_request { |
392 | sub size_request { |
393 | require Carp; |
393 | require Carp; |
394 | Carp::confess "size_request is abstract"; |
394 | Carp::confess "size_request is abstract"; |
395 | } |
395 | } |
… | |
… | |
1412 | |
1412 | |
1413 | sub border { |
1413 | sub border { |
1414 | int $_[0]{border} * $::FONTSIZE |
1414 | int $_[0]{border} * $::FONTSIZE |
1415 | } |
1415 | } |
1416 | |
1416 | |
1417 | sub get_max_wh { |
1417 | #sub get_max_wh { |
1418 | my ($self) = @_; |
1418 | # my ($self) = @_; |
1419 | |
1419 | # |
1420 | return ($self->{w}, $self->{h}) |
1420 | # return ($self->{w}, $self->{h}) |
1421 | if $self->{visible} && $self->{w}; |
1421 | # if $self->{visible} && $self->{w}; |
1422 | |
1422 | # |
1423 | $self->SUPER::get_max_wh |
1423 | # $self->SUPER::get_max_wh |
1424 | } |
1424 | #} |
1425 | |
1425 | |
1426 | sub size_request { |
1426 | sub size_request { |
1427 | my ($self) = @_; |
1427 | my ($self) = @_; |
1428 | |
1428 | |
1429 | $self->{title_widget}->size_request |
1429 | $self->{title_widget}->size_request |
… | |
… | |
1989 | |
1989 | |
1990 | sub size_request { |
1990 | sub size_request { |
1991 | my ($self) = @_; |
1991 | my ($self) = @_; |
1992 | |
1992 | |
1993 | $self->{size_req} ||= do { |
1993 | $self->{size_req} ||= do { |
1994 | my ($max_w, $max_h) = $self->get_max_wh; |
1994 | my $max_w = $self->{w} || $self->{max_w} || 0x0fffffff; # actually 2**31-1 but allow for overflow inside pango |
1995 | |
1995 | |
1996 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1996 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1997 | $self->{layout}->set_width ($max_w); |
1997 | $self->{layout}->set_width ($max_w); |
1998 | $self->{layout}->set_ellipsise ($self->{ellipsise}); |
1998 | $self->{layout}->set_ellipsise ($self->{ellipsise}); |
1999 | $self->{layout}->set_single_paragraph_mode ($self->{ellipsise}); |
1999 | $self->{layout}->set_single_paragraph_mode ($self->{ellipsise}); |