Re: Splash screen & cookbook
- From: "Maher Awamy" <muhri muhri net>
- To: gtk-perl-list gnome org
- Subject: Re: Splash screen & cookbook
- Date: 09 Feb 2001 12:22:21 CST
Hehe, since Pat posted the splash code, Paolo look down for a question I have
On Fri, 09 Feb 2001 10:02:08 -0500, pat eyler said:
I really like the cookbook idea that was posted here recently by
Paolo. As it stands now it looks like good documentation, but it's
missing the recipe kind of entries that made 'The Perl Cookbook' so
useful. Here's a cut at answering the splash screen question in the
'Recipe Style'. (The basic code here is from Pronto. I chopped
some things out, but it should still work. *CAVEAT* I didn't know how
to do this before writing this and reading through Pronto -- someone
with a better handle on things should look this over, verify that it
makes sense, and probably write a better discussion blurb.)
Problem:
You want to create a splash page for your Gtk-Perl application.
Solution:
Create a toplevel window, and use it as your splash page.
sub splash {
my ($splash);
$splash = new Gtk::Window("toplevel");
$splash->realize();
$splash->set_title("Splash Page");
$splash->set_position('center');
$splash->window->set_decorations(0);
$splash->{'vbox'} = new Gtk::VBox(0,0);
my ($p,$m) =
Gtk::Gdk::Pixmap->create_from_xpm($splash->window,$splash->style->bg('normal'),$libpath."/pixmaps/splash.xpm");
my $pixmap = new Gtk::Pixmap($p,$m);
$pixmap->show();
$splash->add($splash->{'vbox'});
$splash->{'vbox'}->pack_start($pixmap,0,0,0);
show_all $splash;
while (Gtk->events_pending) {
Gtk->main_iteration
}
return $splash;
}
sub app_init {
my $splash = splash();
$splash->{'statusbar'}->push(1,"Doing Something ...");
while (Gtk->events_pending) {
Gtk->main_iteration
}
&do_something;
while (Gtk->events_pending) {
Gtk->main_iteration
}
$splash->{'statusbar'}->push(1,"Doing Something Else ...");
&do_something_else;
while (Gtk->events_pending) {
Gtk->main_iteration
}
$splash->{'statusbar'}->push(1,"Creating main window ...");
&init_main_window;
$splash->window->raise();
I raise the splash window because the main window comes up and covers it, whats the right thing to do so that
the splash window will be a top of the other main window that comes up while the splash is informing user
about stuff?
Maher
while (Gtk->events_pending) {
Gtk->main_iteration
}
$splash->destroy();
}
Discussion:
By creating a top level window, and loading it with a pixmap (the
splash image) and a status bar, you've created a splash page. You can
then write updates to the status bar as you do things.
When you're done initializing, you can create the main window then
delete the splash page.
-pate
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
--
http://www.muhri.net -- muhri muhri net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]