grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / intuition / offmenu.c
blob586c64712c0a8c11c5835fb4950c878d885a9b19
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, OffMenu,
16 /* SYNOPSIS */
17 AROS_LHA(struct Window *, window, A0),
18 AROS_LHA(UWORD , menunumber, D0),
20 /* LOCATION */
21 struct IntuitionBase *, IntuitionBase, 30, Intuition)
23 /* FUNCTION
24 Disable 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 disable
31 RESULT
32 None.
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 OnMenu(), ResetMenuStrip()
43 INTERNALS
45 *****************************************************************************/
47 AROS_LIBFUNC_INIT
49 int i;
50 struct Menu *thismenu;
51 struct MenuItem *thisitem;
53 DEBUG_OFFMENU(dprintf("OffMenu: Window 0x%lx MenuNumber 0x%lx\n", window, menunumber));
55 IntuitionBase = IntuitionBase; /* shut up the compiler */
57 thismenu = window->MenuStrip;
59 if (MENUNUM(menunumber) != NOMENU)
61 for (i = 0; i < MENUNUM(menunumber) && thismenu; i++)
63 thismenu = thismenu->NextMenu;
66 if (thismenu)
68 if (ITEMNUM(menunumber) == NOITEM)
70 thismenu->Flags &= ~MENUENABLED;
72 else
74 thisitem = thismenu->FirstItem;
76 for (i = 0; i < ITEMNUM(menunumber) && thisitem; i++)
78 thisitem = thisitem->NextItem;
81 if (thisitem)
83 if (SUBNUM(menunumber) != NOSUB && thisitem->SubItem)
85 thisitem = thisitem->SubItem;
86 for (i = 0; i < SUBNUM(menunumber) && thisitem; i++)
88 thisitem = thisitem->NextItem;
93 if (thisitem)
95 thisitem->Flags &= ~ITEMENABLED;
99 } /* if (thismenu) */
101 } /* if (MENUNUM(menunumber) != NOMENU) */
103 AROS_LIBFUNC_EXIT
104 } /* OffMenu */