From 19ca59fe329e6cb97cc3681e70c12d81a022dbcc Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 19 Sep 1999 20:23:15 +0000 Subject: no_comment --- perl-install/my_gtk.pm | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'perl-install/my_gtk.pm') diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 30406cac0..bd822f67b 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -7,7 +7,7 @@ use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $border); @ISA = qw(Exporter); %EXPORT_TAGS = ( helpers => [ qw(create_okcancel createScrolledWindow create_menu create_notebook create_packtable create_hbox create_vbox create_adjustment create_box_with_title) ], - wrappers => [ qw(gtksignal_connect gtkpack gtkpack_ gtkappend gtkadd gtkset_usize gtkset_justify gtkset_active gtkshow gtkdestroy gtkset_mousecursor gtkset_background gtkset_default_fontset) ], + wrappers => [ qw(gtksignal_connect gtkpack gtkpack_ gtkappend gtkadd gtktext_insert gtkset_usize gtkset_justify gtkset_active gtkshow gtkdestroy gtkset_mousecursor gtkset_background gtkset_default_fontset) ], ask => [ qw(ask_warn ask_okcancel ask_yesorno ask_from_entry ask_from_list ask_file) ], ); $EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ]; @@ -126,6 +126,14 @@ sub gtkadd($@) { $w } +sub gtktext_insert($$) { + my ($w, $t) = @_; + $w->insert(undef, undef, undef, "$t\n"); #- needs \n otherwise in case of one line text the beginning is not shown (even with the vadj->set_value) + $w->set_word_wrap(1); + $w->vadj->set_value(0); + $w; +} + sub gtkroot { Gtk->init; Gtk::Gdk::Window->new_foreign(Gtk::Gdk->ROOT_WINDOW); @@ -200,13 +208,20 @@ sub create_box_with_title($@) { } sub createScrolledWindow($) { - my $w = new Gtk::ScrolledWindow(undef, undef); - $w->set_policy('automatic', 'automatic'); - member(ref $_[0], qw(Gtk::CList)) ? - $w->add($_[0]) : - $w->add_with_viewport($_[0]); - $_[0]->show; - $w + my ($W) = @_; + if (ref $W eq "Gtk::Text") { + gtkpack_(new Gtk::HBox(0,0), + 1, $W, + 0, new Gtk::VScrollbar($W->vadj)); + } else { + my $w = new Gtk::ScrolledWindow(undef, undef); + $w->set_policy('automatic', 'automatic'); + member(ref $W, qw(Gtk::CList)) ? + $w->add($W) : + $w->add_with_viewport($W); + $W->show; + $w + } } sub create_menu($@) { -- cgit v1.2.1