Mercurial > dwindows
diff os2/dw.c @ 1371:896347a9be19
Initial versions of dw_menu_delete_item() on OS/2 and Windows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 22 Nov 2011 20:46:37 +0000 |
parents | a595e368a393 |
children | 8e27dd96a97e |
line wrap: on
line diff
--- a/os2/dw.c Sun Nov 20 16:34:44 2011 +0000 +++ b/os2/dw.c Tue Nov 22 20:46:37 2011 +0000 @@ -4351,12 +4351,27 @@ */ int API dw_window_destroy(HWND handle) { - HWND frame, menu, parent = WinQueryWindow(handle, QW_PARENT); - Box *thisbox = WinQueryWindowPtr(parent, QWP_USER); + HWND frame, menu, parent; + Box *thisbox; if(!handle) - return -1; - + return DW_ERROR_UNKNOWN; + + /* Handle special case for menu handle */ + if(handle < 65536) + { + char buffer[30]; + + sprintf(buffer, "_dw_id%ld", handle); + menu = dw_window_get_data(hwndApp, buffer); + + if(menu && WinIsWindow(dwhab, menu)) + return dw_menu_delete_item((HEMNUI)menu, handle); + return DW_ERROR_UNKNOWN; + } + + parent = WinQueryWindow(handle, QW_PARENT); + thisbox = WinQueryWindowPtr(parent, QWP_USER); frame = (HWND)dw_window_get_data(handle, "_dw_combo_box"); if((menu = WinWindowFromID(handle, FID_MENU)) != NULLHANDLE) @@ -5198,6 +5213,24 @@ } /* + * Deletes the menu item specified + * Parameters: + * menu: The handle to the menu in which the item was appended. + * id: Menuitem id. + * Returns: + * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. + */ +int API dw_menu_delete_item(HMENUI menux, unsigned long id) +{ + if(id < 65536) + { + WinSendMsg(menux, MM_DELETEITEM, MPFROM2SHORT(id, FALSE), 0); + return DW_ERROR_NONE; + } + return DW_ERROR_UNKNOWN; +} + +/* * Pops up a context menu at given x and y coordinates. * Parameters: * menu: The handle the the existing menu.