MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / TrayIcon

Method TrayIcon

TranslucentTB/tray/trayicon.cpp:122–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122TrayIcon::TrayIcon(const GUID &iconId, const wchar_t *whiteIconResource,
123 const wchar_t *darkIconResource, PFN_SHOULD_SYSTEM_USE_DARK_MODE ssudm) :
124 m_IconData {
125 .cbSize = sizeof(m_IconData),
126 .hWnd = m_WindowHandle,
127 .uFlags = NIF_MESSAGE | NIF_TIP,
128 .uCallbackMessage = TRAY_CALLBACK,
129 .szTip = APP_NAME,
130 .uVersion = NOTIFYICON_VERSION_4
131 },
132 m_whiteIconResource(whiteIconResource),
133 m_darkIconResource(darkIconResource),
134 m_ShowPreference(false),
135 m_CurrentlyShowing(false),
136 m_TaskbarCreatedMessage(Window::RegisterMessage(WM_TASKBARCREATED)),
137 m_Ssudm(ssudm)
138{
139#ifdef SIGNED_BUILD
140 m_IconData.uFlags |= NIF_GUID;
141 m_IconData.guidItem = iconId;
142#else
143 // good enough method to get an unique id
144 m_IconData.uID = iconId.Data1;
145#endif
146
147 LoadThemedIcon();
148
149#ifdef SIGNED_BUILD
150 // Clear icon from a previous instance that didn't cleanly exit.
151 // Errors if instance cleanly exited, so avoid logging it.
152 // Only works when using GUIDs.
153 Shell_NotifyIcon(NIM_DELETE, &m_IconData);
154#endif
155}
156
157void TrayIcon::Show()
158{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected