revert between 56095 -> 55830 in arch
[AROS.git] / rom / intuition / onmenu.c
blob83c206f5bdf562059ce3112ea1538f4027314934
1 /*
2 Copyright © 1995-2013, 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 *****************************************************************************/
47 AROS_LIBFUNC_INIT
49 int i;
50 struct Menu * thismenu;
51 struct MenuItem * thisitem;
53 DEBUG_ONMENU(dprintf("OnMenu: Window 0x%lx MenuNumber 0x%lx\n", window, menunumber));
55 SANITY_CHECK(window)
57 IntuitionBase = IntuitionBase; /* shut up the compiler */
59 thismenu = window->MenuStrip;
61 if (MENUNUM(menunumber) != NOMENU)
63 for (i = 0; i < MENUNUM(menunumber) && thismenu; i++)
65 thismenu = thismenu->NextMenu;
68 if (thismenu)
70 if (ITEMNUM(menunumber) == NOITEM)
72 thismenu->Flags |= MENUENABLED;
74 else
76 thisitem = thismenu->FirstItem;
78 for (i = 0; i < ITEMNUM(menunumber) && thisitem; i++)
80 thisitem = thisitem->NextItem;
83 if (thisitem)
85 if (SUBNUM(menunumber) != NOSUB && thisitem->SubItem)
87 thisitem = thisitem->SubItem;
89 for (i = 0; i < SUBNUM(menunumber) && thisitem; i++)
91 thisitem = thisitem->NextItem;
96 if (thisitem)
98 thisitem->Flags |= ITEMENABLED;
102 } /* if (thismenu) */
104 } /* if (MENUNUM(menunumber) != NOMENU) */
106 AROS_LIBFUNC_EXIT
107 } /* OnMenu */