Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members

FXSplashWindow.h

Go to the documentation of this file.
00001 /***********************************-*- mode: c++; tab-width: 2 -*-*\
00002  *
00003  * NAME:     
00004  *   FXSplashWindow - Show a splash screen for app startup/about/etc
00005  *
00006  * AUTHOR:
00007  *   Daniel Gehriger (gehriger@linkcad.com)
00008  *
00009  * Updates:
00010  *   Mathew Robertson <mathew@users.sourceforge.net>
00011  *
00012  * Copyright (c) 1999 by Daniel Gehriger.  All Rights Reserved.
00013  *
00014  * PUPROSE:
00015  *   Display a splash window
00016  *
00017  * NOTE
00018  *
00019  * This library is free software; you can redistribute it and/or 
00020  * modify it under the terms of the GNU Library General Public   
00021  * License as published by the Free Software Foundation; either  
00022  * version 2 of the License, or (at your option) any later version.
00023  *                                                                 
00024  * This library is distributed in the hope that it will be useful, 
00025  * but WITHOUT ANY WARRANTY; without even the implied warranty of  
00026  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027  * Library General Public License for more details.                 
00028  *                                                                  
00029  * You should have received a copy of the GNU Library General Public
00030  * License along with this library; if not, write to the Free       
00031  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00032  *
00033  * HISTORY:
00034  *        dgehrige - Dec, 10 1999: Created.
00035  *
00036 \*******************************************************************/
00037 #ifndef FXSPLASHWINDOW_H
00038 #define FXSPLASHWINDOW_H
00039 
00040 #ifndef FXTOPWINDOW_H
00041 #include <fox/FXTopWindow.h>
00042 using namespace FX;
00043 #endif
00044 namespace FXEX {
00045 
00046 // SplashWindow options
00047 enum {
00048   SPLASH_NORAISE       = 0,                 // Dont keep splash window on top
00049   SPLASH_AUTORAISE     = 0x02000000,        // Keep splash window on top
00050   SPLASH_AUTODESTROY   = 0x04000000,        // Delete itself on timeout
00051   SPLASH_HIDEDESTROY   = 0x08000000         // Delete itself when hidden
00052   };
00053 
00054 /**
00055  * Application splash-window; something you might display to annoy the user
00056  *
00057  * Notes:
00058  * - just call execute() to show the window
00059  * - you are meant to derive from this and fill the contents of the window
00060  *   with your application info
00061  */
00062 class FXAPI FXSplashWindow : public FXTopWindow  {
00063   FXDECLARE(FXSplashWindow)
00064 
00065 protected:
00066   FXuint   timeout;   // the amount of time specified
00067   FXImage *image;     // image to show
00068 
00069 private:
00070   FXSplashWindow(const FXSplashWindow&);
00071   FXSplashWindow &operator=(const FXSplashWindow&);
00072 
00073 protected:
00074   FXSplashWindow(){}
00075 
00076 public:
00077   long onTimeout(FXObject*,FXSelector,void*);
00078   long onFocusOut(FXObject*,FXSelector,void*);
00079 
00080 public:
00081   enum {
00082     ID_SPLASH=FXTopWindow::ID_LAST,
00083     ID_LAST
00084     };
00085 
00086 public:
00087   // Create a splash window - default for 3 seconds delay
00088   FXSplashWindow(FXApp* a,const FXString& title="",FXint to=3000,FXuint opts=SPLASH_AUTORAISE|DECOR_BORDER,FXint w=0,FXint h=0,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
00089 
00090   /**
00091    * Runs the splash window modally; saves calling create() then show()
00092    * returns, when no more events left to process, so that you can continue
00093    * loading your application
00094    */
00095   virtual FXuint execute(FXuint placement=PLACEMENT_SCREEN);
00096 
00097   /// show the splash dialog
00098   virtual void show();
00099 
00100   /// hide the splash dialog
00101   virtual void hide();
00102 
00103   /// display splash dialog with a given placement
00104   virtual void show(FXuint placement=PLACEMENT_SCREEN);
00105 
00106   /// splash timeout (in miliseconds)
00107   void setTimeout(FXuint n) { timeout=n; }
00108 
00109   /// set the icon (FXSplashWindow then owns it)
00110   void setImage(FXImage *img);
00111 
00112   /// set the Image, from a file (supports most image formats, by file extension)
00113   void setImage(const FXString& file);
00114 
00115   /**
00116    * Call this occasionally in your startup routine, so as to ensure the splashwindow
00117    * get repainted.
00118    */
00119   void flush();
00120 
00121   /// save to stream
00122   virtual void save(FXStream& store) const;
00123 
00124   /// load from stream
00125   virtual void load(FXStream& store);
00126 
00127   /// dtor
00128   virtual ~FXSplashWindow();
00129   };
00130 
00131 } // namespace FXEX
00132 #endif // FXSPLASHWINDOW_H