From: <kr_...@us...> - 2003-08-17 19:28:00
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv17930/src/cbits/GTK Modified Files: Menu.c Log Message: Code clearing Index: Menu.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Menu.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Menu.c 16 Aug 2003 08:01:14 -0000 1.9 --- Menu.c 17 Aug 2003 19:27:57 -0000 1.10 *************** *** 206,282 **** void osDestroyMenu(MenuHandle handle) { ! GtkWidget *item, *menu; ! ! if (GTK_WIDGET_VISIBLE(handle)) ! gtk_widget_destroy(handle); ! else ! { ! menu = gtk_widget_get_parent(handle); ! ! for (;;) ! { ! GList *children = GTK_MENU_SHELL(menu)->children; ! ! while (children && children->data != handle) ! children = children->next; ! ! if (!children || !children->next) ! return; ! ! item = (GtkWidget *) children->next->data; ! ! if (!GTK_WIDGET_VISIBLE(item)) ! { ! gtk_widget_destroy(item); ! gtk_widget_destroy((GtkWidget *) children->data); ! return; ! } ! gtk_widget_destroy(item); ! } ! } } int osGetMenuItemCount(MenuHandle handle) { - BOOL b; int count; GList *children; - GtkWidget *menu; count = 0; ! ! if (!handle || GTK_WIDGET_VISIBLE(handle)) ! { ! menu = getMenu(handle); ! children = GTK_MENU_SHELL(menu)->children; ! ! b = TRUE; ! while (children) ! { ! if (b) count++; ! ! if (!GTK_WIDGET_VISIBLE((GtkWidget*) children->data)) ! { ! b = !b; ! } ! ! children = children->next; ! } ! } ! else { ! menu = gtk_widget_get_parent(handle); ! children = GTK_MENU_SHELL(menu)->children; ! ! while (children && children->data != handle) ! children = children->next; ! ! while (children && GTK_WIDGET_VISIBLE((GtkWidget *) children->data)) ! { ! count++; ! children = children->next; ! } ! ! count--; } --- 206,223 ---- void osDestroyMenu(MenuHandle handle) { ! gtk_widget_destroy(handle); } int osGetMenuItemCount(MenuHandle handle) { int count; GList *children; count = 0; ! children = GTK_MENU_SHELL(getMenu(handle))->children; ! while (children) { ! count++; ! children = children->next; } *************** *** 304,361 **** }; - void osSetMenuRadioGroupSelection(MenuHandle handle, int index) - { - GList *children; - GtkWidget *menu; - - menu = gtk_widget_get_parent(handle); - children = GTK_MENU_SHELL(menu)->children; - - while (children && children->data != handle) - children = children->next; - - if (!children || !children->next) - return; - - children = children->next; - while (children && GTK_WIDGET_VISIBLE((GtkWidget *) children->data) && index > 0) - { - index--; - children = children->next; - } - - if (children) - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM((GtkWidget *) children->data), TRUE); - } - - int osGetMenuRadioGroupSelection(MenuHandle handle) - { - int index; - GList *children; - GtkWidget *menu; - - menu = gtk_widget_get_parent(handle); - children = GTK_MENU_SHELL(menu)->children; - - while (children && children->data != handle) - children = children->next; - - if (!children || !children->next) - return -1; - - index = 0; - children = children->next; - while (children && GTK_WIDGET_VISIBLE((GtkWidget *) children->data)) - { - if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM((GtkWidget *) children->data))) - return index; - - index++; - children = children->next; - } - - return -1; - } - void osSetMenuLabel(MenuHandle item, char* title) { --- 245,248 ---- *************** *** 541,587 **** int osGetMenuItemPos(MenuHandle handle) { - BOOL b; int pos; GList *children; - GtkWidget *menu; pos = 0; ! menu = getMenu(handle); ! children = GTK_MENU_SHELL(menu)->children; ! ! ! if (GTK_IS_RADIO_MENU_ITEM(handle)) ! { ! while (children && children->data != handle) ! { ! if (GTK_WIDGET_VISIBLE((GtkWidget*) children->data)) ! pos++; ! else ! pos = 0; ! ! children = children->next; ! } ! } ! else { ! b = TRUE; ! while (children && children->data != handle) ! { ! if (GTK_WIDGET_VISIBLE((GtkWidget*) children->data)) ! { ! if (b) pos++; ! } ! else ! { ! b = !b; ! } ! ! children = children->next; ! } } ! if (!children) pos = -1; ! ! return pos; } - --- 428,442 ---- int osGetMenuItemPos(MenuHandle handle) { int pos; GList *children; pos = 0; ! children = GTK_MENU_SHELL(getMenu(handle))->children; ! while (children && children->data != handle) { ! pos++; ! children = children->next; } ! return (children ? pos : -1); } |