notifmsg.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/notifmsg.h
  3. // Purpose: implementation of wxNotificationMessage for Windows
  4. // Author: Vadim Zeitlin
  5. // Created: 2007-12-01
  6. // Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_MSW_NOTIFMSG_H_
  10. #define _WX_MSW_NOTIFMSG_H_
  11. class WXDLLIMPEXP_FWD_ADV wxTaskBarIcon;
  12. // ----------------------------------------------------------------------------
  13. // wxNotificationMessage
  14. // ----------------------------------------------------------------------------
  15. class WXDLLIMPEXP_ADV wxNotificationMessage : public wxNotificationMessageBase
  16. {
  17. public:
  18. wxNotificationMessage() { Init(); }
  19. wxNotificationMessage(const wxString& title,
  20. const wxString& message = wxString(),
  21. wxWindow *parent = NULL,
  22. int flags = wxICON_INFORMATION)
  23. : wxNotificationMessageBase(title, message, parent, flags)
  24. {
  25. Init();
  26. }
  27. virtual ~wxNotificationMessage();
  28. virtual bool Show(int timeout = Timeout_Auto);
  29. virtual bool Close();
  30. // MSW implementation-specific methods
  31. // by default, wxNotificationMessage under MSW creates a temporary taskbar
  32. // icon to which it attaches the notification, if there is an existing
  33. // taskbar icon object in the application you may want to call this method
  34. // to attach the notification to it instead (we won't take ownership of it
  35. // and you can also pass NULL to not use the icon for notifications any
  36. // more)
  37. //
  38. // returns the task bar icon which was used previously (may be NULL)
  39. static wxTaskBarIcon *UseTaskBarIcon(wxTaskBarIcon *icon);
  40. // call this to always use the generic implementation, even if the system
  41. // supports the balloon tooltips used by the native one
  42. static void AlwaysUseGeneric(bool alwaysUseGeneric)
  43. {
  44. ms_alwaysUseGeneric = alwaysUseGeneric;
  45. }
  46. private:
  47. // common part of all ctors
  48. void Init() { m_impl = NULL; }
  49. // flag indicating whether we should always use generic implementation
  50. static bool ms_alwaysUseGeneric;
  51. // the real implementation of this class (selected during run-time because
  52. // the balloon task bar icons are not available in all Windows versions)
  53. class wxNotifMsgImpl *m_impl;
  54. wxDECLARE_NO_COPY_CLASS(wxNotificationMessage);
  55. };
  56. #endif // _WX_MSW_NOTIFMSG_H_