1: #include <X/mit-copyright.h>
   2: 
   3: /* $Header: XMenuDelSel.c,v 10.8 86/02/01 16:14:47 tony Rel $ */
   4: /* Copyright    Massachusetts Institute of Technology    1985	*/
   5: 
   6: /*
   7:  * XMenu:	MIT Project Athena, X Window system menu package
   8:  *
   9:  * 	XMenuDeleteSelection - Deletes a selection 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: XMenuDeleteSelection(menu, p_num, s_num)
  20:     register XMenu *menu;   /* Menu object to be modified. */
  21:     register int p_num;     /* Pane number to be deleted. */
  22:     register int s_num;     /* Selection number to be deleted. */
  23: {
  24:     register int i;     /* Loop index. */
  25:     register XMPane *p_ptr; /* Pointer to pane being deleted. */
  26:     register XMSelect *s_ptr;   /* Pointer to selections being deleted. */
  27: 
  28:     /*
  29:      * Find the right pane.
  30:      */
  31:     p_ptr = _XMGetPanePtr(menu, p_num);
  32:     if (p_ptr == NULL) return(XM_FAILURE);
  33: 
  34:     /*
  35:      * Find the right selection.
  36:      */
  37:     s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
  38:     if (s_ptr == NULL) return(XM_FAILURE);
  39: 
  40:     /*
  41:      * Remove the selection from the association table.
  42:      */
  43:     XDeleteAssoc(menu->assoc_tab, s_ptr->window);
  44: 
  45:     /*
  46:      * Remove the selection from the parent pane's selection
  47:      * list and update the selection count.
  48:      */
  49:     remque(s_ptr);
  50:     p_ptr->s_count--;
  51: 
  52:     /*
  53:      * Destroy the selection transparency.
  54:      */
  55:     if (s_ptr->window) XDestroyWindow(s_ptr->window);
  56: 
  57:     /*
  58:      * Free the selection's XMSelect structure.
  59:      */
  60:     free(s_ptr);
  61: 
  62:     /*
  63:      * Schedule a recompute.
  64:      */
  65:     menu->recompute = 1;
  66: 
  67:     /*
  68:      * Return the selection number just deleted.
  69:      */
  70:     _XMErrorCode = XME_NO_ERROR;
  71:     return(s_num);
  72: }

Defined functions

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