3 /* Copyright Massachusetts Institute of Technology 1985 */
4 /* Copyright (C) 2002, 2003, 2004, 2005,
5 2006 Free Software Foundation, Inc. */
8 * XMenu: MIT Project Athena, X Window system menu package
10 * XMenuRecompute - Recompute XMenu object dependencies.
12 * Author: Tony Della Fera, DEC
20 XMenuRecompute(display
, menu
)
22 register XMenu
*menu
; /* Menu object to be recomputed. */
24 register XMPane
*p_ptr
; /* Pane pointer. */
25 register XMSelect
*s_ptr
; /* Selection pointer. */
27 register int p_num
; /* Pane serial number. */
28 register int s_num
; /* Selection serial number. */
31 * If there are no panes in the menu then return failure
32 * because the menu is not initialized.
34 if (menu
->p_count
== 0) {
35 _XMErrorCode
= XME_NOT_INIT
;
40 * Recompute menu wide global values: pane window size,
41 * selection size and maximum selection count.
43 _XMRecomputeGlobals(display
, menu
);
46 * For each pane in the menu...
51 p_ptr
= menu
->p_list
->next
;
52 p_ptr
!= menu
->p_list
;
56 * Recompute pane dependencies.
58 if (_XMRecomputePane(display
, menu
, p_ptr
, p_num
) == _FAILURE
) {
64 * For each selection in the pane...
68 s_ptr
= p_ptr
->s_list
->next
;
69 s_ptr
!= p_ptr
->s_list
;
73 * Recompute selection dependencies.
75 if (_XMRecomputeSelection(display
, menu
, s_ptr
, s_num
) == _FAILURE
) {
83 * Recompute menu size.
85 if (menu
->menu_style
== CENTER
) {
86 menu
->width
= menu
->p_width
+ (menu
->p_bdr_width
<< 1);
89 menu
->width
= menu
->p_width
+ (menu
->p_bdr_width
<< 1) +
90 ((menu
->p_count
- 1) * menu
->p_x_off
);
92 menu
->height
= menu
->p_height
+ (menu
->p_bdr_width
<< 1) +
93 ((menu
->p_count
- 1) * menu
->p_y_off
);
96 * Reset the recompute flag.
101 * Return successfully.
103 _XMErrorCode
= XME_NO_ERROR
;
107 /* arch-tag: 1fe99b82-3873-4aab-b2b3-f277c93e00d9
108 (do not change this comment) */