splash.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. #ifndef _WX_SPLASH_H_
  11. #define _WX_SPLASH_H_
  12. #include "wx/bitmap.h"
  13. #include "wx/eventfilter.h"
  14. #include "wx/frame.h"
  15. #include "wx/timer.h"
  16. /*
  17. * A window for displaying a splash screen
  18. */
  19. #define wxSPLASH_CENTRE_ON_PARENT 0x01
  20. #define wxSPLASH_CENTRE_ON_SCREEN 0x02
  21. #define wxSPLASH_NO_CENTRE 0x00
  22. #define wxSPLASH_TIMEOUT 0x04
  23. #define wxSPLASH_NO_TIMEOUT 0x00
  24. class WXDLLIMPEXP_FWD_ADV wxSplashScreenWindow;
  25. /*
  26. * wxSplashScreen
  27. */
  28. class WXDLLIMPEXP_ADV wxSplashScreen: public wxFrame,
  29. public wxEventFilter
  30. {
  31. public:
  32. // for RTTI macros only
  33. wxSplashScreen() { Init(); }
  34. wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
  35. wxWindow* parent, wxWindowID id,
  36. const wxPoint& pos = wxDefaultPosition,
  37. const wxSize& size = wxDefaultSize,
  38. long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
  39. virtual ~wxSplashScreen();
  40. void OnCloseWindow(wxCloseEvent& event);
  41. void OnNotify(wxTimerEvent& event);
  42. long GetSplashStyle() const { return m_splashStyle; }
  43. wxSplashScreenWindow* GetSplashWindow() const { return m_window; }
  44. int GetTimeout() const { return m_milliseconds; }
  45. // Override wxEventFilter method to hide splash screen on any user input.
  46. virtual int FilterEvent(wxEvent& event);
  47. protected:
  48. // Common part of all ctors.
  49. void Init();
  50. wxSplashScreenWindow* m_window;
  51. long m_splashStyle;
  52. int m_milliseconds;
  53. wxTimer m_timer;
  54. DECLARE_DYNAMIC_CLASS(wxSplashScreen)
  55. DECLARE_EVENT_TABLE()
  56. wxDECLARE_NO_COPY_CLASS(wxSplashScreen);
  57. };
  58. /*
  59. * wxSplashScreenWindow
  60. */
  61. class WXDLLIMPEXP_ADV wxSplashScreenWindow: public wxWindow
  62. {
  63. public:
  64. wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER);
  65. void OnPaint(wxPaintEvent& event);
  66. void OnEraseBackground(wxEraseEvent& event);
  67. void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
  68. wxBitmap& GetBitmap() { return m_bitmap; }
  69. protected:
  70. wxBitmap m_bitmap;
  71. DECLARE_EVENT_TABLE()
  72. wxDECLARE_NO_COPY_CLASS(wxSplashScreenWindow);
  73. };
  74. #endif
  75. // _WX_SPLASH_H_