From 50b04ef3a52ba5a36511181d88c9c8befeb50f46 Mon Sep 17 00:00:00 2001 From: freesource Date: Tue, 28 Aug 2001 07:47:30 +0000 Subject: [PATCH] Getting closer, modal transient window is half there. --- BootRoot/YardBox.pm | 59 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/BootRoot/YardBox.pm b/BootRoot/YardBox.pm index b69e4eb..c50eaa3 100644 --- a/BootRoot/YardBox.pm +++ b/BootRoot/YardBox.pm @@ -41,7 +41,7 @@ my($filename,$filesystem_size,$kernel,$template_dir,$template,$tmp,$mnt); my ($text, $changed_text, $changed_text_from_template); my $save_as; my ($replacements_window, $filesystem_window, $path_window, $shortcut); -my $search_window; +my ($search_window, $question_window); my $Shortcuts; my @entry; my $file_dialog; @@ -1243,7 +1243,9 @@ sub search { } else { - + question_window("Beginning of document reached; " . + "continue from end?", + $search_window, $submit_b); } } @@ -1272,9 +1274,6 @@ sub search { $length = $length + $offset; $text->select_region($offset, $length); } - else { - - } } else { $offset = $offset + 1; @@ -1299,7 +1298,9 @@ sub search { $text->select_region($offset,$length); } else { - + question_window("End of document reached;" + . " continue from beginning?", + $search_window,$submit_b); } } @@ -1324,6 +1325,52 @@ sub search { } # end sub search + +# Just a universal dialog box with OK and Cancel +sub question_window { + + my ($output,$widget,$widget_button) = @_; + + if (not defined $question_window) { + $question_window = new Gtk::Dialog; + $question_window->set_modal($true); + $question_window->set_transient_for($widget); + $question_window->signal_connect("destroy", \&destroy_window, + \$question_window); + $question_window->signal_connect("delete_event", \&destroy_window, + \$question_window); + $question_window->set_title("gBootRoot Question?"); + $question_window->border_width(15); + my $label = new Gtk::Label($output); + #$label->set_justify("left") if $_[1]; + $question_window->vbox->pack_start( $label, $true, $true, 15 ); + $label->show(); + my $button = new Gtk::Button("OK"); + $button->signal_connect("clicked", sub { + $widget_button->clicked; + $question_window->destroy; + }); + $button->can_default(1); + $question_window->action_area->pack_start($button, $false, $false,0); + $button->grab_default; + $button->show; + + my $c_button = new Gtk::Button("Cancel"); + $c_button->signal_connect("clicked", sub { + $question_window->destroy; + }); + $question_window->action_area->pack_start($c_button, $false, $false,0); + $c_button->show; + + + + } + if (!visible $question_window) { + $question_window->show; + } +} + + sub yard_menu { my ($window) = @_;