- Force recalulation size of menu items when new item is added.

- Make MDI injected icons working.
- Minor corrections to menu code size handling.

svn path=/trunk/; revision=9366
This commit is contained in:
Filip Navara 2004-05-13 20:21:27 +00:00
parent 5c60bbb820
commit 83c27bebc6
3 changed files with 24 additions and 8 deletions

View file

@ -1091,7 +1091,7 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild )
WND* child = WIN_FindWndPtr(hChild); WND* child = WIN_FindWndPtr(hChild);
#endif #endif
HMENU hSysPopup = 0; HMENU hSysPopup = 0;
HBITMAP hSysMenuBitmap = 0; HBITMAP hSysMenuBitmap = 0;
TRACE("frame %p,child %p\n",frame,hChild); TRACE("frame %p,child %p\n",frame,hChild);
@ -1120,10 +1120,9 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild )
SC_RESTORE, (LPSTR)(DWORD)HBMMENU_MBAR_RESTORE ); SC_RESTORE, (LPSTR)(DWORD)HBMMENU_MBAR_RESTORE );
/* In Win 95 look, the system menu is replaced by the child icon */ /* In Win 95 look, the system menu is replaced by the child icon */
/* FIXME */
#ifndef __REACTOS__ #ifndef __REACTOS__
if(TWEAK_WineLook > WIN31_LOOK) if(TWEAK_WineLook > WIN31_LOOK)
#endif
{ {
HICON hIcon = (HICON)GetClassLongA(hChild, GCL_HICONSM); HICON hIcon = (HICON)GetClassLongA(hChild, GCL_HICONSM);
if (!hIcon) if (!hIcon)
@ -1154,6 +1153,7 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild )
} }
} }
} }
#ifndef __REACTOS__
else else
hSysMenuBitmap = hBmpClose; hSysMenuBitmap = hBmpClose;
#endif #endif

View file

@ -21,7 +21,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.65 2004/05/03 22:16:09 gvg Exp $ /* $Id: menu.c,v 1.66 2004/05/13 20:21:27 navaraf Exp $
* *
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/menu.c * FILE: lib/user32/windows/menu.c
@ -436,8 +436,9 @@ MenuGetBitmapItemSize(UINT Id, DWORD Data, SIZE *Size)
case (INT_PTR) HBMMENU_MBAR_MINIMIZE_D: case (INT_PTR) HBMMENU_MBAR_MINIMIZE_D:
case (INT_PTR) HBMMENU_MBAR_CLOSE: case (INT_PTR) HBMMENU_MBAR_CLOSE:
case (INT_PTR) HBMMENU_MBAR_CLOSE_D: case (INT_PTR) HBMMENU_MBAR_CLOSE_D:
Size->cx = GetSystemMetrics(SM_CXSIZE); /* FIXME: Why we need to subtract these magic values? */
Size->cy = GetSystemMetrics(SM_CYSIZE); Size->cx = GetSystemMetrics(SM_CXSIZE) - 2;
Size->cy = GetSystemMetrics(SM_CYSIZE) - 4;
return; return;
case (INT_PTR) HBMMENU_CALLBACK: case (INT_PTR) HBMMENU_CALLBACK:
case (INT_PTR) HBMMENU_POPUP_CLOSE: case (INT_PTR) HBMMENU_POPUP_CLOSE:
@ -480,6 +481,7 @@ MenuDrawBitmapItem(HDC Dc, PROSMENUITEMINFO Item, const RECT *Rect, BOOL MenuBar
UINT Flags = 0; UINT Flags = 0;
RECT r; RECT r;
r = *Rect;
switch ((int) Item->hbmpItem) switch ((int) Item->hbmpItem)
{ {
case (INT_PTR) HBMMENU_SYSTEM: case (INT_PTR) HBMMENU_SYSTEM:
@ -507,9 +509,11 @@ MenuDrawBitmapItem(HDC Dc, PROSMENUITEMINFO Item, const RECT *Rect, BOOL MenuBar
Flags = DFCS_CAPTIONRESTORE; Flags = DFCS_CAPTIONRESTORE;
break; break;
case (INT_PTR) HBMMENU_MBAR_MINIMIZE: case (INT_PTR) HBMMENU_MBAR_MINIMIZE:
r.right += 1;
Flags = DFCS_CAPTIONMIN; Flags = DFCS_CAPTIONMIN;
break; break;
case (INT_PTR) HBMMENU_MBAR_MINIMIZE_D: case (INT_PTR) HBMMENU_MBAR_MINIMIZE_D:
r.right += 1;
Flags = DFCS_CAPTIONMIN | DFCS_INACTIVE; Flags = DFCS_CAPTIONMIN | DFCS_INACTIVE;
break; break;
case (INT_PTR) HBMMENU_MBAR_CLOSE: case (INT_PTR) HBMMENU_MBAR_CLOSE:
@ -527,7 +531,6 @@ MenuDrawBitmapItem(HDC Dc, PROSMENUITEMINFO Item, const RECT *Rect, BOOL MenuBar
FIXME("Magic menu bitmap not implemented\n"); FIXME("Magic menu bitmap not implemented\n");
return; return;
} }
r = *Rect;
InflateRect(&r, -1, -1); InflateRect(&r, -1, -1);
if (0 != (Item->fState & MF_HILITE)) if (0 != (Item->fState & MF_HILITE))
{ {
@ -1238,6 +1241,11 @@ MenuCalcItemSize(HDC Dc, PROSMENUITEMINFO ItemInfo, HWND WndOwner,
/* Leave space for the sunken border */ /* Leave space for the sunken border */
ItemInfo->Rect.right += 2; ItemInfo->Rect.right += 2;
ItemInfo->Rect.bottom += 2; ItemInfo->Rect.bottom += 2;
/* Special case: Minimize button doesn't have a space behind it. */
if (ItemInfo->hbmpItem == (HBITMAP)HBMMENU_MBAR_MINIMIZE ||
ItemInfo->hbmpItem == (HBITMAP)HBMMENU_MBAR_MINIMIZE_D)
ItemInfo->Rect.right -= 1;
} }
/* it must be a text item - unless it's the system menu */ /* it must be a text item - unless it's the system menu */
@ -1463,6 +1471,8 @@ MenuMenuBarCalcSize(HDC Dc, LPRECT Rect, PROSMENUINFO MenuInfo, HWND WndOwner)
} }
} }
/* FIXME: Is this really needed? */
#if 0
/* Finish the line (set all items to the largest height found) */ /* Finish the line (set all items to the largest height found) */
while (Start < i) while (Start < i)
{ {
@ -1473,6 +1483,9 @@ MenuMenuBarCalcSize(HDC Dc, LPRECT Rect, PROSMENUINFO MenuInfo, HWND WndOwner)
} }
Start++; Start++;
} }
#else
Start = i;
#endif
} }
Rect->bottom = MaxY; Rect->bottom = MaxY;

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.54 2004/05/10 17:07:18 weiden Exp $ /* $Id: menu.c,v 1.55 2004/05/13 20:21:27 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -845,6 +845,9 @@ IntInsertMenuItem(PMENU_OBJECT MenuObject, UINT uItem, BOOL fByPosition,
return FALSE; return FALSE;
} }
/* Force size recalculation! */
MenuObject->MenuInfo.Height = 0;
pos = IntInsertMenuItemToList(MenuObject, MenuItem, pos); pos = IntInsertMenuItemToList(MenuObject, MenuItem, pos);
return pos >= 0; return pos >= 0;