notify_icon_host.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright (c) 2014 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_BROWSER_UI_WIN_NOTIFY_ICON_HOST_H_
  5. #define ATOM_BROWSER_UI_WIN_NOTIFY_ICON_HOST_H_
  6. #include <windows.h>
  7. #include <vector>
  8. #include "base/macros.h"
  9. namespace atom {
  10. class NotifyIcon;
  11. class NotifyIconHost {
  12. public:
  13. NotifyIconHost();
  14. ~NotifyIconHost();
  15. NotifyIcon* CreateNotifyIcon();
  16. void Remove(NotifyIcon* notify_icon);
  17. private:
  18. typedef std::vector<NotifyIcon*> NotifyIcons;
  19. // Static callback invoked when a message comes in to our messaging window.
  20. static LRESULT CALLBACK WndProcStatic(HWND hwnd,
  21. UINT message,
  22. WPARAM wparam,
  23. LPARAM lparam);
  24. LRESULT CALLBACK WndProc(HWND hwnd,
  25. UINT message,
  26. WPARAM wparam,
  27. LPARAM lparam);
  28. UINT NextIconId();
  29. // The unique icon ID we will assign to the next icon.
  30. UINT next_icon_id_ = 1;
  31. // List containing all active NotifyIcons.
  32. NotifyIcons notify_icons_;
  33. // The window class of |window_|.
  34. ATOM atom_ = 0;
  35. // The handle of the module that contains the window procedure of |window_|.
  36. HMODULE instance_ = nullptr;
  37. // The window used for processing events.
  38. HWND window_ = nullptr;
  39. // The message ID of the "TaskbarCreated" message, sent to us when we need to
  40. // reset our status icons.
  41. UINT taskbar_created_message_ = 0;
  42. DISALLOW_COPY_AND_ASSIGN(NotifyIconHost);
  43. };
  44. } // namespace atom
  45. #endif // ATOM_BROWSER_UI_WIN_NOTIFY_ICON_HOST_H_