| 1 | #include "copyright.h" |
| 2 | |
| 3 | /* Copyright Massachusetts Institute of Technology 1985 */ |
| 4 | |
| 5 | /* |
| 6 | * XMenu: MIT Project Athena, X Window system menu package |
| 7 | * |
| 8 | * XMenuDeleteSelection - Deletes a selection from an XMenu object. |
| 9 | * |
| 10 | * Author: Tony Della Fera, DEC |
| 11 | * 20-Nov-85 |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #include "XMenuInt.h" |
| 16 | |
| 17 | int |
| 18 | XMenuDeleteSelection(display, menu, p_num, s_num) |
| 19 | register Display *display; /* Previously opened display. */ |
| 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 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 | * Find the right selection. |
| 35 | */ |
| 36 | s_ptr = _XMGetSelectionPtr(p_ptr, s_num); |
| 37 | if (s_ptr == NULL) return(XM_FAILURE); |
| 38 | |
| 39 | /* |
| 40 | * Remove the selection from the association table. |
| 41 | */ |
| 42 | XDeleteAssoc(display, menu->assoc_tab, s_ptr->window); |
| 43 | |
| 44 | /* |
| 45 | * Remove the selection from the parent pane's selection |
| 46 | * list and update the selection count. |
| 47 | */ |
| 48 | emacs_remque(s_ptr); |
| 49 | p_ptr->s_count--; |
| 50 | |
| 51 | /* |
| 52 | * Destroy the selection transparency. |
| 53 | */ |
| 54 | if (s_ptr->window) XDestroyWindow(display, s_ptr->window); |
| 55 | |
| 56 | /* |
| 57 | * Free the selection's XMSelect structure. |
| 58 | */ |
| 59 | free(s_ptr); |
| 60 | |
| 61 | /* |
| 62 | * Schedule a recompute. |
| 63 | */ |
| 64 | menu->recompute = 1; |
| 65 | |
| 66 | /* |
| 67 | * Return the selection number just deleted. |
| 68 | */ |
| 69 | _XMErrorCode = XME_NO_ERROR; |
| 70 | return(s_num); |
| 71 | } |
| 72 | |
| 73 | /* arch-tag: 24ca2bc7-8a37-471a-8095-e6363fc1ed10 |
| 74 | (do not change this comment) */ |