[Win32k|User32]

- Start Menu and Item structure migration.

svn path=/trunk/; revision=46351
This commit is contained in:
James Tabor 2010-03-23 02:42:11 +00:00
parent d4aa71ff39
commit a2ea38d3cc
4 changed files with 25 additions and 25 deletions

View file

@ -539,7 +539,7 @@ static UINT FASTCALL MenuFindItemByKey(HWND WndOwner, PROSMENUINFO MenuInfo,
ItemInfo = Items; ItemInfo = Items;
for (i = 0; i < MenuInfo->MenuItemCount; i++, ItemInfo++) for (i = 0; i < MenuInfo->MenuItemCount; i++, ItemInfo++)
{ {
if ((ItemInfo->Text) && NULL != ItemInfo->dwTypeData) if ((ItemInfo->lpstr) && NULL != ItemInfo->dwTypeData)
{ {
WCHAR *p = (WCHAR *) ItemInfo->dwTypeData - 2; WCHAR *p = (WCHAR *) ItemInfo->dwTypeData - 2;
do do
@ -806,7 +806,7 @@ static void FASTCALL MenuCalcItemSize( HDC hdc, PROSMENUITEMINFO lpitem, PROSMEN
return; return;
} }
lpitem->XTab = 0; lpitem->dxTab = 0;
if (lpitem->hbmpItem) if (lpitem->hbmpItem)
{ {
@ -829,12 +829,12 @@ static void FASTCALL MenuCalcItemSize( HDC hdc, PROSMENUITEMINFO lpitem, PROSMEN
if( !(MenuInfo->dwStyle & MNS_NOCHECK)) if( !(MenuInfo->dwStyle & MNS_NOCHECK))
lpitem->Rect.right += 2 * check_bitmap_width; lpitem->Rect.right += 2 * check_bitmap_width;
lpitem->Rect.right += 4 + MenuCharSize.cx; lpitem->Rect.right += 4 + MenuCharSize.cx;
lpitem->XTab = lpitem->Rect.right; lpitem->dxTab = lpitem->Rect.right;
lpitem->Rect.right += check_bitmap_width; lpitem->Rect.right += check_bitmap_width;
} else /* hbmpItem & MenuBar */ { } else /* hbmpItem & MenuBar */ {
MenuGetBitmapItemSize(lpitem, &size, hwndOwner ); MenuGetBitmapItemSize(lpitem, &size, hwndOwner );
lpitem->Rect.right += size.cx; lpitem->Rect.right += size.cx;
if( lpitem->Text) lpitem->Rect.right += 2; if( lpitem->lpstr) lpitem->Rect.right += 2;
itemheight = size.cy; itemheight = size.cy;
/* Special case: Minimize button doesn't have a space behind it. */ /* Special case: Minimize button doesn't have a space behind it. */
@ -847,12 +847,12 @@ static void FASTCALL MenuCalcItemSize( HDC hdc, PROSMENUITEMINFO lpitem, PROSMEN
if( !(MenuInfo->dwStyle & MNS_NOCHECK)) if( !(MenuInfo->dwStyle & MNS_NOCHECK))
lpitem->Rect.right += check_bitmap_width; lpitem->Rect.right += check_bitmap_width;
lpitem->Rect.right += 4 + MenuCharSize.cx; lpitem->Rect.right += 4 + MenuCharSize.cx;
lpitem->XTab = lpitem->Rect.right; lpitem->dxTab = lpitem->Rect.right;
lpitem->Rect.right += check_bitmap_width; lpitem->Rect.right += check_bitmap_width;
} }
/* it must be a text item - unless it's the system menu */ /* it must be a text item - unless it's the system menu */
if (!(lpitem->fType & MF_SYSMENU) && lpitem->Text) { if (!(lpitem->fType & MF_SYSMENU) && lpitem->lpstr) {
HFONT hfontOld = NULL; HFONT hfontOld = NULL;
RECT rc = lpitem->Rect; RECT rc = lpitem->Rect;
LONG txtheight, txtwidth; LONG txtheight, txtwidth;
@ -881,7 +881,7 @@ static void FASTCALL MenuCalcItemSize( HDC hdc, PROSMENUITEMINFO lpitem, PROSMEN
/* get text size after the tab */ /* get text size after the tab */
tmpheight = DrawTextW( hdc, p, -1, &tmprc, tmpheight = DrawTextW( hdc, p, -1, &tmprc,
DT_SINGLELINE|DT_CALCRECT); DT_SINGLELINE|DT_CALCRECT);
lpitem->XTab += txtwidth; lpitem->dxTab += txtwidth;
txtheight = max( txtheight, tmpheight); txtheight = max( txtheight, tmpheight);
txtwidth += MenuCharSize.cx + /* space for the tab */ txtwidth += MenuCharSize.cx + /* space for the tab */
tmprc.right - tmprc.left; /* space for the short cut */ tmprc.right - tmprc.left; /* space for the short cut */
@ -889,7 +889,7 @@ static void FASTCALL MenuCalcItemSize( HDC hdc, PROSMENUITEMINFO lpitem, PROSMEN
txtheight = DrawTextW( hdc, lpitem->dwTypeData, -1, &rc, txtheight = DrawTextW( hdc, lpitem->dwTypeData, -1, &rc,
DT_SINGLELINE|DT_CALCRECT); DT_SINGLELINE|DT_CALCRECT);
txtwidth = rc.right - rc.left; txtwidth = rc.right - rc.left;
lpitem->XTab += txtwidth; lpitem->dxTab += txtwidth;
} }
lpitem->Rect.right += 2 + txtwidth; lpitem->Rect.right += 2 + txtwidth;
itemheight = max( itemheight, itemheight = max( itemheight,
@ -965,10 +965,10 @@ static void FASTCALL MenuPopupMenuCalcSize(PROSMENUINFO MenuInfo, HWND WndOwner)
// } // }
maxX = max(maxX, lpitem.Rect.right); maxX = max(maxX, lpitem.Rect.right);
orgY = lpitem.Rect.bottom; orgY = lpitem.Rect.bottom;
if ((lpitem.Text) && lpitem.XTab ) if ((lpitem.lpstr) && lpitem.dxTab )
{ {
maxTab = max( maxTab, lpitem.XTab ); maxTab = max( maxTab, lpitem.dxTab );
maxTabWidth = max(maxTabWidth, lpitem.Rect.right - lpitem.XTab); maxTabWidth = max(maxTabWidth, lpitem.Rect.right - lpitem.dxTab);
} }
} }
@ -979,9 +979,9 @@ static void FASTCALL MenuPopupMenuCalcSize(PROSMENUINFO MenuInfo, HWND WndOwner)
if (MenuGetRosMenuItemInfo(MenuInfo->Self, start, &lpitem)) if (MenuGetRosMenuItemInfo(MenuInfo->Self, start, &lpitem))
{ {
lpitem.Rect.right = maxX; lpitem.Rect.right = maxX;
if ((lpitem.Text) && 0 != lpitem.XTab) if ((lpitem.lpstr) && 0 != lpitem.dxTab)
{ {
lpitem.XTab = maxTab; lpitem.dxTab = maxTab;
} }
MenuSetRosMenuItemInfo(MenuInfo->Self, start, &lpitem); MenuSetRosMenuItemInfo(MenuInfo->Self, start, &lpitem);
} }
@ -1379,7 +1379,7 @@ static void FASTCALL MenuDrawMenuItem(HWND hWnd, PROSMENUINFO MenuInfo, HWND Wnd
} }
/* process text if present */ /* process text if present */
if (lpitem->Text) if (lpitem->lpstr)
{ {
register int i = 0; register int i = 0;
HFONT hfontOld = 0; HFONT hfontOld = 0;
@ -1429,12 +1429,12 @@ static void FASTCALL MenuDrawMenuItem(HWND hWnd, PROSMENUINFO MenuInfo, HWND Wnd
{ {
if (L'\t' == Text[i]) if (L'\t' == Text[i])
{ {
rect.left = lpitem->XTab; rect.left = lpitem->dxTab;
uFormat = DT_LEFT | DT_VCENTER | DT_SINGLELINE; uFormat = DT_LEFT | DT_VCENTER | DT_SINGLELINE;
} }
else else
{ {
rect.right = lpitem->XTab; rect.right = lpitem->dxTab;
uFormat = DT_RIGHT | DT_VCENTER | DT_SINGLELINE; uFormat = DT_RIGHT | DT_VCENTER | DT_SINGLELINE;
} }

View file

@ -3279,8 +3279,8 @@ typedef struct tagROSMENUITEMINFO
HBITMAP hbmpItem; HBITMAP hbmpItem;
/* ----------- Extra ----------- */ /* ----------- Extra ----------- */
RECT Rect; /* Item area (relative to menu window) */ RECT Rect; /* Item area (relative to menu window) */
UINT XTab; /* X position of text after Tab */ UINT dxTab; /* X position of text after Tab */
LPWSTR Text; /* Copy of the text pointer in MenuItem->Text */ LPWSTR lpstr; /* Copy of the text pointer in MenuItem->Text */
} ROSMENUITEMINFO, *PROSMENUITEMINFO; } ROSMENUITEMINFO, *PROSMENUITEMINFO;
BOOL BOOL

View file

@ -23,7 +23,7 @@ typedef struct _MENU_ITEM
UNICODE_STRING Text; UNICODE_STRING Text;
HBITMAP hbmpItem; HBITMAP hbmpItem;
RECTL Rect; RECTL Rect;
UINT XTab; UINT dxTab;
} MENU_ITEM, *PMENU_ITEM; } MENU_ITEM, *PMENU_ITEM;
typedef struct _MENU_OBJECT typedef struct _MENU_OBJECT

View file

@ -690,8 +690,8 @@ IntGetMenuItemInfo(PMENU_OBJECT Menu, /* UNUSED PARAM!! */
if (sizeof(ROSMENUITEMINFO) == lpmii->cbSize) if (sizeof(ROSMENUITEMINFO) == lpmii->cbSize)
{ {
lpmii->Rect = MenuItem->Rect; lpmii->Rect = MenuItem->Rect;
lpmii->XTab = MenuItem->XTab; lpmii->dxTab = MenuItem->dxTab;
lpmii->Text = MenuItem->Text.Buffer; lpmii->lpstr = MenuItem->Text.Buffer; // Use DesktopHeap!
} }
return TRUE; return TRUE;
@ -842,8 +842,8 @@ IntSetMenuItemInfo(PMENU_OBJECT MenuObject, PMENU_ITEM MenuItem, PROSMENUITEMINF
if (sizeof(ROSMENUITEMINFO) == lpmii->cbSize) if (sizeof(ROSMENUITEMINFO) == lpmii->cbSize)
{ {
MenuItem->Rect = lpmii->Rect; MenuItem->Rect = lpmii->Rect;
MenuItem->XTab = lpmii->XTab; MenuItem->dxTab = lpmii->dxTab;
lpmii->Text = MenuItem->Text.Buffer; /* Send back new allocated string or zero */ lpmii->lpstr = MenuItem->Text.Buffer; /* Use DesktopHeap! Send back new allocated string or zero */
} }
return TRUE; return TRUE;
@ -1002,8 +1002,8 @@ IntBuildMenuItemList(PMENU_OBJECT MenuObject, PVOID Buffer, ULONG nMax)
mii.hbmpUnchecked = CurItem->hbmpUnchecked; mii.hbmpUnchecked = CurItem->hbmpUnchecked;
mii.hSubMenu = CurItem->hSubMenu; mii.hSubMenu = CurItem->hSubMenu;
mii.Rect = CurItem->Rect; mii.Rect = CurItem->Rect;
mii.XTab = CurItem->XTab; mii.dxTab = CurItem->dxTab;
mii.Text = CurItem->Text.Buffer; mii.lpstr = CurItem->Text.Buffer; // Use DesktopHeap!
Status = MmCopyToCaller(Buf, &mii, sizeof(ROSMENUITEMINFO)); Status = MmCopyToCaller(Buf, &mii, sizeof(ROSMENUITEMINFO));
if (! NT_SUCCESS(Status)) if (! NT_SUCCESS(Status))