summaryrefslogtreecommitdiffstats
path: root/perl-install/my_gtk.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/my_gtk.pm')
-rw-r--r--perl-install/my_gtk.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm
index 43c4e9e29..2c983982c 100644
--- a/perl-install/my_gtk.pm
+++ b/perl-install/my_gtk.pm
@@ -392,6 +392,13 @@ sub write_on_pixmap {
$darea;
}
+sub n_line_size {
+ my ($nbline, $type, $widget) = @_;
+ my $font = $widget->style->font;
+ my $spacing = ${{ text => 0, various => 15 }}{$type};
+ $nbline * ($font->ascent + $font->descent + $spacing) + 8;
+}
+
#-###############################################################################
#- createXXX functions
@@ -421,8 +428,7 @@ sub create_box_with_title($@) {
$o->{box} = new Gtk::VBox(0,0);
$o->{icon} and eval { gtkpack__($o->{box}, gtkset_border_width(gtkpack_(new Gtk::HBox(0,0), 1, gtkpng($o->{icon})),5)); };
if (@_ <= 2 && $o->{box_size} > 4) {
- my $font = $o->{box}->style->font;
- my $wanted = $o->{box_size} * ($font->ascent + $font->descent) + 8;
+ my $wanted = n_line_size($o->{box_size}, 'text', $o->{box});
my $height = min(250, $wanted);
my $has_scroll = $height < $wanted;