1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XMenuDestroy.c,v 10.6 86/02/01 16:14:50 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; /* Pane pointer. */
  22:     register XMSelect *s_ptr;   /* Selection pointer. */
  23: 
  24:     register int i;     /* Loop counter. */
  25:     register int j;     /* Loop counter. */
  26: 
  27:     /*
  28:      * Destroy the selection and pane X windows and free
  29:      * their corresponding XMWindows.
  30:      */
  31:     for (
  32:     p_ptr = menu->p_list->next;
  33:     p_ptr != menu->p_list;
  34:     p_ptr = p_ptr->next
  35:     ) {
  36:     for (
  37:         s_ptr = p_ptr->s_list->next;
  38:         s_ptr != p_ptr->s_list;
  39:         s_ptr = s_ptr->next
  40:     ) {
  41:         free(s_ptr);
  42:     }
  43:     if (p_ptr->window) {
  44:         XDestroySubwindows(p_ptr->window);
  45:         XDestroyWindow(p_ptr->window);
  46:     }
  47:     free(p_ptr);
  48:     }
  49: 
  50:     /*
  51:      * Destroy the association table.
  52:      */
  53:     XDestroyAssocTable(menu->assoc_tab);
  54: 
  55:     /*
  56:      * Free the mouse cursor.
  57:      */
  58:     XFreeCursor(menu->mouse_cursor);
  59: 
  60:     /*
  61:      * Free the fonts.
  62:      */
  63:     XFreeFont(menu->p_fnt_info->id);
  64:     XFreeFont(menu->s_fnt_info->id);
  65: 
  66:     /*
  67:      * Free the pixmaps.
  68:      */
  69:     XFreePixmap(menu->p_bdr_pixmap);
  70:     XFreePixmap(menu->s_bdr_pixmap);
  71:     XFreePixmap(menu->p_frg_pixmap);
  72:     XFreePixmap(menu->s_frg_pixmap);
  73:     XFreePixmap(menu->bkgnd_pixmap);
  74:     XFreePixmap(menu->inact_pixmap);
  75: 
  76:     /*
  77:      * Free the color cells.
  78:      */
  79:     if ((menu->p_bdr_color != BlackPixel) && (menu->p_bdr_color != WhitePixel))
  80:     XFreeColors(&menu->p_bdr_color, 1, 0);
  81:     if ((menu->s_bdr_color != BlackPixel) && (menu->s_bdr_color != WhitePixel))
  82:     XFreeColors(&menu->s_bdr_color, 1, 0);
  83:     if ((menu->p_frg_color != BlackPixel) && (menu->p_frg_color != WhitePixel))
  84:     XFreeColors(&menu->p_frg_color, 1, 0);
  85:     if ((menu->s_frg_color != BlackPixel) && (menu->s_frg_color != WhitePixel))
  86:     XFreeColors(&menu->s_frg_color, 1, 0);
  87:     if ((menu->bkgnd_color != BlackPixel) && (menu->bkgnd_color != WhitePixel))
  88:     XFreeColors(&menu->bkgnd_color, 1, 0);
  89: 
  90:     /*
  91:      * Free the XMenu.
  92:      */
  93:     free(menu);
  94: }
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1031
Valid CSS Valid XHTML 1.0 Strict