changeset 481:97c2c560f829

Implemented the new tree functions and signal on Windows and exported the functions to the DLLs on Windows and OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 15 Oct 2003 18:24:31 +0000
parents 8832ad52486f
children 89b1b40d7e12
files dw.def dww.def win/dw.c
diffstat 3 files changed, 67 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/dw.def	Wed Oct 15 10:17:54 2003 +0000
+++ b/dw.def	Wed Oct 15 18:24:31 2003 +0000
@@ -218,6 +218,8 @@
   dw_tree_set_data                       @378
   dw_tree_insert_after                   @379
   dw_tree_get_data                       @380
+  dw_tree_get_title                      @381
+  dw_tree_get_parent                     @382
 
   dw_font_text_extents                   @385
 
--- a/dww.def	Wed Oct 15 10:17:54 2003 +0000
+++ b/dww.def	Wed Oct 15 18:24:31 2003 +0000
@@ -215,6 +215,8 @@
   dw_tree_set_data                       @378
   dw_tree_insert_after                   @379
   dw_tree_get_data                       @380
+  dw_tree_get_title                      @381
+  dw_tree_get_parent                     @382
 
   dw_font_text_extents                   @385
 
--- a/win/dw.c	Wed Oct 15 10:17:54 2003 +0000
+++ b/win/dw.c	Wed Oct 15 18:24:31 2003 +0000
@@ -94,25 +94,26 @@
 static int in_checkbox_handler = 0;
 
 /* List of signals and their equivilent Win32 message */
-#define SIGNALMAX 16
+#define SIGNALMAX 17
 
 SignalList SignalTranslate[SIGNALMAX] = {
-	{ WM_SIZE,        DW_SIGNAL_CONFIGURE },
-	{ WM_CHAR,        DW_SIGNAL_KEY_PRESS },
-	{ WM_LBUTTONDOWN, DW_SIGNAL_BUTTON_PRESS },
-	{ WM_LBUTTONUP,   DW_SIGNAL_BUTTON_PRESS },
-	{ WM_MOUSEMOVE,   DW_SIGNAL_MOTION_NOTIFY },
-	{ WM_CLOSE,       DW_SIGNAL_DELETE },
-	{ WM_PAINT,       DW_SIGNAL_EXPOSE },
-	{ WM_COMMAND,     DW_SIGNAL_CLICKED },
-	{ NM_DBLCLK,      DW_SIGNAL_ITEM_ENTER },
-	{ NM_RCLICK,      DW_SIGNAL_ITEM_CONTEXT },
-	{ LBN_SELCHANGE,  DW_SIGNAL_LIST_SELECT },
-	{ TVN_SELCHANGED, DW_SIGNAL_ITEM_SELECT },
-	{ WM_SETFOCUS,    DW_SIGNAL_SET_FOCUS },
-	{ WM_VSCROLL,     DW_SIGNAL_VALUE_CHANGED },
-	{ TCN_SELCHANGE,  DW_SIGNAL_SWITCH_PAGE },
-	{ LVN_COLUMNCLICK,DW_SIGNAL_COLUMN_CLICK }
+	{ WM_SIZE,         DW_SIGNAL_CONFIGURE },
+	{ WM_CHAR,         DW_SIGNAL_KEY_PRESS },
+	{ WM_LBUTTONDOWN,  DW_SIGNAL_BUTTON_PRESS },
+	{ WM_LBUTTONUP,    DW_SIGNAL_BUTTON_PRESS },
+	{ WM_MOUSEMOVE,    DW_SIGNAL_MOTION_NOTIFY },
+	{ WM_CLOSE,        DW_SIGNAL_DELETE },
+	{ WM_PAINT,        DW_SIGNAL_EXPOSE },
+	{ WM_COMMAND,      DW_SIGNAL_CLICKED },
+	{ NM_DBLCLK,       DW_SIGNAL_ITEM_ENTER },
+	{ NM_RCLICK,       DW_SIGNAL_ITEM_CONTEXT },
+	{ LBN_SELCHANGE,   DW_SIGNAL_LIST_SELECT },
+	{ TVN_SELCHANGED,  DW_SIGNAL_ITEM_SELECT },
+	{ WM_SETFOCUS,     DW_SIGNAL_SET_FOCUS },
+	{ WM_VSCROLL,      DW_SIGNAL_VALUE_CHANGED },
+	{ TCN_SELCHANGE,   DW_SIGNAL_SWITCH_PAGE },
+	{ LVN_COLUMNCLICK, DW_SIGNAL_COLUMN_CLICK },
+	{ TVN_ITEMEXPANDED,DW_SIGNAL_TREE_EXPAND }
 };
 
 #ifdef BUILD_DLL
@@ -1587,7 +1588,9 @@
 					break;
 				case WM_NOTIFY:
 					{
-						if(tmp->message == TVN_SELCHANGED || tmp->message == NM_RCLICK)
+						if(tmp->message == TVN_SELCHANGED ||
+						   tmp->message == NM_RCLICK ||
+						   tmp->message == TVN_ITEMEXPANDED)
 						{
 							NMTREEVIEW FAR *tem=(NMTREEVIEW FAR *)mp2;
 							char tmpbuf[100];
@@ -1600,7 +1603,7 @@
 								{
 									if(tmp->window == tem->hdr.hwndFrom && !dw_window_get_data(tmp->window, "_dw_select_item"))
 									{
-										int (*treeselectfunc)(HWND, HWND, char *, void *, void *) = tmp->signalfunction;
+										int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = tmp->signalfunction;
 										TVITEM tvi;
 										void **ptrs;
 
@@ -1611,8 +1614,18 @@
 
 										ptrs = (void **)tvi.lParam;
 										if(ptrs)
-											result = treeselectfunc(tmp->window, (HWND)tem->itemNew.hItem, (char *)ptrs[0], tmp->data, (void *)ptrs[1]);
-
+											result = treeselectfunc(tmp->window, tem->itemNew.hItem, (char *)ptrs[0], tmp->data, (void *)ptrs[1]);
+
+										tmp = NULL;
+									}
+								}
+								else if(tem->hdr.code == TVN_ITEMEXPANDED && tmp->message == TVN_ITEMEXPANDED)
+								{
+									if(tmp->window == tem->hdr.hwndFrom && tem->action == TVE_EXPAND)
+									{
+										int (*treeexpandfunc)(HWND, HTREEITEM, void *) = tmp->signalfunction;
+
+										result = treeexpandfunc(tmp->window, tem->itemNew.hItem, tmp->data);
 										tmp = NULL;
 									}
 								}
@@ -6183,6 +6196,35 @@
 }
 
 /*
+ * Gets the text an item in a tree window (widget).
+ * Parameters:
+ *          handle: Handle to the tree containing the item.
+ *          item: Handle of the item to be modified.
+ */
+char * API dw_tree_get_title(HWND handle, HTREEITEM item)
+{
+	TVITEM tvi;
+
+	tvi.mask = TVIF_HANDLE;
+	tvi.hItem = item;
+
+	if(TreeView_GetItem(handle, &tvi))
+		return tvi.pszText;
+    return NULL;
+}
+
+/*
+ * Gets the text an item in a tree window (widget).
+ * Parameters:
+ *          handle: Handle to the tree containing the item.
+ *          item: Handle of the item to be modified.
+ */
+HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item)
+{
+	return TreeView_GetParent(handle, item);
+}
+
+/*
  * Sets this item as the active selection.
  * Parameters:
  *       handle: Handle to the tree window (widget) to be selected.