1 /* cbSplashScreen.h
2  *
3  * DESCRIPTION:
4  *   Generic Splash Screen class with reduced interface able to draw transparent bitmaps.
5  *   It was coded to be used in Code::Blocks IDE but I don't care if you use it for your own projects.
6  *
7  * AUTHOR:
8  *   Ceniza
9  *
10  * Copyright (C) 2006 Ceniza
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26 
27 #ifndef CBSPLASH_SCREEN_H
28 #define CBSPLASH_SCREEN_H
29 
30 #include <wx/bitmap.h>
31 #include <wx/dc.h>
32 #include <wx/timer.h>
33 #include <wx/frame.h>
34 
35 class cbSplashScreen : public wxFrame
36 {
37   private:
38     wxBitmap m_label;
39     wxTimer m_timer;
40     wxRegion r;
41   public:
42     // A value of -1 for timeout makes it stay forever (you need to close it manually)
43 #ifdef __WXMAC__
44     cbSplashScreen(wxBitmap &label, long timeout, wxWindow *parent, wxWindowID id, long style = wxSTAY_ON_TOP | wxNO_BORDER | wxFRAME_TOOL_WINDOW);
45 #else
46     cbSplashScreen(wxBitmap &label, long timeout, wxWindow *parent, wxWindowID id, long style = wxSTAY_ON_TOP | wxNO_BORDER | wxFRAME_NO_TASKBAR | wxFRAME_SHAPED);
47 #endif
48     ~cbSplashScreen();
49 
50   private:
51     void DoPaint(wxDC &dc);
52     void OnPaint(wxPaintEvent &);
53     void OnEraseBackground(wxEraseEvent &);
54     void OnTimer(wxTimerEvent &);
55     void OnCloseWindow(wxCloseEvent &);
56     void OnChar(wxKeyEvent &);
57     void OnMouseEvent(wxMouseEvent &event);
58 
59   DECLARE_EVENT_TABLE()
60 };
61 
62 #endif // CBSPLASH_SCREEN_H
63 
64