custombgwin.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/custombgwin.h
  3. // Purpose: Class adding support for custom window backgrounds.
  4. // Author: Vadim Zeitlin
  5. // Created: 2011-10-10
  6. // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_CUSTOMBGWIN_H_
  10. #define _WX_CUSTOMBGWIN_H_
  11. // ----------------------------------------------------------------------------
  12. // wxCustomBackgroundWindow: Adds support for custom backgrounds to any
  13. // wxWindow-derived class.
  14. // ----------------------------------------------------------------------------
  15. class wxCustomBackgroundWindowBase
  16. {
  17. public:
  18. // Trivial default ctor.
  19. wxCustomBackgroundWindowBase() { }
  20. // Also a trivial but virtual -- to suppress g++ warnings -- dtor.
  21. virtual ~wxCustomBackgroundWindowBase() { }
  22. // Use the given bitmap to tile the background of this window. This bitmap
  23. // will show through any transparent children.
  24. //
  25. // Notice that you must not prevent the base class EVT_ERASE_BACKGROUND
  26. // handler from running (i.e. not to handle this event yourself) for this
  27. // to work.
  28. void SetBackgroundBitmap(const wxBitmap& bmp)
  29. {
  30. DoSetBackgroundBitmap(bmp);
  31. }
  32. protected:
  33. virtual void DoSetBackgroundBitmap(const wxBitmap& bmp) = 0;
  34. wxDECLARE_NO_COPY_CLASS(wxCustomBackgroundWindowBase);
  35. };
  36. #if defined(__WXUNIVERSAL__)
  37. #include "wx/univ/custombgwin.h"
  38. #elif defined(__WXMSW__)
  39. #include "wx/msw/custombgwin.h"
  40. #else
  41. #include "wx/generic/custombgwin.h"
  42. #endif
  43. #endif // _WX_CUSTOMBGWIN_H_