Commit | Line | Data |
---|---|---|
e745ede7 DL |
1 | #include "copyright.h" |
2 | ||
e745ede7 | 3 | /* Copyright Massachusetts Institute of Technology 1985 */ |
61e1e4e8 | 4 | /* Copyright (C) 2001, 2002, 2003, 2004, 2005, |
4e6835db | 5 | 2006, 2007 Free Software Foundation, Inc. */ |
e745ede7 DL |
6 | |
7 | /* | |
8 | * XMenu: MIT Project Athena, X Window system menu package | |
9 | * | |
10 | * XMenuDeletePane - Deletes a pane from an XMenu object. | |
11 | * | |
12 | * Author: Tony Della Fera, DEC | |
13 | * 20-Nov-85 | |
14 | * | |
15 | */ | |
16 | ||
17 | #include "XMenuInt.h" | |
18 | ||
19 | int | |
20 | XMenuDeletePane(display, menu, p_num) | |
21 | register Display *display; /* Previously opened display */ | |
22 | register XMenu *menu; /* Menu object to be modified. */ | |
23 | register int p_num; /* Pane number to be deleted. */ | |
24 | { | |
25 | register XMPane *p_ptr; /* Pointer to pane being deleted. */ | |
26 | register XMSelect *s_ptr; /* Pointer to selections being deleted. */ | |
27 | register XMSelect *s_next; /* Pointer to next selection to be deleted. */ | |
177c0ea7 | 28 | |
e745ede7 DL |
29 | /* |
30 | * Find the right pane. | |
31 | */ | |
32 | p_ptr = _XMGetPanePtr(menu, p_num); | |
33 | if (p_ptr == NULL) return(XM_FAILURE); | |
34 | ||
35 | /* | |
36 | * Remove the pane from the association table. | |
37 | */ | |
38 | XDeleteAssoc(display, menu->assoc_tab, p_ptr->window); | |
39 | ||
40 | /* | |
41 | * Remove the pane from the pane list and update | |
42 | * the pane count. | |
43 | */ | |
44 | emacs_remque(p_ptr); | |
45 | menu->p_count--; | |
46 | ||
47 | /* | |
48 | * Remove all the selections in the pane from the | |
49 | * association table and free their XMSelect structures. | |
50 | */ | |
51 | for ( | |
177c0ea7 | 52 | s_ptr = p_ptr->s_list->next; |
e745ede7 DL |
53 | s_ptr != p_ptr->s_list; |
54 | s_ptr = s_next | |
55 | ) { | |
56 | XDeleteAssoc(display, menu->assoc_tab, s_ptr->window); | |
57 | s_next = s_ptr->next; | |
58 | free(s_ptr); | |
59 | } | |
60 | free(p_ptr->s_list); | |
61 | ||
62 | if (p_ptr->window) { | |
63 | /* | |
64 | * Destroy the selection transparencies. | |
65 | */ | |
66 | XDestroySubwindows(display, p_ptr->window); | |
177c0ea7 | 67 | |
e745ede7 DL |
68 | /* |
69 | * Destroy the pane window. | |
70 | */ | |
71 | XDestroyWindow(display, p_ptr->window); | |
72 | } | |
177c0ea7 | 73 | |
e745ede7 DL |
74 | /* |
75 | * Free the pane's XMPane structure. | |
76 | */ | |
77 | free(p_ptr); | |
78 | ||
79 | /* | |
80 | * Schedule a recompute. | |
81 | */ | |
82 | menu->recompute = 1; | |
83 | ||
84 | /* | |
85 | * Return the pane number just deleted. | |
86 | */ | |
87 | _XMErrorCode = XME_NO_ERROR; | |
88 | return(p_num); | |
89 | } | |
ab5796a9 MB |
90 | |
91 | /* arch-tag: 32a5bfd4-4bac-4090-bb53-844110f4908e | |
92 | (do not change this comment) */ |