* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: menu.c,v 1.42 2004/01/26 08:44:51 weiden Exp $
+/* $Id: menu.c,v 1.43 2004/01/26 10:09:04 weiden Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/menu.c
PVOID Buf, hBuf;
DWORD BufSize, Items, Items2;
MENUITEMINFOW *mii;
+ SETMENUITEMRECT smir;
RECT *omir, *mir = NULL;
LPWSTR str;
/* copy menu items into buffer */
Items = Items2 = NtUserBuildMenuItemList(mnu, Buf, BufSize, 0);
+ smir.fByPosition = TRUE;
+ smir.uItem = 0;
/* calculate menu item rectangles */
while(Items > 0)
{
mir->top = Rect->top;
}
MeasureMenuItem(hWnd, mnu, hDC, mii, mir, str);
+ smir.rcRect = *mir;
+ NtUserSetMenuItemRect(mnu, &smir);
height = max(height, mir->top + mir->bottom);
/* DbgPrint("Measure menu item %ws: (%d, %d, %d, %d)\n", str, mir->left, mir->top, mir->right, mir->bottom); */
Items--;
+ smir.uItem++;
}
height = max(height, GetSystemMetrics(SM_CYMENU));
BOOL FASTCALL
IntSetMenuDefaultItem(PMENU_OBJECT MenuObject, UINT uItem, UINT fByPos);
+BOOL FASTCALL
+IntSetMenuItemRect(PMENU_OBJECT MenuObject, UINT Item, BOOL fByPos, RECT *rcRect);
+
BOOL FASTCALL
IntCleanupMenus(struct _EPROCESS *Process, PW32PROCESS Win32Process);
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: menu.c,v 1.40 2004/01/24 08:26:25 ekohl Exp $
+/* $Id: menu.c,v 1.41 2004/01/26 10:09:04 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
return FALSE;
}
+BOOL FASTCALL
+IntSetMenuItemRect(PMENU_OBJECT MenuObject, UINT Item, BOOL fByPos, RECT *rcRect)
+{
+ PMENU_ITEM mi;
+ if(IntGetMenuItemByFlag(MenuObject, Item, (fByPos ? MF_BYPOSITION : MF_BYCOMMAND),
+ &mi, NULL) > -1)
+ {
+ mi->Rect = *rcRect;
+ return TRUE;
+ }
+ return FALSE;
+}
+
/*!
* Internal function. Called when the process is destroyed to free the remaining menu handles.
-/* $Id: misc.c,v 1.43 2004/01/26 08:44:51 weiden Exp $
+/* $Id: misc.c,v 1.44 2004/01/26 10:09:04 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
#include <internal/safe.h>
#include <include/error.h>
#include <include/window.h>
+#include <include/menu.h>
#include <include/painting.h>
#include <include/dce.h>
#include <include/mouse.h>
switch(Routine)
{
case TWOPARAM_ROUTINE_SETMENUITEMRECT:
- UNIMPLEMENTED
- return 0;
+ {
+ BOOL Ret;
+ SETMENUITEMRECT smir;
+ PMENU_OBJECT MenuObject = IntGetMenuObject((HMENU)Param1);
+ if(!MenuObject)
+ return 0;
+
+ if(!NT_SUCCESS(MmCopyFromCaller(&smir, (PVOID)Param2, sizeof(SETMENUITEMRECT))))
+ {
+ IntReleaseMenuObject(MenuObject);
+ return 0;
+ }
+
+ Ret = IntSetMenuItemRect(MenuObject, smir.uItem, smir.fByPosition, &smir.rcRect);
+
+ IntReleaseMenuObject(MenuObject);
+ return (DWORD)Ret;
+ }
case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
{