Commit a2dcfd1d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move DrawMenuBar implementation from user32.

parent 2c7b8e00
......@@ -4367,28 +4367,9 @@ HMENU WINAPI GetSubMenu( HMENU hMenu, INT nPos )
/**********************************************************************
* DrawMenuBar (USER32.@)
*/
BOOL WINAPI DrawMenuBar( HWND hWnd )
BOOL WINAPI DrawMenuBar( HWND hwnd )
{
HMENU hMenu;
if (!IsWindow( hWnd ))
return FALSE;
if (is_win_menu_disallowed(hWnd))
return TRUE;
if ((hMenu = GetMenu( hWnd )))
{
POPUPMENU *menu = grab_menu_ptr(hMenu);
if (menu)
{
menu->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
menu->hwndOwner = hWnd;
release_menu_ptr(menu);
}
}
return NtUserSetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
return NtUserDrawMenuBar( hwnd );
}
/***********************************************************************
......
......@@ -196,6 +196,11 @@ static POPUPMENU *find_menu_item( HMENU handle, UINT id, UINT flags, UINT *pos )
return menu;
}
static BOOL is_win_menu_disallowed( HWND hwnd )
{
return (get_window_long(hwnd, GWL_STYLE) & (WS_CHILD | WS_POPUP)) == WS_CHILD;
}
/* see GetMenu */
HMENU get_menu( HWND hwnd )
{
......@@ -319,3 +324,26 @@ BOOL WINAPI NtUserEnableMenuItem( HMENU handle, UINT id, UINT flags )
return oldflags;
}
/* see DrawMenuBar */
BOOL draw_menu_bar( HWND hwnd )
{
HMENU handle;
if (!is_window( hwnd )) return FALSE;
if (is_win_menu_disallowed( hwnd )) return TRUE;
if ((handle = get_menu( hwnd )))
{
POPUPMENU *menu = grab_menu_ptr( handle );
if (menu)
{
menu->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */
menu->hwndOwner = hwnd;
release_menu_ptr( menu );
}
}
return NtUserSetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED );
}
......@@ -355,6 +355,7 @@ extern BOOL set_foreground_window( HWND hwnd, BOOL mouse ) DECLSPEC_HIDDEN;
/* menu.c */
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;
/* message.c */
......
......@@ -5069,6 +5069,9 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code )
case NtUserCallHwnd_ArrangeIconicWindows:
return arrange_iconic_windows( hwnd );
case NtUserCallHwnd_DrawMenuBar:
return draw_menu_bar( hwnd );
case NtUserCallHwnd_GetDpiForWindow:
return get_dpi_for_window( hwnd );
......
......@@ -777,6 +777,7 @@ static inline BOOL NtUserUnhookWindowsHook( INT id, HOOKPROC proc )
enum
{
NtUserCallHwnd_ArrangeIconicWindows,
NtUserCallHwnd_DrawMenuBar,
NtUserCallHwnd_GetDpiForWindow,
NtUserCallHwnd_GetParent,
NtUserCallHwnd_GetWindowContextHelpId,
......@@ -793,6 +794,11 @@ static inline UINT NtUserArrangeIconicWindows( HWND parent )
return NtUserCallHwnd( parent, NtUserCallHwnd_ArrangeIconicWindows );
}
static inline BOOL NtUserDrawMenuBar( HWND hwnd )
{
return NtUserCallHwnd( hwnd, NtUserCallHwnd_DrawMenuBar );
}
static inline DWORD NtUserGetWindowContextHelpId( HWND hwnd )
{
return NtUserCallHwnd( hwnd, NtUserCallHwnd_GetWindowContextHelpId );
......
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