diff options
author | Thierry Vignaud <tv@mandriva.org> | 2006-11-17 17:40:46 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2006-11-17 17:40:46 +0000 |
commit | 489d851654e47113a92769b83d006677b3814736 (patch) | |
tree | 84bbcfa851ef3b7f3cb1b49e53533ecb041de5f1 /gurpmi.pm | |
parent | 215aff10d8b380a396652a52b762a31f879d340f (diff) | |
download | urpmi-489d851654e47113a92769b83d006677b3814736.tar urpmi-489d851654e47113a92769b83d006677b3814736.tar.gz urpmi-489d851654e47113a92769b83d006677b3814736.tar.bz2 urpmi-489d851654e47113a92769b83d006677b3814736.tar.xz urpmi-489d851654e47113a92769b83d006677b3814736.zip |
(create_scrolled_window) introduce it
Diffstat (limited to 'gurpmi.pm')
-rw-r--r-- | gurpmi.pm | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -20,10 +20,11 @@ if ($collation_locale) { use urpm; use strict; use Gtk2; +use urpm::util; use Exporter; our @ISA = qw(Exporter); -our @EXPORT = qw(fatal but quit add_button_box new_label N); +our @EXPORT = qw(create_scrolled_window fatal but quit add_button_box new_label N); sub usage () { print <<USAGE; @@ -126,4 +127,29 @@ sub N { Locale::gettext::iconv($r, undef, "UTF-8"); } + +# copied from ugtk2: +sub create_scrolled_window { + my ($W, $o_policy, $o_viewport_shadow) = @_; + my $w = Gtk2::ScrolledWindow->new(undef, undef); + $w->set_policy($o_policy ? @$o_policy : ('automatic', 'automatic')); + if (member(ref($W), qw(Gtk2::Layout Gtk2::Html2::View Gtk2::Text Gtk2::TextView Gtk2::TreeView))) { + $w->add($W); + } else { + $w->add_with_viewport($W); + } + $o_viewport_shadow and $w->child->set_shadow_type($o_viewport_shadow); + $W->can('set_focus_vadjustment') and $W->set_focus_vadjustment($w->get_vadjustment); + $W->set_left_margin(6) if ref($W) =~ /Gtk2::TextView/; + $W->show; + if (ref($W) =~ /Gtk2::TextView|Gtk2::TreeView/) { + my $f = Gtk2::Frame->new; + $f->set_shadow_type('in'); + $f->add($w); + $f; + } else { + $w; + } +} + 1; |