root/oldXMenu/DelSel.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. XMenuDeleteSelection

     1 /* Copyright    Massachusetts Institute of Technology    1985   */
     2 
     3 /*
     4 
     5 Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology
     6 
     7 Permission to use, copy, modify, and distribute this
     8 software and its documentation for any purpose and without
     9 fee is hereby granted, provided that the above copyright
    10 notice appear in all copies and that both that copyright
    11 notice and this permission notice appear in supporting
    12 documentation, and that the name of M.I.T. not be used in
    13 advertising or publicity pertaining to distribution of the
    14 software without specific, written prior permission.
    15 M.I.T. makes no representations about the suitability of
    16 this software for any purpose.  It is provided "as is"
    17 without express or implied warranty.
    18 
    19 */
    20 
    21 
    22 
    23 
    24 /*
    25  * XMenu:       MIT Project Athena, X Window system menu package
    26  *
    27  *      XMenuDeleteSelection - Deletes a selection from an XMenu object.
    28  *
    29  *      Author:         Tony Della Fera, DEC
    30  *                      20-Nov-85
    31  *
    32  */
    33 
    34 #include "XMenuInt.h"
    35 
    36 int
    37 XMenuDeleteSelection(register Display *display, register XMenu *menu, register int p_num, register int s_num)
    38                                 /* Previously opened display. */
    39                                 /* Menu object to be modified. */
    40                                 /* Pane number to be deleted. */
    41                                 /* Selection number to be deleted. */
    42 {
    43     register XMPane *p_ptr;     /* Pointer to pane being deleted. */
    44     register XMSelect *s_ptr;   /* Pointer to selections being deleted. */
    45 
    46     /*
    47      * Find the right pane.
    48      */
    49     p_ptr = _XMGetPanePtr(menu, p_num);
    50     if (p_ptr == NULL) return(XM_FAILURE);
    51 
    52     /*
    53      * Find the right selection.
    54      */
    55     s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
    56     if (s_ptr == NULL) return(XM_FAILURE);
    57 
    58     /*
    59      * Remove the selection from the association table.
    60      */
    61     XDeleteAssoc(display, menu->assoc_tab, s_ptr->window);
    62 
    63     /*
    64      * Remove the selection from the parent pane's selection
    65      * list and update the selection count.
    66      */
    67     emacs_remque(s_ptr);
    68     p_ptr->s_count--;
    69 
    70     /*
    71      * Destroy the selection transparency.
    72      */
    73     if (s_ptr->window) XDestroyWindow(display, s_ptr->window);
    74 
    75     /*
    76      * Free the selection's XMSelect structure.
    77      */
    78     free(s_ptr);
    79 
    80     /*
    81      * Schedule a recompute.
    82      */
    83     menu->recompute = 1;
    84 
    85     /*
    86      * Return the selection number just deleted.
    87      */
    88     _XMErrorCode = XME_NO_ERROR;
    89     return(s_num);
    90 }
    91 

/* [<][>][^][v][top][bottom][index][help] */