comparison win/dw.c @ 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 fc0341624711
children d6e07d292145
comparison
equal deleted inserted replaced
480:8832ad52486f 481:97c2c560f829
92 } SignalList; 92 } SignalList;
93 93
94 static int in_checkbox_handler = 0; 94 static int in_checkbox_handler = 0;
95 95
96 /* List of signals and their equivilent Win32 message */ 96 /* List of signals and their equivilent Win32 message */
97 #define SIGNALMAX 16 97 #define SIGNALMAX 17
98 98
99 SignalList SignalTranslate[SIGNALMAX] = { 99 SignalList SignalTranslate[SIGNALMAX] = {
100 { WM_SIZE, DW_SIGNAL_CONFIGURE }, 100 { WM_SIZE, DW_SIGNAL_CONFIGURE },
101 { WM_CHAR, DW_SIGNAL_KEY_PRESS }, 101 { WM_CHAR, DW_SIGNAL_KEY_PRESS },
102 { WM_LBUTTONDOWN, DW_SIGNAL_BUTTON_PRESS }, 102 { WM_LBUTTONDOWN, DW_SIGNAL_BUTTON_PRESS },
103 { WM_LBUTTONUP, DW_SIGNAL_BUTTON_PRESS }, 103 { WM_LBUTTONUP, DW_SIGNAL_BUTTON_PRESS },
104 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY }, 104 { WM_MOUSEMOVE, DW_SIGNAL_MOTION_NOTIFY },
105 { WM_CLOSE, DW_SIGNAL_DELETE }, 105 { WM_CLOSE, DW_SIGNAL_DELETE },
106 { WM_PAINT, DW_SIGNAL_EXPOSE }, 106 { WM_PAINT, DW_SIGNAL_EXPOSE },
107 { WM_COMMAND, DW_SIGNAL_CLICKED }, 107 { WM_COMMAND, DW_SIGNAL_CLICKED },
108 { NM_DBLCLK, DW_SIGNAL_ITEM_ENTER }, 108 { NM_DBLCLK, DW_SIGNAL_ITEM_ENTER },
109 { NM_RCLICK, DW_SIGNAL_ITEM_CONTEXT }, 109 { NM_RCLICK, DW_SIGNAL_ITEM_CONTEXT },
110 { LBN_SELCHANGE, DW_SIGNAL_LIST_SELECT }, 110 { LBN_SELCHANGE, DW_SIGNAL_LIST_SELECT },
111 { TVN_SELCHANGED, DW_SIGNAL_ITEM_SELECT }, 111 { TVN_SELCHANGED, DW_SIGNAL_ITEM_SELECT },
112 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS }, 112 { WM_SETFOCUS, DW_SIGNAL_SET_FOCUS },
113 { WM_VSCROLL, DW_SIGNAL_VALUE_CHANGED }, 113 { WM_VSCROLL, DW_SIGNAL_VALUE_CHANGED },
114 { TCN_SELCHANGE, DW_SIGNAL_SWITCH_PAGE }, 114 { TCN_SELCHANGE, DW_SIGNAL_SWITCH_PAGE },
115 { LVN_COLUMNCLICK,DW_SIGNAL_COLUMN_CLICK } 115 { LVN_COLUMNCLICK, DW_SIGNAL_COLUMN_CLICK },
116 { TVN_ITEMEXPANDED,DW_SIGNAL_TREE_EXPAND }
116 }; 117 };
117 118
118 #ifdef BUILD_DLL 119 #ifdef BUILD_DLL
119 void Win32_Set_Instance(HINSTANCE hInstance) 120 void Win32_Set_Instance(HINSTANCE hInstance)
120 { 121 {
1585 } 1586 }
1586 } 1587 }
1587 break; 1588 break;
1588 case WM_NOTIFY: 1589 case WM_NOTIFY:
1589 { 1590 {
1590 if(tmp->message == TVN_SELCHANGED || tmp->message == NM_RCLICK) 1591 if(tmp->message == TVN_SELCHANGED ||
1592 tmp->message == NM_RCLICK ||
1593 tmp->message == TVN_ITEMEXPANDED)
1591 { 1594 {
1592 NMTREEVIEW FAR *tem=(NMTREEVIEW FAR *)mp2; 1595 NMTREEVIEW FAR *tem=(NMTREEVIEW FAR *)mp2;
1593 char tmpbuf[100]; 1596 char tmpbuf[100];
1594 1597
1595 GetClassName(tem->hdr.hwndFrom, tmpbuf, 99); 1598 GetClassName(tem->hdr.hwndFrom, tmpbuf, 99);
1598 { 1601 {
1599 if(tem->hdr.code == TVN_SELCHANGED && tmp->message == TVN_SELCHANGED) 1602 if(tem->hdr.code == TVN_SELCHANGED && tmp->message == TVN_SELCHANGED)
1600 { 1603 {
1601 if(tmp->window == tem->hdr.hwndFrom && !dw_window_get_data(tmp->window, "_dw_select_item")) 1604 if(tmp->window == tem->hdr.hwndFrom && !dw_window_get_data(tmp->window, "_dw_select_item"))
1602 { 1605 {
1603 int (*treeselectfunc)(HWND, HWND, char *, void *, void *) = tmp->signalfunction; 1606 int (*treeselectfunc)(HWND, HTREEITEM, char *, void *, void *) = tmp->signalfunction;
1604 TVITEM tvi; 1607 TVITEM tvi;
1605 void **ptrs; 1608 void **ptrs;
1606 1609
1607 tvi.mask = TVIF_HANDLE; 1610 tvi.mask = TVIF_HANDLE;
1608 tvi.hItem = tem->itemNew.hItem; 1611 tvi.hItem = tem->itemNew.hItem;
1609 1612
1610 TreeView_GetItem(tmp->window, &tvi); 1613 TreeView_GetItem(tmp->window, &tvi);
1611 1614
1612 ptrs = (void **)tvi.lParam; 1615 ptrs = (void **)tvi.lParam;
1613 if(ptrs) 1616 if(ptrs)
1614 result = treeselectfunc(tmp->window, (HWND)tem->itemNew.hItem, (char *)ptrs[0], tmp->data, (void *)ptrs[1]); 1617 result = treeselectfunc(tmp->window, tem->itemNew.hItem, (char *)ptrs[0], tmp->data, (void *)ptrs[1]);
1615 1618
1619 tmp = NULL;
1620 }
1621 }
1622 else if(tem->hdr.code == TVN_ITEMEXPANDED && tmp->message == TVN_ITEMEXPANDED)
1623 {
1624 if(tmp->window == tem->hdr.hwndFrom && tem->action == TVE_EXPAND)
1625 {
1626 int (*treeexpandfunc)(HWND, HTREEITEM, void *) = tmp->signalfunction;
1627
1628 result = treeexpandfunc(tmp->window, tem->itemNew.hItem, tmp->data);
1616 tmp = NULL; 1629 tmp = NULL;
1617 } 1630 }
1618 } 1631 }
1619 else if(tem->hdr.code == NM_RCLICK && tmp->message == NM_RCLICK) 1632 else if(tem->hdr.code == NM_RCLICK && tmp->message == NM_RCLICK)
1620 { 1633 {
6181 } 6194 }
6182 return NULL; 6195 return NULL;
6183 } 6196 }
6184 6197
6185 /* 6198 /*
6199 * Gets the text an item in a tree window (widget).
6200 * Parameters:
6201 * handle: Handle to the tree containing the item.
6202 * item: Handle of the item to be modified.
6203 */
6204 char * API dw_tree_get_title(HWND handle, HTREEITEM item)
6205 {
6206 TVITEM tvi;
6207
6208 tvi.mask = TVIF_HANDLE;
6209 tvi.hItem = item;
6210
6211 if(TreeView_GetItem(handle, &tvi))
6212 return tvi.pszText;
6213 return NULL;
6214 }
6215
6216 /*
6217 * Gets the text an item in a tree window (widget).
6218 * Parameters:
6219 * handle: Handle to the tree containing the item.
6220 * item: Handle of the item to be modified.
6221 */
6222 HTREEITEM API dw_tree_get_parent(HWND handle, HTREEITEM item)
6223 {
6224 return TreeView_GetParent(handle, item);
6225 }
6226
6227 /*
6186 * Sets this item as the active selection. 6228 * Sets this item as the active selection.
6187 * Parameters: 6229 * Parameters:
6188 * handle: Handle to the tree window (widget) to be selected. 6230 * handle: Handle to the tree window (widget) to be selected.
6189 * item: Handle to the item to be selected. 6231 * item: Handle to the item to be selected.
6190 */ 6232 */