diff win/dw.c @ 487:d6e07d292145

Implemented taskbar icons on windows, so I can keep feature for feature with InJoy Firewall.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 08 Nov 2003 15:30:19 +0000
parents 97c2c560f829
children a9a09514dd56
line wrap: on
line diff
--- a/win/dw.c	Sun Oct 19 07:15:37 2003 +0000
+++ b/win/dw.c	Sat Nov 08 15:30:19 2003 +0000
@@ -1413,6 +1413,8 @@
 		msg = WM_VSCROLL;
 	else if(msg == WM_KEYDOWN) /* && mp1 >= VK_F1 && mp1 <= VK_F24) allow ALL special keys */
 		msg = WM_CHAR;
+	else if(msg == WM_USER+2)
+		msg = (UINT)mp2;
 
 	if(result == -1)
 	{
@@ -6969,6 +6971,48 @@
 }
 
 /*
+ * Inserts an icon into the taskbar.
+ * Parameters:
+ *       handle: Window handle that will handle taskbar icon messages.
+ *       icon: Icon handle to display in the taskbar.
+ *       bubbletext: Text to show when the mouse is above the icon.
+ */
+void dw_taskbar_insert(HWND handle, unsigned long icon, char *bubbletext)
+{
+	NOTIFYICONDATA tnid;
+ 
+	tnid.cbSize = sizeof(NOTIFYICONDATA);
+	tnid.hWnd = handle;
+	tnid.uID = icon;
+	tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
+	tnid.uCallbackMessage = WM_USER+2;
+	tnid.hIcon = (HICON)icon;
+	if(bubbletext)
+		strncpy(tnid.szTip, bubbletext, sizeof(tnid.szTip));
+	else
+		tnid.szTip[0] = 0;
+
+	Shell_NotifyIcon(NIM_ADD, &tnid);
+}
+
+/*
+ * Deletes an icon from the taskbar.
+ * Parameters:
+ *       handle: Window handle that was used with dw_taskbar_insert().
+ *       icon: Icon handle that was used with dw_taskbar_insert().
+ */
+void dw_taskbar_delete(HWND handle, unsigned long icon)
+{
+	NOTIFYICONDATA tnid;
+
+	tnid.cbSize = sizeof(NOTIFYICONDATA);
+	tnid.hWnd = handle;
+	tnid.uID = icon;
+
+	Shell_NotifyIcon(NIM_DELETE, &tnid);
+}
+
+/*
  * Creates a rendering context widget (window) to be packed.
  * Parameters:
  *       id: An id to be used with dw_window_from_id.