1 /********************************************************************************
2 *                                                                               *
3 *                            S p l a s h    W i n d o w                         *
4 *                                                                               *
5 *********************************************************************************
6 * Copyright (C) 2004,2020 by Jeroen van der Zijp.   All Rights Reserved.        *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify          *
9 * it under the terms of the GNU Lesser General Public License as published by   *
10 * the Free Software Foundation; either version 3 of the License, or             *
11 * (at your option) any later version.                                           *
12 *                                                                               *
13 * This library is distributed in the hope that it will be useful,               *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
16 * GNU Lesser General Public License for more details.                           *
17 *                                                                               *
18 * You should have received a copy of the GNU Lesser General Public License      *
19 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
20 ********************************************************************************/
21 #ifndef FXSPLASHWINDOW_H
22 #define FXSPLASHWINDOW_H
23 
24 #ifndef FXTOPWINDOW_H
25 #include "FXTopWindow.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 /// Splash Window options
32 enum {
33   SPLASH_SIMPLE    = 0,                 /// Simple rectangular splash window
34   SPLASH_SHAPED    = 0x02000000,        /// Shaped splash window
35   SPLASH_OWNS_ICON = 0x04000000,        /// Splash window will own the icon and destroy it
36   SPLASH_DESTROY   = 0x08000000         /// Splash window will destroy itself when timer expires
37   };
38 
39 
40 /**
41 * The Splash Window is a window typically shown during startup
42 * of an application.  It comprises a large icon, which is also
43 * used as the shape of the window if SPLASH_SHAPED is passed;
44 * with the SPLASH_SIMPLE option the window will be simply rectangular.
45 */
46 class FXAPI FXSplashWindow : public FXTopWindow {
47   FXDECLARE(FXSplashWindow)
48 protected:
49   FXIcon *icon;         // Really big icon
50   FXTime  delay;        // Delay before hiding
51 protected:
52   FXSplashWindow();
53 private:
54   FXSplashWindow(const FXSplashWindow&);
55   FXSplashWindow &operator=(const FXSplashWindow&);
56 public:
57   long onPaint(FXObject*,FXSelector,void*);
58 public:
59 
60   /**
61   * Construct splash window; the window will be automatically hidden (or deleted
62   * if SPLASH_DESTROY is passed) after a given delay, specified in nanoseconds).
63   * The splash window is free floating.  Use this constructor when the splash window
64   * is to be displayed before the main window appears.
65   */
66   FXSplashWindow(FXApp* ap,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXTime ns=2000000000);
67 
68   /**
69   * Construct splash window; the window will be automatically hidden (or deleted
70   * if SPLASH_DESTROY is passed) after a given delay, specified in nanoseconds).
71   * The splash window stays on top of its owner window, which must already have been
72   * created previously.
73   */
74   FXSplashWindow(FXWindow* ow,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXTime ns=2000000000);
75 
76   /// Create
77   virtual void create();
78 
79   /// Detach
80   virtual void detach();
81 
82   /// Show splash window
83   virtual void show();
84 
85   /// Show splash window with a given placement
86   virtual void show(FXuint placement);
87 
88   /// Hide splash window
89   virtual void hide();
90 
91   /// Return the default width of this window
92   virtual FXint getDefaultWidth();
93 
94   /// Return the default height of this window
95   virtual FXint getDefaultHeight();
96 
97   /// Set the icon for the splash window
98   void setIcon(FXIcon* ic);
99 
100   /// Get the icon for this splash window
getIcon()101   FXIcon* getIcon() const { return icon; }
102 
103   /// Set or change delay in nanoseconds
104   void setDelay(FXTime ns);
105 
106   /// Return delay
getDelay()107   FXTime getDelay() const { return delay; }
108 
109   /// Save label to a stream
110   virtual void save(FXStream& store) const;
111 
112   /// Load label from a stream
113   virtual void load(FXStream& store);
114 
115   /// Destroy splash window
116   virtual ~FXSplashWindow();
117   };
118 
119 }
120 
121 #endif
122