2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Free memory allocated by CreateMenusA()
8 #include <proto/exec.h>
9 #include "gadtools_intern.h"
11 /*********************************************************************
14 #include <proto/gadtools.h>
15 #include <intuition/intuition.h>
17 AROS_LH1(VOID
, FreeMenus
,
20 AROS_LHA(struct Menu
*, menu
, A0
),
23 struct Library
*, GadToolsBase
, 9, GadTools
)
26 Frees the menus allocated by CreateMenusA().
29 menu - pointer to the menu (or first MenuItem) to be freed, may be NULL.
46 ***************************************************************************/
51 DEBUG_FREEMENUS(bug("FreeMenus: menu %p\n", menu
));
53 * ULONG BarLabelTable[BarLabelCount]
55 * ULONG Menu==0|Item!=0
60 ULONG
*p
= (ULONG
*)menu
- 1;
64 DEBUG_FREEMENUS(bug("FreeMenus: p 0x%lx\n", *p
));
65 DEBUG_FREEMENUS(bug("FreeMenus: NextMenu 0x%lx\n", menu
->NextMenu
));
66 DEBUG_FREEMENUS(bug("FreeMenus: Left %ld Top %ld Width %ld Height %ld\n", menu
->LeftEdge
,menu
->TopEdge
,menu
->Width
,menu
->Height
));
67 DEBUG_FREEMENUS(bug("FreeMenus: Flags 0x%lx\n", menu
->Flags
));
68 DEBUG_FREEMENUS(bug("FreeMenus: MenuName <%s> FirstItem 0x%lx\n", menu
->MenuName
,menu
->FirstItem
));
72 * p points now on BarLabelCount
75 DEBUG_FREEMENUS(bug("FreeMenus: BarLabels %ld\n", BarLabels
));
76 for (i
=0;i
<BarLabels
;i
++)
80 DEBUG_FREEMENUS(bug("FreeMenus: Free Image 0x%lx\n", *p
));
81 DisposeObject((APTR
) *p
);
84 DEBUG_FREEMENUS(bug("FreeMenus: Free MenuMem 0x%lx\n", p
));
87 DEBUG_FREEMENUS(bug("FreeMenus: done\n"));
95 DEBUG_FREEMENUS(bug("FreeMenus: menu %p\n", menu
));
100 ULONG
*p
= (ULONG
*)menu
- 1;
102 DEBUG_FREEMENUS(bug("FreeMenus: NextMenu 0x%lx\n", menu
->NextMenu
));
103 DEBUG_FREEMENUS(bug("FreeMenus: Left %ld Top %ld Width %ld Height %ld\n", menu
->LeftEdge
,menu
->TopEdge
,menu
->Width
,menu
->Height
));
104 DEBUG_FREEMENUS(bug("FreeMenus: Flags 0x%lx\n", menu
->Flags
));
105 DEBUG_FREEMENUS(bug("FreeMenus: MenuName <%s> FirstItem 0x%lx\n", menu
->MenuName
,menu
->FirstItem
));
107 * Check if we are freeing a Menu or a MenuItem list.
111 DEBUG_FREEMENUS(bug("FreeMenus: menuitem list\n"));
112 freeitems((struct MenuItem
*)menu
, (struct GadToolsBase_intern
*)GadToolsBase
);
116 DEBUG_FREEMENUS(bug("FreeMenus: menu list\n"));
121 _menu
= menu
->NextMenu
;
122 DEBUG_FREEMENUS(bug("FreeMenus: menu 0x%lx nextmenu 0x%lx\n",menu
,_menu
));
125 ** Free all items and subitems of this menu title
127 DEBUG_FREEMENUS(bug("FreeMenus: freeitems\n"));
128 freeitems(menu
->FirstItem
, (struct GadToolsBase_intern
*)GadToolsBase
);
130 DEBUG_FREEMENUS(bug("FreeMenus: menu 0x%lx size %ld\n",p
,sizeof(ULONG
) + sizeof(struct Menu
) + sizeof(APTR
)));
131 FreeMem(p
, sizeof(ULONG
) + sizeof(struct Menu
) + sizeof(APTR
));
134 p
= (ULONG
*)menu
- 1;
138 DEBUG_FREEMENUS(bug("FreeMenus: done\n"));