check for the existence of /usr/include on darwin and warn about if it is missing
[AROS.git] / rom / intuition / itemaddress.c
blob6891da24cddf11cbd5d0448d1c8ae0fd4f94f12c
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 #define DEBUG_ITEMADDRESS(x) ;
10 #define DEBUG_ITEMADDRESS2(x) ;
12 /*****************************************************************************
14 NAME */
15 #include <proto/intuition.h>
17 AROS_LH2(struct MenuItem *, ItemAddress,
19 /* SYNOPSIS */
20 AROS_LHA(struct Menu *, menustrip, A0),
21 AROS_LHA(UWORD , menunumber, D0),
23 /* LOCATION */
24 struct IntuitionBase *, IntuitionBase, 24, Intuition)
26 /* FUNCTION
27 Returns the address of the menuitem 'menunumber' of 'menustrip'.
28 The number is the one you get from intuition after the user has
29 selected a menu.
30 The menunumber must be well-defined.
31 Valid numbers are MENUNULL, which makes the routine return NULL,
32 or valid item number of your menustrip, which contains
33 - a valid menu number
34 - a valid item number
35 - if the menu-item has a sub-item, a valid sub-item number
36 Menu number and item number must be specified. Sub-item, if
37 available, is optional, therefore this function returns either
38 the item or sub-item.
40 INPUTS
41 menustrip - Pointer to the first menu of the menustrip.
42 menunumber - Packed value describing the menu, item and if
43 appropriate sub-item.
45 RESULT
46 Returns NULL for menunumber == MENUNULL or the address of the
47 menuitem described by menunumber.
49 NOTES
51 EXAMPLE
53 BUGS
55 SEE ALSO
57 INTERNALS
59 *****************************************************************************/
61 AROS_LIBFUNC_INIT
63 struct Menu *thismenu;
64 struct MenuItem *thisitem = NULL;
65 int i;
67 DEBUG_ITEMADDRESS(dprintf("ItemAddress: Strip %p Number 0x%lx (%d/%d/%d)\n",
68 menustrip, menunumber, MENUNUM(menunumber),
69 ITEMNUM(menunumber), SUBNUM(menunumber)));
71 IntuitionBase = IntuitionBase; /* shut up the compiler */
73 SANITY_CHECKR(menustrip,NULL)
75 if ( menunumber != MENUNULL )
77 thismenu = menustrip;
78 DEBUG_ITEMADDRESS2(dprintf("ItemAddress: Menu %p\n", thismenu));
80 for ( i = 0 ; thismenu && i < MENUNUM ( menunumber ) ; i++ )
82 thismenu = thismenu->NextMenu;
83 DEBUG_ITEMADDRESS2(dprintf("ItemAddress: Menu %p\n", thismenu));
86 if (thismenu)
88 thisitem = thismenu->FirstItem;
89 DEBUG_ITEMADDRESS2(dprintf("ItemAddress: Item %p\n", thisitem));
91 for ( i = 0 ; thisitem && i < ITEMNUM ( menunumber ) ; i++ )
93 thisitem = thisitem->NextItem;
94 DEBUG_ITEMADDRESS2(dprintf("ItemAddress: Item %p\n", thisitem));
97 if (thisitem && ( SUBNUM ( menunumber ) != NOSUB ) && thisitem->SubItem )
99 thisitem = thisitem->SubItem;
100 DEBUG_ITEMADDRESS2(dprintf("ItemAddress: SubItem %p\n", thisitem));
102 for ( i = 0 ; thisitem && i < SUBNUM ( menunumber ) ; i++ )
104 DEBUG_ITEMADDRESS2(dprintf("ItemAddress: SubItem %p\n", thisitem));
105 thisitem = thisitem->NextItem;
111 DEBUG_ITEMADDRESS(dprintf("ItemAddress: return %p\n", thisitem));
113 return thisitem;
115 AROS_LIBFUNC_EXIT
116 } /* ItemAddress */