Mercurial > dwindows
diff gtk/dw.c @ 1373:bad3e17ab6e5
Implemented dw_menu_delete_item() for GTK.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 22 Nov 2011 21:10:56 +0000 |
parents | 2f5e54b0c5c4 |
children | d5c1ce21577e |
line wrap: on
line diff
--- a/gtk/dw.c Tue Nov 22 20:55:14 2011 +0000 +++ b/gtk/dw.c Tue Nov 22 21:10:56 2011 +0000 @@ -3939,6 +3939,38 @@ } /* + * 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 menu, unsigned long id) +{ + char numbuf[11]; + GtkWidget *tmphandle; + int _locked_by_me = FALSE; + int ret = DW_ERROR_UNKNOWN; + + if(!menu || !id) + return ret; + + DW_MUTEX_LOCK; + snprintf(numbuf, 10, "%lu", id); + tmphandle = _find_submenu_id(menu, numbuf); + + if(tmphandle) + { + gtk_widget_destroy(tmphandle); + gtk_object_set_data(GTK_OBJECT(menu), numbuf, NULL) + ret = DW_ERROR_NONE; + } + DW_MUTEX_UNLOCK; + return ret; +} + +/* * Pops up a context menu at given x and y coordinates. * Parameters: * menu: The handle the the existing menu.