Modified CreateMenu() and DestroyMenu()

svn path=/trunk/; revision=5349
This commit is contained in:
Thomas Bluemel 2003-07-31 23:06:43 +00:00
parent 7cedf407f1
commit a765936fc3

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: menu.c,v 1.11 2003/07/28 08:09:51 ekohl Exp $ /* $Id: menu.c,v 1.12 2003/07/31 23:06:43 weiden Exp $
* *
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/menu.c * FILE: lib/user32/windows/menu.c
@ -139,11 +139,11 @@ MenuInit(VOID)
return(TRUE); return(TRUE);
} }
static BOOL /*static BOOL
MenuIsMenu(PPOPUP_MENU Menu) MenuIsMenu(PPOPUP_MENU Menu)
{ {
return(Menu->Magic == MENU_MAGIC); return(Menu->Magic == MENU_MAGIC);
} }*/
static PPOPUP_MENU static PPOPUP_MENU
MenuGetMenu(HMENU hMenu) MenuGetMenu(HMENU hMenu)
@ -311,13 +311,7 @@ CheckMenuRadioItem(HMENU hmenu,
HMENU STDCALL HMENU STDCALL
CreateMenu(VOID) CreateMenu(VOID)
{ {
PPOPUP_MENU Menu; return NtUserCreateMenu();
Menu = HeapAlloc(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POPUP_MENU));
Menu->Magic = MENU_MAGIC;
Menu->FocusedItem = NO_SELECTED_ITEM;
return (HMENU)Menu;
} }
@ -371,48 +365,12 @@ MenuFreeItemData(PMENUITEM Item)
} }
/* /*
* @unimplemented * @implemented
*/ */
WINBOOL STDCALL WINBOOL STDCALL
DestroyMenu(HMENU hMenu) DestroyMenu(HMENU hMenu)
{ {
PPOPUP_MENU Menu; return NtUserDestroyMenu(hMenu);
if (hMenu == NULL || hMenu == hMenuDefSysPopup)
{
return(FALSE);
}
Menu = MenuGetMenu(hMenu);
if (hTopPopupWnd != NULL && hMenu == (HMENU)GetWindowLong(hTopPopupWnd, 0))
{
SetWindowLong(hTopPopupWnd, 0, 0);
}
if (!MenuIsMenu(Menu))
{
return(FALSE);
}
if ((Menu->Flags & MF_POPUP) && (Menu->hWnd != NULL) &&
(hTopPopupWnd == NULL || Menu->hWnd != hTopPopupWnd))
{
DestroyWindow(Menu->hWnd);
}
if (Menu->Items != NULL)
{
PMENUITEM Item = Menu->Items;
ULONG i;
for (i = Menu->NrItems; i > 0; i--, Item++)
{
if (Item->TypeData & MF_POPUP)
{
DestroyMenu(Item->SubMenu);
}
MenuFreeItemData(Item);
}
HeapFree(GetProcessHeap(), 0, Menu->Items);
}
HeapFree(GetProcessHeap(), 0, Menu);
return(TRUE);
} }
@ -1124,8 +1082,7 @@ STDCALL
SetMenuContextHelpId(HMENU hmenu, SetMenuContextHelpId(HMENU hmenu,
DWORD dwContextHelpId) DWORD dwContextHelpId)
{ {
UNIMPLEMENTED; return NtUserSetMenuContextHelpId(hmenu, dwContextHelpId);
return(FALSE);
} }