win32u: Move GetMenuItemCount implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-14 16:28:06 +02:00 committed by Alexandre Julliard
parent 1899cd2a9e
commit bad82953db
5 changed files with 26 additions and 10 deletions

View File

@ -3696,17 +3696,9 @@ UINT WINAPI GetMenuState( HMENU menu, UINT item, UINT flags )
/**********************************************************************
* GetMenuItemCount (USER32.@)
*/
INT WINAPI GetMenuItemCount( HMENU hMenu )
INT WINAPI GetMenuItemCount( HMENU menu )
{
POPUPMENU *menu = grab_menu_ptr(hMenu);
INT count;
if (!menu) return -1;
count = menu->nItems;
release_menu_ptr(menu);
TRACE("(%p) returning %d\n", hMenu, count);
return count;
return NtUserGetMenuItemCount( menu );
}

View File

@ -864,6 +864,20 @@ UINT WINAPI NtUserThunkedMenuItemInfo( HMENU handle, UINT pos, UINT flags, UINT
return ret;
}
/* see GetMenuItemCount */
INT get_menu_item_count( HMENU handle )
{
POPUPMENU *menu;
INT count;
if (!(menu = grab_menu_ptr( handle ))) return -1;
count = menu->nItems;
release_menu_ptr(menu);
TRACE( "(%p) returning %d\n", handle, count );
return count;
}
/**********************************************************************
* NtUserRemoveMenu (win32u.@)
*/

View File

@ -4718,6 +4718,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
case NtUserCallOneParam_GetIconParam:
return get_icon_param( UlongToHandle(arg) );
case NtUserCallOneParam_GetMenuItemCount:
return get_menu_item_count( UlongToHandle(arg) );
case NtUserCallOneParam_GetSysColor:
return get_sys_color( arg );

View File

@ -377,6 +377,7 @@ extern HMENU create_menu( BOOL is_popup ) DECLSPEC_HIDDEN;
extern BOOL draw_menu_bar( HWND hwnd ) DECLSPEC_HIDDEN;
extern HMENU get_menu( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL get_menu_info( HMENU handle, MENUINFO *info ) DECLSPEC_HIDDEN;
extern INT get_menu_item_count( HMENU handle ) DECLSPEC_HIDDEN;
extern BOOL set_window_menu( HWND hwnd, HMENU handle ) DECLSPEC_HIDDEN;
/* message.c */

View File

@ -704,6 +704,7 @@ enum
NtUserCallOneParam_GetClipCursor,
NtUserCallOneParam_GetCursorPos,
NtUserCallOneParam_GetIconParam,
NtUserCallOneParam_GetMenuItemCount,
NtUserCallOneParam_GetPrimaryMonitorRect,
NtUserCallOneParam_GetSysColor,
NtUserCallOneParam_GetSysColorBrush,
@ -773,6 +774,11 @@ static inline UINT_PTR NtUserGetIconParam( HICON icon )
return NtUserCallOneParam( HandleToUlong(icon), NtUserCallOneParam_GetIconParam );
}
static inline UINT_PTR NtUserGetMenuItemCount( HMENU menu )
{
return NtUserCallOneParam( HandleToUlong(menu), NtUserCallOneParam_GetMenuItemCount );
}
static inline RECT NtUserGetPrimaryMonitorRect(void)
{
RECT primary;