Implement ModifyMenu A & W.
Modified: trunk/reactos/lib/user32/windows/menu.c
_____
Modified: trunk/reactos/lib/user32/windows/menu.c
--- trunk/reactos/lib/user32/windows/menu.c 2005-07-09 04:19:35 UTC
(rev 16516)
+++ trunk/reactos/lib/user32/windows/menu.c 2005-07-09 04:23:34 UTC
(rev 16517)
@@ -4300,7 +4300,7 @@
/*
- * @unimplemented
+ * @implemented
*/
BOOL
STDCALL
@@ -4311,13 +4311,93 @@
UINT_PTR uIDNewItem,
LPCSTR lpNewItem)
{
+ MENUITEMINFOA mii;
+ mii.cbSize = sizeof(MENUITEMINFOA);
+ mii.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_STATE;
+ mii.fType = 0;
+ mii.fState = MFS_ENABLED;
+
UNIMPLEMENTED;
- return FALSE;
+
+ if(!GetMenuItemInfoA( hMnu,
+ uPosition,
+ (BOOL)!(MF_BYPOSITION & uFlags),
+ &mii)) return FALSE;
+
+ if(uFlags & MF_BITMAP)
+ {
+ mii.fType |= MFT_BITMAP;
+ mii.fMask |= MIIM_BITMAP;
+ mii.hbmpItem = (HBITMAP) lpNewItem;
+ }
+ else if(uFlags & MF_OWNERDRAW)
+ {
+ mii.fType |= MFT_OWNERDRAW;
+ mii.fMask |= MIIM_DATA;
+ mii.dwItemData = (DWORD) lpNewItem;
+ }
+ else /* Default action MF_STRING. */
+ {
+ if(mii.dwTypeData != NULL)
+ {
+ HeapFree(GetProcessHeap(),0, mii.dwTypeData);
+ }
+ /* Item beginning with a backspace is a help item */
+ if (*lpNewItem == '\b')
+ {
+ mii.fType |= MF_HELP;
+ lpNewItem++;
+ }
+ mii.fMask |= MIIM_TYPE;
+ mii.dwTypeData = (LPSTR)lpNewItem;
+ mii.cch = (NULL == lpNewItem ? 0 : strlen(lpNewItem));
+ }
+
+ if(uFlags & MF_RIGHTJUSTIFY)
+ {
+ mii.fType |= MFT_RIGHTJUSTIFY;
+ }
+ if(uFlags & MF_MENUBREAK)
+ {
+ mii.fType |= MFT_MENUBREAK;
+ }
+ if(uFlags & MF_MENUBARBREAK)
+ {
+ mii.fType |= MFT_MENUBARBREAK;
+ }
+ if(uFlags & MF_DISABLED)
+ {
+ mii.fState |= MFS_DISABLED;
+ }
+ if(uFlags & MF_GRAYED)
+ {
+ mii.fState |= MFS_GRAYED;
+ }
+
+ if ((mii.fType & MF_POPUP) && (uFlags & MF_POPUP) &&
(mii.hSubMenu !=
(HMENU)uIDNewItem))
+ NtUserDestroyMenu( mii.hSubMenu ); /* ModifyMenu() spec */
+
+ if(uFlags & MF_POPUP)
+ {
+ mii.fType |= MF_POPUP;
+ mii.fMask |= MIIM_SUBMENU;
+ mii.hSubMenu = (HMENU)uIDNewItem;
+ }
+ else
+ {
+ mii.fMask |= MIIM_ID;
+ mii.wID = (UINT)uIDNewItem;
+ }
+
+ return SetMenuItemInfoA( hMnu,
+ uPosition,
+ (BOOL)!(MF_BYPOSITION & uFlags),
+ &mii);
}
/*
- * @unimplemented
+ * @implemented
*/
BOOL
STDCALL
@@ -4328,8 +4408,88 @@
UINT_PTR uIDNewItem,
LPCWSTR lpNewItem)
{
+ MENUITEMINFOW mii;
+ mii.cbSize = sizeof(MENUITEMINFOW);
+ mii.fMask = MIIM_FTYPE | MIIM_STRING | MIIM_STATE;
+ mii.fType = 0;
+ mii.fState = MFS_ENABLED;
+
UNIMPLEMENTED;
- return FALSE;
+
+ if(!NtUserMenuItemInfo( hMnu,
+ uPosition,
+ (BOOL)!(MF_BYPOSITION & uFlags),
+ (PROSMENUITEMINFO) &mii,
+ FALSE)) return FALSE;
+
+ if(uFlags & MF_BITMAP)
+ {
+ mii.fType |= MFT_BITMAP;
+ mii.fMask |= MIIM_BITMAP;
+ mii.hbmpItem = (HBITMAP) lpNewItem;
+ }
+ else if(uFlags & MF_OWNERDRAW)
+ {
+ mii.fType |= MFT_OWNERDRAW;
+ mii.fMask |= MIIM_DATA;
+ mii.dwItemData = (DWORD) lpNewItem;
+ }
+ else
+ {
+ if(mii.dwTypeData != NULL)
+ {
+ HeapFree(GetProcessHeap(),0, mii.dwTypeData);
+ }
+ if (*lpNewItem == '\b')
+ {
+ mii.fType |= MF_HELP;
+ lpNewItem++;
+ }
+ mii.fMask |= MIIM_TYPE;
+ mii.dwTypeData = (LPWSTR)lpNewItem;
+ mii.cch = (NULL == lpNewItem ? 0 : wcslen(lpNewItem));
+ }
+
+ if(uFlags & MF_RIGHTJUSTIFY)
+ {
+ mii.fType |= MFT_RIGHTJUSTIFY;
+ }
+ if(uFlags & MF_MENUBREAK)
+ {
+ mii.fType |= MFT_MENUBREAK;
+ }
+ if(uFlags & MF_MENUBARBREAK)
+ {
+ mii.fType |= MFT_MENUBARBREAK;
+ }
+ if(uFlags & MF_DISABLED)
+ {
+ mii.fState |= MFS_DISABLED;
+ }
+ if(uFlags & MF_GRAYED)
+ {
+ mii.fState |= MFS_GRAYED;
+ }
+
+ if ((mii.fType & MF_POPUP) && (uFlags & MF_POPUP) &&
(mii.hSubMenu !=
(HMENU)uIDNewItem))
+ NtUserDestroyMenu( mii.hSubMenu );
+
+ if(uFlags & MF_POPUP)
+ {
+ mii.fType |= MF_POPUP;
+ mii.fMask |= MIIM_SUBMENU;
+ mii.hSubMenu = (HMENU)uIDNewItem;
+ }
+ else
+ {
+ mii.fMask |= MIIM_ID;
+ mii.wID = (UINT)uIDNewItem;
+ }
+
+ return SetMenuItemInfoW( hMnu,
+ uPosition,
+ (BOOL)!(MF_BYPOSITION & uFlags),
+ &mii);
}
Show replies by date