From 2af607580dd3e1568f0eb5c50f6db77bed314f5b Mon Sep 17 00:00:00 2001 From: damien Date: Fri, 9 Mar 2001 02:40:49 +0000 Subject: applied gtkradio created create_boxradio in wizard mode : list -> radio buttons --- perl-install/install_steps_gtk.pm | 5 ++--- perl-install/interactive_gtk.pm | 28 ++++++++++++++++++++++++++-- perl-install/my_gtk.pm | 2 +- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index 79012db54..b9f43a150 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -151,11 +151,10 @@ sub selectInstallClass1 { $::live || @$l == 1 and return $o->SUPER::selectInstallClass1($verif, $l, $def, $l2, $def2); my $w = my_gtk->new(''); - my ($radio, $focused); + my $focused; gtkadd($w->{window}, gtkpack($o->create_box_with_title(_("Please, choose one of the following classes of installation:")), - (my @radios = map { $radio = new Gtk::RadioButton($_, $radio ? $radio : ()); - $radio->set_active($_ eq $def); $radio } @$l), + (my @radios = gtkradio(@$l, $def)), gtkadd(create_hbox(), map { my $v = $_; my $b = new Gtk::Button(translate($_)); diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index 39f4d0b71..b967f6aa3 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -32,9 +32,31 @@ sub ask_warn { local $my_gtk::pop_it = 1; &interactive::ask_warn; } + +sub create_boxradio { + my ($e, $may_go_to_next, $changed) = @_; + my @l = map { may_apply($e->{format}, $_) } @{$e->{list}}; + + my $boxradio = gtkpack2__(new Gtk::VBox(0, 0), + my @radios = gtkradio(@l, '')); + $boxradio->show; + mapn { + my ($txt, $w) = @_; + $w->signal_connect(clicked => sub { + ${$e->{val}} = $txt; + &$changed; + }); + } $e->{list}, \@radios; + + $boxradio, sub { + my ($v) = @_; + mapn { $_[0]->set_active($_[1] eq $v) } \@radios, $e->{list}; + } +} + sub create_clist { my ($e, $may_go_to_next, $changed) = @_; - my (@widgets, $curr); + my $curr; my @l = map { may_apply($e->{format}, $_) } @{$e->{list}}; my $list = new Gtk::CList(1); @@ -358,7 +380,9 @@ sub ask_from_entries_refW { } elsif ($e->{type} eq 'treelist') { ($w, $set) = create_ctree($e, $may_go_to_next, $changed); } else { - ($w, $set) = create_clist($e, $may_go_to_next, $changed); + ($w, $set) = $::isWizard ? + create_boxradio($e, $may_go_to_next, $changed) : + create_clist($e, $may_go_to_next, $changed); } if (@$l == 1) { #- i'm the only one, double click means accepting diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 065ed2a59..01853f83e 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -10,7 +10,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 create_treeitem) ], - wrappers => [ qw(gtksignal_connect gtkpack gtkpack_ gtkpack__ gtkpack2 gtkpack3 gtkpack2_ gtkpack2__ gtksetstyle gtkappend gtkset_shadow_type gtkadd gtkput gtktext_insert gtkset_usize gtkset_justify gtkset_active gtkshow gtkdestroy gtkset_mousecursor gtkset_mousecursor_normal gtkset_mousecursor_wait gtkset_background gtkset_default_fontset gtkctree_children gtkxpm gtkpng gtkcreate_xpm gtkcreate_png) ], + wrappers => [ qw(gtksignal_connect gtkradio gtkpack gtkpack_ gtkpack__ gtkpack2 gtkpack3 gtkpack2_ gtkpack2__ gtksetstyle gtkappend gtkset_shadow_type gtkadd gtkput gtktext_insert gtkset_usize gtkset_justify gtkset_active gtkshow gtkdestroy gtkset_mousecursor gtkset_mousecursor_normal gtkset_mousecursor_wait gtkset_background gtkset_default_fontset gtkctree_children gtkxpm gtkpng gtkcreate_xpm gtkcreate_png) ], ask => [ qw(ask_warn ask_okcancel ask_yesorno ask_from_entry ask_file) ], ); $EXPORT_TAGS{all} = [ map { @$_ } values %EXPORT_TAGS ]; -- cgit v1.2.1