3 /* Copyright Massachusetts Institute of Technology 1985 */
6 * XMenu: MIT Project Athena, X Window system menu package
8 * XMenuRecompute - Recompute XMenu object dependencies.
10 * Author: Tony Della Fera, DEC
18 XMenuRecompute(display
, menu
)
20 register XMenu
*menu
; /* Menu object to be recomputed. */
22 register XMPane
*p_ptr
; /* Pane pointer. */
23 register XMSelect
*s_ptr
; /* Selection pointer. */
25 register int p_num
; /* Pane serial number. */
26 register int s_num
; /* Selection serial number. */
29 * If there are no panes in the menu then return failure
30 * because the menu is not initialized.
32 if (menu
->p_count
== 0) {
33 _XMErrorCode
= XME_NOT_INIT
;
38 * Recompute menu wide global values: pane window size,
39 * selection size and maximum selection count.
41 _XMRecomputeGlobals(display
, menu
);
44 * For each pane in the menu...
49 p_ptr
= menu
->p_list
->next
;
50 p_ptr
!= menu
->p_list
;
54 * Recompute pane dependencies.
56 if (_XMRecomputePane(display
, menu
, p_ptr
, p_num
) == _FAILURE
) {
62 * For each selection in the pane...
66 s_ptr
= p_ptr
->s_list
->next
;
67 s_ptr
!= p_ptr
->s_list
;
71 * Recompute selection dependencies.
73 if (_XMRecomputeSelection(display
, menu
, s_ptr
, s_num
) == _FAILURE
) {
81 * Recompute menu size.
83 if (menu
->menu_style
== CENTER
) {
84 menu
->width
= menu
->p_width
+ (menu
->p_bdr_width
<< 1);
87 menu
->width
= menu
->p_width
+ (menu
->p_bdr_width
<< 1) +
88 ((menu
->p_count
- 1) * menu
->p_x_off
);
90 menu
->height
= menu
->p_height
+ (menu
->p_bdr_width
<< 1) +
91 ((menu
->p_count
- 1) * menu
->p_y_off
);
94 * Reset the recompute flag.
99 * Return successfully.
101 _XMErrorCode
= XME_NO_ERROR
;
105 /* arch-tag: 1fe99b82-3873-4aab-b2b3-f277c93e00d9
106 (do not change this comment) */