1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XMenuDelPane.c,v 10.8 86/02/01 16:14:44 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: /*
   7:  * XMenu:	MIT Project Athena, X Window system menu package
   8:  *
   9:  * 	XMenuDeletePane - Deletes a pane from an XMenu object.
  10:  *
  11:  *	Author:		Tony Della Fera, DEC
  12:  *			20-Nov-85
  13:  *
  14:  */
  15: 
  16: #include "XMenuInternal.h"
  17: 
  18: int
  19: XMenuDeletePane(menu, p_num)
  20:     register XMenu *menu;   /* Menu object to be modified. */
  21:     register int p_num;     /* Pane number to be deleted. */
  22: {
  23:     register int i;     /* Loop index. */
  24:     register XMPane *p_ptr; /* Pointer to pane being deleted. */
  25:     register XMSelect *s_ptr;   /* Pointer to selections being deleted. */
  26: 
  27:     /*
  28:      * Find the right pane.
  29:      */
  30:     p_ptr = _XMGetPanePtr(menu, p_num);
  31:     if (p_ptr == NULL) return(XM_FAILURE);
  32: 
  33:     /*
  34:      * Remove the pane from the association table.
  35:      */
  36:     XDeleteAssoc(menu->assoc_tab, p_ptr->window);
  37: 
  38:     /*
  39:      * Remove the pane from the pane list and update
  40:      * the pane count.
  41:      */
  42:     remque(p_ptr);
  43:     menu->p_count--;
  44: 
  45:     /*
  46:      * Remove all the selections in the pane from the
  47:      * association table and free their XMSelect structures.
  48:      */
  49:     s_ptr = p_ptr->s_list;
  50:     for (i = 0; i < p_ptr->s_count; i++) {
  51:     XDeleteAssoc(menu->assoc_tab, s_ptr->prev->window);
  52:     free(s_ptr->prev);
  53:     s_ptr = s_ptr->next;
  54:     }
  55:     free(s_ptr);
  56: 
  57:     if (p_ptr->window) {
  58:     /*
  59: 	 * Destroy the selection transparencies.
  60: 	 */
  61:     XDestroySubwindows(p_ptr->window);
  62: 
  63:     /*
  64: 	 * Destroy the pane window.
  65: 	 */
  66:     XDestroyWindow(p_ptr->window);
  67:     }
  68: 
  69:     /*
  70:      * Free the pane's XMPane structure.
  71:      */
  72:     free(p_ptr);
  73: 
  74:     /*
  75:      * Schedule a recompute.
  76:      */
  77:     menu->recompute = 1;
  78: 
  79:     /*
  80:      * Return the pane number just deleted.
  81:      */
  82:     _XMErrorCode = XME_NO_ERROR;
  83:     return(p_num);
  84: }

Defined functions

Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 942
Valid CSS Valid XHTML 1.0 Strict