changeset 161:c555d06b6c93

Allow tree-select signal to work on container controls.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 17 Nov 2002 11:51:30 +0000
parents 76bc6b4e8b79
children df59a3fc6de6
files os2/dw.c win/dw.c
diffstat 2 files changed, 50 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Thu Nov 14 18:49:20 2002 +0000
+++ b/os2/dw.c	Sun Nov 17 11:51:30 2002 +0000
@@ -2067,18 +2067,27 @@
 
 										if(pci && pre->fEmphasisMask & CRA_CURSORED && (pci->rc.flRecordAttr & CRA_CURSORED))
 										{
-											int (*treeselectfunc)(HWND, HWND, char *, void *, void *) = (int (*)(HWND, HWND, char *, void *, void *))tmp->signalfunction;
-
-											if(lasthcnr == tmp->window && lastitem == (HWND)pci)
+											if(dw_window_get_data(tmp->window, "_dw_container"))
 											{
-												lasthcnr = 0;
-												lastitem = 0;
+												int (*containerselectfunc)(HWND, char *, void *) = (int (*)(HWND, char *, void *))tmp->signalfunction;
+
+												result = containerselectfunc(tmp->window, pci->rc.pszIcon, tmp->data);
 											}
 											else
 											{
-												lasthcnr = tmp->window;
-												lastitem = (HWND)pci;
-												result = treeselectfunc(tmp->window, (HWND)pci, pci->rc.pszIcon, pci->user, tmp->data);
+												int (*treeselectfunc)(HWND, HWND, char *, void *, void *) = (int (*)(HWND, HWND, char *, void *, void *))tmp->signalfunction;
+
+												if(lasthcnr == tmp->window && lastitem == (HWND)pci)
+												{
+													lasthcnr = 0;
+													lastitem = 0;
+												}
+												else
+												{
+													lasthcnr = tmp->window;
+													lastitem = (HWND)pci;
+													result = treeselectfunc(tmp->window, (HWND)pci, pci->rc.pszIcon, pci->user, tmp->data);
+												}
 											}
 											tmp = NULL;
 										}
@@ -3794,6 +3803,7 @@
 	blah->oldproc = WinSubclassWindow(tmp, _TreeProc);
 	WinSetWindowPtr(tmp, QWP_USER, blah);
 	dw_window_set_font(tmp, DefaultFont);
+	dw_window_set_data(tmp, "_dw_container", (void *)1);
 	return tmp;
 }
 
--- a/win/dw.c	Thu Nov 14 18:49:20 2002 +0000
+++ b/win/dw.c	Sun Nov 17 11:51:30 2002 +0000
@@ -1347,6 +1347,38 @@
 									}
 								}
 							}
+							else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)==0)
+							{
+								if(tem->hdr.code == LVN_ITEMCHANGED && tmp->message == TVN_SELCHANGED)
+								{
+									if(tmp->window == tem->hdr.hwndFrom)
+									{
+										LV_ITEM lvi;
+										int iItem;
+
+										iItem = ListView_GetNextItem(tmp->window, -1, LVNI_FOCUSED);
+
+										memset(&lvi, 0, sizeof(LV_ITEM));
+
+										if(iItem > -1)
+										{
+											int (*containerselectfunc)(HWND, char *, void *) = tmp->signalfunction;
+
+											lvi.iItem = iItem;
+											lvi.mask = LVIF_PARAM;
+
+											ListView_GetItem(tmp->window, &lvi);
+
+											/* Seems to be having lParam as 1 which really sucks */
+											if(lvi.lParam < 100)
+												lvi.lParam = 0;
+
+											containerselectfunc(tmp->window, (char *)lvi.lParam, tmp->data);
+											tmp = NULL;
+										}
+									}
+								}
+							}
 						}
 					}
 					break;