Minor fixes to comments.
[AROS.git] / rom / intuition / onmenu.c
blobfcc3a3c00ab1ad2c16b35131e1b58141e7c6b32a
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include "intuition_intern.h"
9 /*****************************************************************************
11 NAME */
12 #include <intuition/intuition.h>
14 AROS_LH2(void, OnMenu,
16 /* SYNOPSIS */
17 AROS_LHA(struct Window *, window, A0),
18 AROS_LHA(UWORD , menunumber, D0),
20 /* LOCATION */
21 struct IntuitionBase *, IntuitionBase, 32, Intuition)
23 /* FUNCTION
24 Enable a whole menu, an item or a sub-item depending on
25 the menunumber.
27 INPUTS
28 window - The window, the menu belongs to
29 menunumber - The packed information on what piece of menu to enable
31 RESULT
32 None.
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 OffMenu(), ResetMenuStrip()
43 INTERNALS
45 HISTORY
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 int i;
52 struct Menu * thismenu;
53 struct MenuItem * thisitem;
55 DEBUG_ONMENU(dprintf("OnMenu: Window 0x%lx MenuNumber 0x%lx\n", window, menunumber));
57 SANITY_CHECK(window)
59 IntuitionBase = IntuitionBase; /* shut up the compiler */
61 thismenu = window->MenuStrip;
63 if (MENUNUM(menunumber) != NOMENU)
65 for (i = 0; i < MENUNUM(menunumber) && thismenu; i++)
67 thismenu = thismenu->NextMenu;
70 if (thismenu)
72 if (ITEMNUM(menunumber) == NOITEM)
74 thismenu->Flags |= MENUENABLED;
76 else
78 thisitem = thismenu->FirstItem;
80 for (i = 0; i < ITEMNUM(menunumber) && thisitem; i++)
82 thisitem = thisitem->NextItem;
85 if (thisitem)
87 if (SUBNUM(menunumber) != NOSUB && thisitem->SubItem)
89 thisitem = thisitem->SubItem;
91 for (i = 0; i < SUBNUM(menunumber) && thisitem; i++)
93 thisitem = thisitem->NextItem;
98 if (thisitem)
100 thisitem->Flags |= ITEMENABLED;
104 } /* if (thismenu) */
106 } /* if (MENUNUM(menunumber) != NOMENU) */
108 AROS_LIBFUNC_EXIT
109 } /* OnMenu */