1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/generic/splash.h
3 // Purpose:     Splash screen class
4 // Author:      Julian Smart
5 // Modified by:
6 // Created:     28/6/2000
7 // Copyright:   (c) Julian Smart
8 // Licence:     wxWindows Licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_SPLASH_H_
12 #define _WX_SPLASH_H_
13 
14 #include "wx/bitmap.h"
15 #include "wx/eventfilter.h"
16 #include "wx/frame.h"
17 #include "wx/timer.h"
18 
19 
20 /*
21  * A window for displaying a splash screen
22  */
23 
24 #define wxSPLASH_CENTRE_ON_PARENT   0x01
25 #define wxSPLASH_CENTRE_ON_SCREEN   0x02
26 #define wxSPLASH_NO_CENTRE          0x00
27 #define wxSPLASH_TIMEOUT            0x04
28 #define wxSPLASH_NO_TIMEOUT         0x00
29 
30 class WXDLLIMPEXP_FWD_CORE wxSplashScreenWindow;
31 
32 /*
33  * wxSplashScreen
34  */
35 
36 class WXDLLIMPEXP_CORE wxSplashScreen: public wxFrame,
37                                       public wxEventFilter
38 {
39 public:
40     // for RTTI macros only
wxSplashScreen()41     wxSplashScreen() { Init(); }
42     wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
43                    wxWindow* parent, wxWindowID id,
44                    const wxPoint& pos = wxDefaultPosition,
45                    const wxSize& size = wxDefaultSize,
46                    long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
47     virtual ~wxSplashScreen();
48 
49     void OnCloseWindow(wxCloseEvent& event);
50     void OnNotify(wxTimerEvent& event);
51 
GetSplashStyle()52     long GetSplashStyle() const { return m_splashStyle; }
GetSplashWindow()53     wxSplashScreenWindow* GetSplashWindow() const { return m_window; }
GetTimeout()54     int GetTimeout() const { return m_milliseconds; }
55 
56     // Override wxEventFilter method to hide splash screen on any user input.
57     virtual int FilterEvent(wxEvent& event) wxOVERRIDE;
58 
59 protected:
60     // Common part of all ctors.
61     void Init();
62 
63     wxSplashScreenWindow*   m_window;
64     long                    m_splashStyle;
65     int                     m_milliseconds;
66     wxTimer                 m_timer;
67 
68     wxDECLARE_DYNAMIC_CLASS(wxSplashScreen);
69     wxDECLARE_EVENT_TABLE();
70     wxDECLARE_NO_COPY_CLASS(wxSplashScreen);
71 };
72 
73 /*
74  * wxSplashScreenWindow
75  */
76 
77 class WXDLLIMPEXP_CORE wxSplashScreenWindow: public wxWindow
78 {
79 public:
80     wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER);
81 
82     void OnPaint(wxPaintEvent& event);
83     void OnEraseBackground(wxEraseEvent& event);
84 
SetBitmap(const wxBitmap & bitmap)85     void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
GetBitmap()86     wxBitmap& GetBitmap() { return m_bitmap; }
87 
88 protected:
89     wxBitmap    m_bitmap;
90 
91     wxDECLARE_EVENT_TABLE();
92     wxDECLARE_NO_COPY_CLASS(wxSplashScreenWindow);
93 };
94 
95 
96 #endif
97     // _WX_SPLASH_H_
98