Recursively search sub menus when a command id is specified

svn path=/trunk/; revision=8340
This commit is contained in:
Gé van Geldorp 2004-02-23 21:18:45 +00:00
parent b320e099ed
commit 1092faa446

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.48 2004/02/22 23:40:58 gvg Exp $ /* $Id: menu.c,v 1.49 2004/02/23 21:18:45 gvg Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -507,11 +507,13 @@ IntSetMenuInfo(PMENU_OBJECT MenuObject, PROSMENUINFO lpmi)
int FASTCALL int FASTCALL
IntGetMenuItemByFlag(PMENU_OBJECT MenuObject, UINT uSearchBy, UINT fFlag, IntGetMenuItemByFlag(PMENU_OBJECT MenuObject, UINT uSearchBy, UINT fFlag,
PMENU_ITEM *MenuItem, PMENU_ITEM *PrevMenuItem) PMENU_ITEM *MenuItem, PMENU_ITEM *PrevMenuItem)
{ {
PMENU_ITEM PrevItem = NULL; PMENU_ITEM PrevItem = NULL;
PMENU_ITEM CurItem = MenuObject->MenuItemList; PMENU_ITEM CurItem = MenuObject->MenuItemList;
int p; int p;
int ret;
if(MF_BYPOSITION & fFlag) if(MF_BYPOSITION & fFlag)
{ {
p = uSearchBy; p = uSearchBy;
@ -546,6 +548,21 @@ IntGetMenuItemByFlag(PMENU_OBJECT MenuObject, UINT uSearchBy, UINT fFlag,
if(PrevMenuItem) *PrevMenuItem = PrevItem; if(PrevMenuItem) *PrevMenuItem = PrevItem;
return p; return p;
} }
else if (0 != (CurItem->fType & MF_POPUP))
{
MenuObject = IntGetMenuObject(CurItem->hSubMenu);
if (NULL != MenuObject)
{
ret = IntGetMenuItemByFlag(MenuObject, uSearchBy, fFlag,
MenuItem, PrevMenuItem);
if (-1 != ret)
{
IntReleaseMenuObject(MenuObject);
return ret;
}
}
IntReleaseMenuObject(MenuObject);
}
PrevItem = CurItem; PrevItem = CurItem;
CurItem = CurItem->Next; CurItem = CurItem->Next;
p++; p++;