2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2014 GitHub, Inc.
|
2014-06-03 03:25:09 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_UI_WIN_NOTIFY_ICON_HOST_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_UI_WIN_NOTIFY_ICON_HOST_H_
|
2014-06-03 03:25:09 +00:00
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
2024-01-10 22:23:35 +00:00
|
|
|
#include <optional>
|
2014-06-03 03:25:09 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2020-01-31 05:37:03 +00:00
|
|
|
#include "shell/common/gin_converters/guid_converter.h"
|
|
|
|
|
|
|
|
const GUID GUID_DEFAULT = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
|
2014-06-03 03:25:09 +00:00
|
|
|
|
|
|
|
namespace electron {
|
|
|
|
|
|
|
|
class NotifyIcon;
|
|
|
|
|
|
|
|
class NotifyIconHost {
|
|
|
|
public:
|
|
|
|
NotifyIconHost();
|
|
|
|
~NotifyIconHost();
|
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
NotifyIconHost(const NotifyIconHost&) = delete;
|
|
|
|
NotifyIconHost& operator=(const NotifyIconHost&) = delete;
|
|
|
|
|
2024-01-10 22:23:35 +00:00
|
|
|
NotifyIcon* CreateNotifyIcon(std::optional<UUID> guid);
|
2014-06-03 03:25:09 +00:00
|
|
|
void Remove(NotifyIcon* notify_icon);
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef std::vector<NotifyIcon*> NotifyIcons;
|
|
|
|
|
|
|
|
// Static callback invoked when a message comes in to our messaging window.
|
2018-04-18 01:44:10 +00:00
|
|
|
static LRESULT CALLBACK WndProcStatic(HWND hwnd,
|
|
|
|
UINT message,
|
|
|
|
WPARAM wparam,
|
|
|
|
LPARAM lparam);
|
|
|
|
|
|
|
|
LRESULT CALLBACK WndProc(HWND hwnd,
|
|
|
|
UINT message,
|
|
|
|
WPARAM wparam,
|
|
|
|
LPARAM lparam);
|
2014-06-03 03:25:09 +00:00
|
|
|
|
|
|
|
UINT NextIconId();
|
|
|
|
|
|
|
|
// The unique icon ID we will assign to the next icon.
|
2018-05-21 22:18:38 +00:00
|
|
|
UINT next_icon_id_ = 1;
|
2014-06-03 03:25:09 +00:00
|
|
|
|
|
|
|
// List containing all active NotifyIcons.
|
|
|
|
NotifyIcons notify_icons_;
|
|
|
|
|
|
|
|
// The window class of |window_|.
|
2018-05-21 22:18:38 +00:00
|
|
|
ATOM atom_ = 0;
|
2014-06-03 03:25:09 +00:00
|
|
|
|
|
|
|
// The handle of the module that contains the window procedure of |window_|.
|
2018-05-21 22:18:38 +00:00
|
|
|
HMODULE instance_ = nullptr;
|
2014-06-03 03:25:09 +00:00
|
|
|
|
|
|
|
// The window used for processing events.
|
2018-05-21 22:18:38 +00:00
|
|
|
HWND window_ = nullptr;
|
2014-06-03 03:25:09 +00:00
|
|
|
|
|
|
|
// The message ID of the "TaskbarCreated" message, sent to us when we need to
|
|
|
|
// reset our status icons.
|
2018-05-21 22:18:38 +00:00
|
|
|
UINT taskbar_created_message_ = 0;
|
2023-10-09 23:56:38 +00:00
|
|
|
|
|
|
|
class MouseEnteredExitedDetector;
|
|
|
|
std::unique_ptr<MouseEnteredExitedDetector> mouse_entered_exited_detector_;
|
2014-06-03 03:25:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace electron
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_UI_WIN_NOTIFY_ICON_HOST_H_
|