Snapper - XML Application SourceForge.net Logo  


NAME

SharkAPI::Splash.pm -- Splash Screen Functions


DESCRIPTION

This module contains a splash screen implementation. There is a default splash screen that can be used or custom pixmap data can be passed.

Currently the Splash screen is only supported for complied Snapper applications, i.e. not ``snaprun'' activated. This will be included soon.

The Snapper object will look for the global $Snapper::splash when it is parsing and will update the status bar as it goes. All that really needs to be done is update the status bar text.

Here is an example startup_script.pl:

  #!/usr/local/bin/perl
  #
  # Generic startup script read into XML Compile
  #
  #################
  use SharkAPI::Splash;
  $Snapper::splash = new SharkAPI::Splash();
  $Snapper::splash->show_splash();
  $Snapper::splash->set_statusbar(" Snapper bootstrap starting...");
  use Snapper;
  # create new object
  $SnapRun::xml = Snapper->new();
  die "  could not create Snapper object\n" if !$SnapRun::xml;
  $Snapper::splash->set_statusbar(" Reading xml embedded data...");
  my $xml_text = join('',<DATA>);
  $Snapper::splash->set_statusbar(" Building GladeXML object...");
  $SnapRun::xml->build_memory($xml_text,'__SNAPPER_PIXMAP__');
  $Snapper::splash->set_statusbar(" Process OIX data...");
  $SnapRun::xml->process_oix("MAIN");
  undef $xml_text;
  $Snapper::splash->set_statusbar(" Jumping in with source scripts...");
  $SnapRun::xml->source_scripts("MAIN");
  __DATA__

Here is the sample 999_main.pl script:

  #----------------------------------------------------
  # Startup Perl Script
  #
  # This file contains the Perl executed at startup
  #
  #----------------------------------------------------
  package Splash_Sample;
  use strict;
  use SharkAPI;
  require SharkAPI::App;
  require SharkAPI::Widget;
  #
  #  Init SharkAPI
  #
  $Splash_Sample::app = new SharkAPI::App(app_module => 'MAIN',
                                          run_mode   => 'Gtk');
  #
  #  Boot Via SharkAPI
  #
  $Splash_Sample::app->boot(snap_obj=>$SnapRun::xml);
  #
  #  Drop into main loop
  #
  $Snapper::splash->set_statusbar(" Dropping into gtk_main!");
  $Snapper::splash->hide_splash();
  undef $Snapper::splash;
  $Splash_Sample::app->main();

The following examples were taken from the splash sample directory.


OBJECT INTERFACE

  • new ( )
  • New creates the Splash object. There are no arguments and the newly created object is returned.

  • show_splash ( [ \@xpm_data ] )
  • This function will build and display the splash screen. If no pixmap data is passed then the default internal splash screen will be used. The xpm_data should be an array ref similar to the following:
      my @default_splash = (
        # width height ncolors chars_per_pixel
        '400 261 253 2',
        # colors
        '   c #000000',
        ' . c #4A3921',
        ' X c #AD844A',
        ' o c #947B63',
        # pixels
        ...
    =item * hide_splash ( )

    This function will pump the remaining Gtk events and then destoy the window.

  • set_statusbar ( $text )
  • This function will set the status bar text on the splash screen. After the text is set then the event will be flushed to display to the new text.
    
    =item * set_progressbar ( $percentage )

    This function will set the progress bar the specified percentage. The percentage should be a float value, i.e. .50, etc. The event loop will be flushed to display the newly set value. The Snapper module will call this method during XML parsing, so you shouldn't normally need to call this function.

    item * incr_progressbar ( [ $reset ] )

    This method will increment the progress bar by 1% or .01. The event queue will be flushed to reflect the change. If the bar overflows, i.e. >= 1.0 or the $reset argument is non zero then the progress bar will be reset.


SEE ALSO

perl(1).

Snapper(3).

SharkAPI(3).


AUTHOR

Bill Walz, bill@landsharklinux.com


COPYRIGHT

The SharkAPI::Splash module is Copyright (c) 2002 Albacore Technology, LLC The SharkAPI::Splash module is commercial licensed software


Valid HTML 4.01!
Content owned by Albacore Technology is copyright 1999-2000 Albacore Technology, LLC All rights reserved.