|
|
1.1 ! root 1: #include <X/mit-copyright.h> ! 2: ! 3: /* $Header: XMenuDestroy.c,v 10.7 86/05/15 16:26:40 tony Rel $ */ ! 4: /* Copyright Massachusetts Institute of Technology 1985 */ ! 5: ! 6: /* ! 7: * XMenu: MIT Project Athena, X Window system menu package ! 8: * ! 9: * XMenuDestroy - Free all resources associated with and XMenu. ! 10: * ! 11: * Author: Tony Della Fera, DEC ! 12: * August, 1985 ! 13: * ! 14: */ ! 15: ! 16: #include "XMenuInternal.h" ! 17: ! 18: XMenuDestroy(menu) ! 19: register XMenu *menu; /* Menu object to destroy. */ ! 20: { ! 21: register XMPane *p_ptr; /* Pointer to the current pane. */ ! 22: register XMPane *p_next; /* Pointer to the next pane. */ ! 23: register XMSelect *s_ptr; /* Pointer to the current selection. */ ! 24: register XMSelect *s_next; /* Pointer to the next selection. */ ! 25: ! 26: /* ! 27: * Destroy the selection and pane X windows and free ! 28: * their corresponding XMWindows. ! 29: */ ! 30: for ( ! 31: p_ptr = menu->p_list->next; ! 32: p_ptr != menu->p_list; ! 33: p_ptr = p_next ! 34: ) { ! 35: for ( ! 36: s_ptr = p_ptr->s_list->next; ! 37: s_ptr != p_ptr->s_list; ! 38: s_ptr = s_next ! 39: ) { ! 40: s_next = s_ptr->next; ! 41: free(s_ptr); ! 42: } ! 43: if (p_ptr->window) { ! 44: XDestroySubwindows(p_ptr->window); ! 45: XDestroyWindow(p_ptr->window); ! 46: } ! 47: p_next = p_ptr->next; ! 48: free(p_ptr); ! 49: } ! 50: ! 51: /* ! 52: * Destroy the association table. ! 53: */ ! 54: XDestroyAssocTable(menu->assoc_tab); ! 55: ! 56: /* ! 57: * Free the mouse cursor. ! 58: */ ! 59: XFreeCursor(menu->mouse_cursor); ! 60: ! 61: /* ! 62: * Free the fonts. ! 63: */ ! 64: XFreeFont(menu->p_fnt_info->id); ! 65: XFreeFont(menu->s_fnt_info->id); ! 66: ! 67: /* ! 68: * Free the pixmaps. ! 69: */ ! 70: XFreePixmap(menu->p_bdr_pixmap); ! 71: XFreePixmap(menu->s_bdr_pixmap); ! 72: XFreePixmap(menu->p_frg_pixmap); ! 73: XFreePixmap(menu->s_frg_pixmap); ! 74: XFreePixmap(menu->bkgnd_pixmap); ! 75: XFreePixmap(menu->inact_pixmap); ! 76: ! 77: /* ! 78: * Free the color cells. ! 79: */ ! 80: if ((menu->p_bdr_color != BlackPixel) && (menu->p_bdr_color != WhitePixel)) ! 81: XFreeColors(&menu->p_bdr_color, 1, 0); ! 82: if ((menu->s_bdr_color != BlackPixel) && (menu->s_bdr_color != WhitePixel)) ! 83: XFreeColors(&menu->s_bdr_color, 1, 0); ! 84: if ((menu->p_frg_color != BlackPixel) && (menu->p_frg_color != WhitePixel)) ! 85: XFreeColors(&menu->p_frg_color, 1, 0); ! 86: if ((menu->s_frg_color != BlackPixel) && (menu->s_frg_color != WhitePixel)) ! 87: XFreeColors(&menu->s_frg_color, 1, 0); ! 88: if ((menu->bkgnd_color != BlackPixel) && (menu->bkgnd_color != WhitePixel)) ! 89: XFreeColors(&menu->bkgnd_color, 1, 0); ! 90: ! 91: /* ! 92: * Free the XMenu. ! 93: */ ! 94: free(menu); ! 95: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.