Public Member Functions

SplashScreen Class Reference

A component for showing a splash screen while your app starts up. More...

Inherits Component, Timer, and DeletedAtShutdown.

List of all members.

Public Member Functions

 SplashScreen ()
 Creates a SplashScreen object.
 ~SplashScreen ()
 Destructor.
void show (const String &title, const Image &backgroundImage, int minimumTimeToDisplayFor, bool useDropShadow, bool removeOnMouseClick=true)
 Creates a SplashScreen object that will display an image.
void show (const String &title, int width, int height, int minimumTimeToDisplayFor, bool useDropShadow, bool removeOnMouseClick=true)
 Creates a SplashScreen object with a specified size.
void paint (Graphics &g)
 Components can override this method to draw their content.
void timerCallback ()
 The user-defined callback routine that actually gets called periodically.

Detailed Description

A component for showing a splash screen while your app starts up.

This will automatically position itself, and delete itself when the app has finished initialising (it uses the JUCEApplication::isInitialising() to detect this).

To use it, just create one of these in your JUCEApplication::initialise() method, call its show() method and let the object delete itself later.

E.g.

    void MyApp::initialise (const String& commandLine)
    {
        SplashScreen* splash = new SplashScreen();

        splash->show ("welcome to my app",
                      ImageCache::getFromFile (File ("/foobar/splash.jpg")),
                      4000, false);

        .. no need to delete the splash screen - it'll do that itself.
    }

Constructor & Destructor Documentation

SplashScreen::SplashScreen (  )

Creates a SplashScreen object.

After creating one of these (or your subclass of it), call one of the show() methods to display it.

SplashScreen::~SplashScreen (  )

Destructor.


Member Function Documentation

void SplashScreen::show ( const String title,
const Image backgroundImage,
int  minimumTimeToDisplayFor,
bool  useDropShadow,
bool  removeOnMouseClick = true 
)

Creates a SplashScreen object that will display an image.

As soon as this is called, the SplashScreen will be displayed in the centre of the screen. This method will also dispatch any pending messages to make sure that when it returns, the splash screen has been completely drawn, and your initialisation code can carry on.

Parameters:
titlethe name to give the component
backgroundImagean image to draw on the component. The component's size will be set to the size of this image, and if the image is semi-transparent, the component will be made semi-transparent too. This image will be deleted (or released from the ImageCache if that's how it was created) by the splash screen object when it is itself deleted.
minimumTimeToDisplayForhow long (in milliseconds) the splash screen should stay visible for. If the initialisation takes longer than this time, the splash screen will wait for it to finish before disappearing, but if initialisation is very quick, this lets you make sure that people get a good look at your splash.
useDropShadowif true, the window will have a drop shadow
removeOnMouseClickif true, the window will go away as soon as the user clicks the mouse (anywhere)
void SplashScreen::show ( const String title,
int  width,
int  height,
int  minimumTimeToDisplayFor,
bool  useDropShadow,
bool  removeOnMouseClick = true 
)

Creates a SplashScreen object with a specified size.

For a custom splash screen, you can use this method to display it at a certain size and then override the paint() method yourself to do whatever's necessary.

As soon as this is called, the SplashScreen will be displayed in the centre of the screen. This method will also dispatch any pending messages to make sure that when it returns, the splash screen has been completely drawn, and your initialisation code can carry on.

Parameters:
titlethe name to give the component
widththe width to use
heightthe height to use
minimumTimeToDisplayForhow long (in milliseconds) the splash screen should stay visible for. If the initialisation takes longer than this time, the splash screen will wait for it to finish before disappearing, but if initialisation is very quick, this lets you make sure that people get a good look at your splash.
useDropShadowif true, the window will have a drop shadow
removeOnMouseClickif true, the window will go away as soon as the user clicks the mouse (anywhere)
void SplashScreen::paint ( Graphics g ) [virtual]

Components can override this method to draw their content.

The paint() method gets called when a region of a component needs redrawing, either because the component's repaint() method has been called, or because something has happened on the screen that means a section of a window needs to be redrawn.

Any child components will draw themselves over whatever this method draws. If you need to paint over the top of your child components, you can also implement the paintOverChildren() method to do this.

If you want to cause a component to redraw itself, this is done asynchronously - calling the repaint() method marks a region of the component as "dirty", and the paint() method will automatically be called sometime later, by the message thread, to paint any bits that need refreshing. In Juce (and almost all modern UI frameworks), you never redraw something synchronously.

You should never need to call this method directly - to take a snapshot of the component you could use createComponentSnapshot() or paintEntireComponent().

Parameters:
gthe graphics context that must be used to do the drawing operations.
See also:
repaint, paintOverChildren, Graphics

Reimplemented from Component.

void SplashScreen::timerCallback (  ) [virtual]

The user-defined callback routine that actually gets called periodically.

It's perfectly ok to call startTimer() or stopTimer() from within this callback to change the subsequent intervals.

Implements Timer.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines