root/oldXMenu/DelPane.c

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

DEFINITIONS

This source file includes following definitions.
  1. XMenuDeletePane

     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  *      XMenuDeletePane - Deletes a pane 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 XMenuDeletePane(register Display *display, register XMenu *menu, register int p_num)
    38                                 /* Previously opened display */
    39                                 /* Menu object to be modified. */
    40                                 /* Pane number to be deleted. */
    41 {
    42     register XMPane *p_ptr;     /* Pointer to pane being deleted. */
    43     register XMSelect *s_ptr;   /* Pointer to selections being deleted. */
    44     register XMSelect *s_next;  /* Pointer to next selection to be 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      * Remove the pane from the association table.
    54      */
    55     XDeleteAssoc(display, menu->assoc_tab, p_ptr->window);
    56 
    57     /*
    58      * Remove the pane from the pane list and update
    59      * the pane count.
    60      */
    61     emacs_remque(p_ptr);
    62     menu->p_count--;
    63 
    64     /*
    65      * Remove all the selections in the pane from the
    66      * association table and free their XMSelect structures.
    67      */
    68     for (
    69         s_ptr = p_ptr->s_list->next;
    70         s_ptr != p_ptr->s_list;
    71         s_ptr = s_next
    72     ) {
    73         XDeleteAssoc(display, menu->assoc_tab, s_ptr->window);
    74         s_next = s_ptr->next;
    75         free(s_ptr);
    76     }
    77     free(p_ptr->s_list);
    78 
    79     if (p_ptr->window) {
    80         /*
    81          * Destroy the selection transparencies.
    82          */
    83         XDestroySubwindows(display, p_ptr->window);
    84 
    85         /*
    86          * Destroy the pane window.
    87          */
    88         XDestroyWindow(display, p_ptr->window);
    89     }
    90 
    91     /*
    92      * Free the pane's XMPane structure.
    93      */
    94     free(p_ptr);
    95 
    96     /*
    97      * Schedule a recompute.
    98      */
    99     menu->recompute = 1;
   100 
   101     /*
   102      * Return the pane number just deleted.
   103      */
   104     _XMErrorCode = XME_NO_ERROR;
   105     return(p_num);
   106 }
   107 

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