Gtk2
view release on metacpan or search on metacpan
gtk-demo/assistant.pl view on Meta::CPAN
sub create_page2($)
{
my $assistant = shift;
my ($box, $checkbutton, $pixbuf);
$box = Gtk2::VBox->new(12, FALSE);
$box->set_border_width(12);
$checkbutton = Gtk2::CheckButton->new_with_label("This is optional data, you may continue " .
"even if you do not check this");
$box->pack_start($checkbutton, FALSE, FALSE, 0);
$box->show_all();
$assistant->append_page($box);
$assistant->set_page_complete($box, TRUE);
$assistant->set_page_title($box, "Page 2");
$pixbuf = $assistant->render_icon('gtk-dialog-info', 'GTK_ICON_SIZE_DIALOG');
$assistant->set_page_header_image($box, $pixbuf);
undef $pixbuf;
}
sub create_page3($)
{
my $assistant = shift;
my ($label, $pixbuf);
$label = Gtk2::Label->new ("This is a confirmation page, press 'Apply' to apply changes");
$label->show();
$assistant->append_page($label);
$assistant->set_page_type($label, 'GTK_ASSISTANT_PAGE_CONFIRM');
$assistant->set_page_complete($label, TRUE);
$assistant->set_page_title($label, "Confirmation");
$pixbuf = $assistant->render_icon('gtk-dialog-info', 'GTK_ICON_SIZE_DIALOG');
$assistant->set_page_header_image($label, $pixbuf);
undef $pixbuf;
}
sub create_page4($)
{
my $assistant = shift;
my ($page);
$page = Gtk2::Alignment->new (0.5, 0.5, 0.5, 0.0);
$progress_bar = Gtk2::ProgressBar->new();
$page->add($progress_bar);
$page->show_all();
$assistant->append_page($page);
$assistant->set_page_type($page, 'GTK_ASSISTANT_PAGE_PROGRESS');
$assistant->set_page_title($page, "Applying changes");
# This prevents the assistant window from being
# closed while we're "busy" applying changes.
$assistant->set_page_complete($page, FALSE);
}
sub do {
my $do_widget = shift;
if (!$assistant) {
$assistant = Gtk2::Assistant->new ();
$assistant->set_default_size(-1, 300);
$assistant->set_screen ($do_widget->get_screen)
if Gtk2->CHECK_VERSION (2, 2, 0);
create_page1 ($assistant);
create_page2 ($assistant);
create_page3 ($assistant);
create_page4 ($assistant);
$assistant->signal_connect ("cancel",
\&on_assistant_close_cancel, \$assistant);
$assistant->signal_connect ("close",
\&on_assistant_close_cancel, \$assistant);
$assistant->signal_connect ("apply",
\&on_assistant_apply, undef);
$assistant->signal_connect ("prepare",
\&on_assistant_prepare, undef);
}
if (!$assistant->visible()) {
$assistant->show();
} else {
$assistant->destroy();
$assistant = undef;
}
return $assistant;
}
1;
__END__
Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
full list)
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option) any
later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Library General Public License for more
details.
You should have received a copy of the GNU Library General Public License along
with this library; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
( run in 2.548 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )