Re: Splash screen.



Thanks Steve. The idea of producing a splash screen
was great. But it uses xpm file for the image. As I
have already told the image is going to be anything
other than xpm. Can there be some way to display other
file formats (eg. jpg formate)in the given function?

--- Steve Ramsay <ramsay@spatialcomponents.com> wrote:

> // show the splash screen
> void splash_screen(void)
> {
> 	// make a window for splash scrren, make it a popup
> so it will stay on
> 	// top of everything.
>         GtkWidget *MainFrame = gtk_window_new
> (GTK_WINDOW_POPUP);
>         gtk_object_set_data (GTK_OBJECT (MainFrame),
> "Caris",
> MainFrame);
> 
> 	// set the size to that of our splash image.
>         gtk_widget_set_usize (MainFrame, 428, 314);
>         gtk_window_set_title (GTK_WINDOW
> (MainFrame), "Caris");
> 	// center it on the screen
>         gtk_window_set_position(GTK_WINDOW
> (MainFrame),
> GTK_WIN_POS_CENTER);
> 
> 	// set up key and mound button press to hide splash
> screen
>        
>
gtk_signal_connect(GTK_OBJECT(MainFrame),"button_press_event",
>                
> GTK_SIGNAL_FUNC(splash_button_pressed),NULL);
>        
>
gtk_signal_connect(GTK_OBJECT(MainFrame),"key_press_event",
>                
> GTK_SIGNAL_FUNC(splash_key_pressed),NULL);
>         gtk_widget_add_events(MainFrame,
>                               GDK_BUTTON_PRESS_MASK|
>                              
> GDK_BUTTON_RELEASE_MASK|
>                               GDK_KEY_PRESS_MASK);
> 
> 	// make the image for the splash screen
>         GtkWidget* pixmap =
> create_pixmap_from_data(MainFrame,
>                                 splash_xpm);
> 
>         gtk_container_add (GTK_CONTAINER
> (MainFrame),pixmap);
>         gtk_widget_show(pixmap);
>         gtk_widget_show(MainFrame);
> 
> 	// force it to draw now.
> 	gdk_flush();
> 
> 	// go into main loop, processing events.
>         while(gtk_events_pending() ||
> !GTK_WIDGET_REALIZED(pixmap))
>                 gtk_main_iteration();
> 
> 	// after 3 seconds, destroy the splash screen.
>         gtk_timeout_add( 3000, splash_screen_cb,
> MainFrame );
> }


__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]