Commit 1899cd2a authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move GetMenuState implementation from user32.

parent d366ef51
......@@ -3687,37 +3687,9 @@ BOOL WINAPI HiliteMenuItem( HWND hWnd, HMENU hMenu, UINT wItemID,
/**********************************************************************
* GetMenuState (USER32.@)
*/
UINT WINAPI GetMenuState( HMENU hMenu, UINT wItemID, UINT wFlags )
UINT WINAPI GetMenuState( HMENU menu, UINT item, UINT flags )
{
POPUPMENU *menu;
UINT state, pos;
MENUITEM *item;
TRACE("(menu=%p, id=%04x, flags=%04x);\n", hMenu, wItemID, wFlags);
if (!(menu = find_menu_item(hMenu, wItemID, wFlags, &pos)))
return -1;
item = &menu->items[pos];
debug_print_menuitem (" item: ", item, "");
if (item->fType & MF_POPUP)
{
POPUPMENU *submenu = grab_menu_ptr(item->hSubMenu);
if (submenu)
state = (submenu->nItems << 8) | ((item->fState | item->fType) & 0xff);
else
state = -1;
release_menu_ptr(submenu);
}
else
{
/* We used to (from way back then) mask the result to 0xff. */
/* I don't know why and it seems wrong as the documented */
/* return flag MF_SEPARATOR is outside that mask. */
state = (item->fType | item->fState);
}
release_menu_ptr(menu);
return state;
return NtUserThunkedMenuItemInfo( menu, item, flags, NtUserGetMenuState, NULL, NULL );
}
......
......@@ -772,6 +772,37 @@ static BOOL set_menu_item_info( MENUITEM *menu, const MENUITEMINFOW *info )
return TRUE;
}
/* see GetMenuState */
static UINT get_menu_state( HMENU handle, UINT item_id, UINT flags )
{
POPUPMENU *menu;
UINT state, pos;
MENUITEM *item;
TRACE( "(menu=%p, id=%04x, flags=%04x);\n", handle, item_id, flags );
if (!(menu = find_menu_item( handle, item_id, flags, &pos )))
return -1;
item = &menu->items[pos];
TRACE( " item: %s\n", debugstr_menuitem( item ));
if (item->fType & MF_POPUP)
{
POPUPMENU *submenu = grab_menu_ptr( item->hSubMenu );
if (submenu)
state = (submenu->nItems << 8) | ((item->fState | item->fType) & 0xff);
else
state = -1;
release_menu_ptr( submenu );
}
else
{
state = item->fType | item->fState;
}
release_menu_ptr(menu);
return state;
}
/**********************************************************************
* NtUserThunkedMenuItemInfo (win32u.@)
*/
......@@ -822,6 +853,9 @@ UINT WINAPI NtUserThunkedMenuItemInfo( HMENU handle, UINT pos, UINT flags, UINT
release_menu_ptr(menu);
break;
case NtUserGetMenuState:
return get_menu_state( handle, pos, flags );
default:
FIXME( "unsupported method %u\n", method );
return FALSE;
......
......@@ -183,6 +183,8 @@ enum
{
NtUserSetMenuItemInfo,
NtUserInsertMenuItem,
/* Wine extensions */
NtUserGetMenuState,
};
struct send_message_timeout_params
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment