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