#define TPM_BUTTONDOWN 0x40000000 /* menu was clicked before tracking */
#define TPM_POPUPMENU 0x20000000 /* menu is a popup menu */
+ /* Space between 2 columns */
+#define MENU_COL_SPACE 4
+
/* top and bottom margins for popup menus */
-#define MENU_TOP_MARGIN 3
+#define MENU_TOP_MARGIN 2 //3
#define MENU_BOTTOM_MARGIN 2
#define MENU_TYPE_MASK (MF_STRING | MF_BITMAP | MF_OWNERDRAW | MF_SEPARATOR)
#define IS_MAGIC_BITMAP(id) ((id) && ((INT_PTR)(id) < 12) && ((INT_PTR)(id) >= -1))
#define IS_SYSTEM_MENU(MenuInfo) \
- (0 == ((MenuInfo)->fFlags & MNF_POPUP) && 0 != ((MenuInfo)->fFlags & MNF_SYSDESKMN))
+ (0 == ((MenuInfo)->fFlags & MNF_POPUP) && 0 != ((MenuInfo)->fFlags & MNF_SYSMENU))
#define IS_SYSTEM_POPUP(MenuInfo) \
- (0 != ((MenuInfo)->fFlags & MNF_POPUP) && 0 != ((MenuInfo)->fFlags & MNF_SYSDESKMN))
+ (0 != ((MenuInfo)->fFlags & MNF_POPUP) && 0 != ((MenuInfo)->fFlags & MNF_SYSMENU))
#define IS_BITMAP_ITEM(flags) (MF_BITMAP == MENU_ITEM_TYPE(flags))
{
WC_MENU, /* name */
CS_SAVEBITS | CS_DBLCLKS, /* style */
- (WNDPROC) NULL, /* FIXME - procA */
- (WNDPROC) PopupMenuWndProcW, /* FIXME - procW */
+ NULL, /* FIXME - procA */
+ PopupMenuWndProcW, /* FIXME - procW */
sizeof(MENUINFO *), /* extra */
(LPCWSTR) IDC_ARROW, /* cursor */
(HBRUSH)(COLOR_MENU + 1) /* brush */
{ // Very strange this fixes a wine test with a crash.
if(lpmii->dwTypeData && lpmii->cch && !(GdiValidateHandle((HGDIOBJ)lpmii->dwTypeData)) )
{
- lpmii->cch = 0;
if( unicode)
*((WCHAR *)lpmii->dwTypeData) = 0;
else
*((CHAR *)lpmii->dwTypeData) = 0;
}
+ lpmii->cch = 0;
}
else
{
MenuInfo->cyMenu = pMenu->cyMenu;
MenuInfo->spwndNotify = pMenu->spwndNotify;
MenuInfo->cxTextAlign = pMenu->cxTextAlign;
- MenuInfo->iTop = pMenu->iMaxTop;
+ MenuInfo->iTop = pMenu->iTop;
MenuInfo->iMaxTop = pMenu->iMaxTop;
MenuInfo->dwArrowsOn = pMenu->dwArrowsOn;
ItemInfo->Rect.right = pItem->cxItem; // Do this for now......
ItemInfo->Rect.bottom = pItem->cyItem;
ItemInfo->dxTab = pItem->dxTab;
- ItemInfo->lpstr = pItem->lpstr.Buffer;
+ ItemInfo->lpstr = pItem->lpstr.Buffer ? DesktopPtrToUser(pItem->lpstr.Buffer) : NULL;
ItemInfo->maxBmpSize.cx = pItem->cxBmp;
ItemInfo->maxBmpSize.cy = pItem->cyBmp;
MenuLoadBitmaps(VOID)
{
/* Load system buttons bitmaps */
- if (NULL == BmpSysMenu)
- {
+ if (BmpSysMenu == NULL)
+ {
BmpSysMenu = LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CLOSE));
- }
+ }
}
/////////// Make gpsi OBMI via callback //////////////
/***********************************************************************
TRACE("\tlooking for '%c' (0x%02x) in [%p]\n", (char)Key, Key, hmenu );
if (!IsMenu( hmenu )) hmenu = GetSubMenu( get_win_sys_menu(WndOwner), 0);
- if (hmenu)
- {
- MENU *menu = MENU_GetMenu( hmenu );
- ITEM *item = menu->rgItems ? DesktopPtrToUser(menu->rgItems) : NULL;
+ if (hmenu)
+ {
+ MENU *menu = MENU_GetMenu( hmenu );
+ ITEM *item = menu->rgItems ? DesktopPtrToUser(menu->rgItems) : NULL;
- if( !ForceMenuChar )
- {
- UINT i;
- BOOL cjk = GetSystemMetrics( SM_DBCSENABLED );
+ if ( !ForceMenuChar )
+ {
+ UINT i;
+ BOOL cjk = GetSystemMetrics( SM_DBCSENABLED );
- for (i = 0; i < menu->cItems; i++, item++)
- {
- LPWSTR text = item->Xlpstr ? DesktopPtrToUser(item->Xlpstr) : NULL;
- if( text)
- {
- const WCHAR *p = text - 2;
- do
- {
- const WCHAR *q = p + 2;
- p = strchrW (q, '&');
- if (!p && cjk) p = strchrW (q, '\036'); /* Japanese Win16 */
- }
- while (p != NULL && p [1] == '&');
- if (p && (toupperW(p[1]) == toupperW(Key))) return i;
- }
- }
- }
+ for (i = 0; i < menu->cItems; i++, item++)
+ {
+ LPWSTR text = item->Xlpstr ? DesktopPtrToUser(item->Xlpstr) : NULL;
+ if( text)
+ {
+ const WCHAR *p = text - 2;
+ do
+ {
+ const WCHAR *q = p + 2;
+ p = strchrW (q, '&');
+ if (!p && cjk) p = strchrW (q, '\036'); /* Japanese Win16 */
+ }
+ while (p != NULL && p [1] == '&');
+ if (p && (toupperW(p[1]) == toupperW(Key))) return i;
+ }
+ }
+ }
- Flags |= menu->fFlags & MNF_POPUP ? MF_POPUP : 0;
- Flags |= menu->fFlags & MNF_SYSDESKMN ? MF_SYSMENU : 0;
+ Flags |= menu->fFlags & MNF_POPUP ? MF_POPUP : 0;
+ Flags |= menu->fFlags & MNF_SYSMENU ? MF_SYSMENU : 0;
- MenuChar = SendMessageW(WndOwner, WM_MENUCHAR,
+ MenuChar = SendMessageW( WndOwner, WM_MENUCHAR,
MAKEWPARAM(Key, Flags), (LPARAM) hmenu);
- if (HIWORD(MenuChar) == MNC_EXECUTE) return LOWORD(MenuChar);
- if (HIWORD(MenuChar) == MNC_CLOSE) return (UINT)(-2);
- }
+ if (HIWORD(MenuChar) == MNC_EXECUTE) return LOWORD(MenuChar);
+ if (HIWORD(MenuChar) == MNC_CLOSE) return (UINT)(-2);
+ }
return (UINT)(-1);
}
hfontOld = SelectObject( hdc, hMenuFontBold );
}
if (menuBar) {
- txtheight = DrawTextW( hdc, lpitem->dwTypeData, -1, &rc,
+ txtheight = DrawTextW( hdc, lpitem->lpstr, -1, &rc,
DT_SINGLELINE|DT_CALCRECT);
lpitem->Rect.right += rc.right - rc.left;
itemheight = max( max( itemheight, txtheight),
GetSystemMetrics( SM_CYMENU) - 1);
lpitem->Rect.right += 2 * MenuCharSize.cx;
} else {
- if ((p = strchrW( lpitem->dwTypeData, '\t' )) != NULL) {
+ if ((p = strchrW( lpitem->lpstr, '\t' )) != NULL) {
RECT tmprc = rc;
LONG tmpheight;
- int n = (int)( p - lpitem->dwTypeData);
+ int n = (int)( p - lpitem->lpstr);
/* Item contains a tab (only meaningful in popup menus) */
/* get text size before the tab */
- txtheight = DrawTextW( hdc, lpitem->dwTypeData, n, &rc,
+ txtheight = DrawTextW( hdc, lpitem->lpstr, n, &rc,
DT_SINGLELINE|DT_CALCRECT);
txtwidth = rc.right - rc.left;
p += 1; /* advance past the Tab */
txtwidth += MenuCharSize.cx + /* space for the tab */
tmprc.right - tmprc.left; /* space for the short cut */
} else {
- txtheight = DrawTextW( hdc, lpitem->dwTypeData, -1, &rc,
+ txtheight = DrawTextW( hdc, lpitem->lpstr, -1, &rc,
DT_SINGLELINE|DT_CALCRECT);
txtwidth = rc.right - rc.left;
lpitem->dxTab += txtwidth;
MENU_GetMaxPopupHeight(PROSMENUINFO lppop)
{
if (lppop->cyMax)
+ {
+ //ERR("MGMaxPH cyMax %d\n",lppop->cyMax);
return lppop->cyMax;
+ }
+ //ERR("MGMaxPH SyMax %d\n",GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYBORDER));
return GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYBORDER);
}
MenuInfo->cxTextAlign = 0;
MenuInitRosMenuItemInfo(&lpitem);
+ //MenuGetRosMenuItemInfo(MenuInfo->Self, start, &lpitem);
while (start < MenuInfo->cItems)
{
+ //lpitem = &lppop->items[start];
orgX = maxX;
- orgY = 2;
+ //if( lpitem.fType & (MF_MENUBREAK | MF_MENUBARBREAK))
+ // orgX += MENU_COL_SPACE;
+ orgY = MENU_TOP_MARGIN;
maxTab = maxTabWidth = 0;
-
/* Parse items until column break or end of menu */
- for (i = start; i < MenuInfo->cItems; i++)
+ for (i = start; i < MenuInfo->cItems; i++)//, lpitem++)
{
if (! MenuGetRosMenuItemInfo(MenuInfo->Self, i, &lpitem))
{
if (i != start &&
(lpitem.fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break;
- if( lpitem.lpstr && lpitem.hbmpItem) textandbmp = TRUE;
MenuCalcItemSize(hdc, &lpitem, MenuInfo, WndOwner, orgX, orgY, FALSE, textandbmp);
if (! MenuSetRosMenuItemInfo(MenuInfo->Self, i, &lpitem))
MenuSetRosMenuInfo(MenuInfo);
return;
}
-// Not sure here,, The patch from wine removes this.
-// if ((lpitem.fType & MF_MENUBARBREAK) != 0)
-// {
-// OrgX++;
-// }
+
maxX = max(maxX, lpitem.Rect.right);
orgY = lpitem.Rect.bottom;
- if ((lpitem.lpstr) && lpitem.dxTab )
+ if (IS_STRING_ITEM(lpitem.fType) && lpitem.dxTab )
{
maxTab = max( maxTab, lpitem.dxTab );
maxTabWidth = max(maxTabWidth, lpitem.Rect.right - lpitem.dxTab);
}
- }
+ if( lpitem.lpstr && lpitem.hbmpItem) textandbmp = TRUE;
+ }
/* Finish the column (set all items to the largest width found) */
- maxX = max( maxX, maxTab + maxTabWidth );
- while (start < i)
- {
- if (MenuGetRosMenuItemInfo(MenuInfo->Self, start, &lpitem))
- {
- lpitem.Rect.right = maxX;
- if ((lpitem.lpstr) && 0 != lpitem.dxTab)
- {
- lpitem.dxTab = maxTab;
- }
- MenuSetRosMenuItemInfo(MenuInfo->Self, start, &lpitem);
- }
- start++;
- }
- MenuInfo->cyMenu = max(MenuInfo->cyMenu, orgY);
+ maxX = max( maxX, maxTab + maxTabWidth );
+ while (start < i)
+ {
+ if (MenuGetRosMenuItemInfo(MenuInfo->Self, start, &lpitem))
+ {
+ lpitem.Rect.right = maxX;
+ if (IS_STRING_ITEM(lpitem.fType) && lpitem.dxTab)
+ {
+ lpitem.dxTab = maxTab;
+ }
+ MenuSetRosMenuItemInfo(MenuInfo->Self, start, &lpitem);
+ }
+ start++;
+ }
+ MenuInfo->cyMenu = max(MenuInfo->cyMenu, orgY);
}
MenuInfo->cxMenu = maxX;
}
/* FIXME: Is this really needed? */ /*NO! it is not needed, why make the
-HBMMENU_MBAR_CLOSE, MINIMIZE & RESTORE, look the same size as the menu bar! */
+ HBMMENU_MBAR_CLOSE, MINIMIZE & RESTORE, look the same size as the menu bar! */
#if 0
/* Finish the line (set all items to the largest height found) */
while (start < i)
orgY = ItemInfo.Rect.top;
orgX = lprect->right;
for (i = MenuInfo->cItems - 1; helpPos <= i; i--)
- {
- if (i < helpPos)
- {
- break; /* done */
- }
- if (ItemInfo.Rect.top != orgY)
- {
- break; /* Other line */
- }
- if (orgX <= ItemInfo.Rect.right)
- {
- break; /* Too far right already */
- }
+ {
+ if (i < helpPos) break; /* done */
+ if (ItemInfo.Rect.top != orgY) break; /* Other line */
+ if (orgX <= ItemInfo.Rect.right) break; /* Too far right already */
ItemInfo.Rect.left += orgX - ItemInfo.Rect.right;
ItemInfo.Rect.right = orgX;
orgX = ItemInfo.Rect.left;
MenuSetRosMenuItemInfo(MenuInfo->Self, i, &ItemInfo);
if (helpPos + 1 <= i &&
! MenuGetRosMenuItemInfo(MenuInfo->Self, i - 1, &ItemInfo))
- {
+ {
MenuCleanupRosMenuItemInfo(&ItemInfo);
return;
- }
- }
+ }
+ }
}
MenuCleanupRosMenuItemInfo(&ItemInfo);
arrow_bitmap_width = bmp.bmWidth;
arrow_bitmap_height = bmp.bmHeight;
-
if (lppop->iTop)
hOrigBitmap = SelectObject(hdcMem, get_up_arrow_bitmap());
else
DeleteDC(hdcMem);
}
+/***********************************************************************
+ * draw_popup_arrow
+ *
+ * Draws the popup-menu arrow.
+ */
+static void draw_popup_arrow( HDC hdc, RECT rect, UINT arrow_bitmap_width,
+ UINT arrow_bitmap_height)
+{
+ HDC hdcMem = CreateCompatibleDC( hdc );
+ HBITMAP hOrigBitmap;
+
+ hOrigBitmap = SelectObject( hdcMem, get_arrow_bitmap() );
+ BitBlt( hdc, rect.right - arrow_bitmap_width - 1,
+ (rect.top + rect.bottom - arrow_bitmap_height) / 2,
+ arrow_bitmap_width, arrow_bitmap_height,
+ hdcMem, 0, 0, SRCCOPY );
+ SelectObject( hdcMem, hOrigBitmap );
+ DeleteDC( hdcMem );
+}
+
/***********************************************************************
* MenuDrawMenuItem
*
PWCHAR Text;
BOOL flat_menu = FALSE;
int bkgnd;
+ UINT arrow_bitmap_width = 0, arrow_bitmap_height = 0;
PWND Wnd = ValidateHwndNoErr(hWnd);
if (!Wnd)
return;
+ if (!menuBar) {
+ BITMAP bmp;
+ GetObjectW( get_arrow_bitmap(), sizeof(bmp), &bmp );
+ arrow_bitmap_width = bmp.bmWidth;
+ arrow_bitmap_height = bmp.bmHeight;
+ }
+
if (lpitem->fType & MF_SYSMENU)
{
if ( (Wnd->style & WS_MINIMIZE))
/* Draw the popup-menu arrow */
if (lpitem->hSubMenu)
{
- RECT rectTemp;
+ /* RECT rectTemp;
CopyRect(&rectTemp, &rect);
rectTemp.left = rectTemp.right - GetSystemMetrics(SM_CXMENUCHECK);
DrawFrameControl(hdc, &rectTemp, DFC_MENU, DFCS_MENUARROW);
+ */
+ draw_popup_arrow( hdc, rect, arrow_bitmap_width, arrow_bitmap_height);
}
return;
}
HPEN oldPen;
RECT rc = rect;
- rc.left -= 3;
+ rc.left -= 3;//MENU_COL_SPACE / 2 + 1;
rc.top = 3;
rc.bottom = Height - 3;
if (flat_menu)
else if (lpitem->fState & MF_CHECKED) /* standard bitmaps */
{
RECT r;
+ //HBITMAP bm = CreateBitmap( check_bitmap_width, check_bitmap_height, 1, 1, NULL );
+ //HDC hdcMem = CreateCompatibleDC( hdc );
+ //SelectObject( hdcMem, bm );
+ //SetRect( &r, 0, 0, check_bitmap_width, check_bitmap_height);
CopyRect(&r, &rect);
r.right = r.left + GetSystemMetrics(SM_CXMENUCHECK);
DrawFrameControl( hdc, &r, DFC_MENU,
(lpitem->fType & MFT_RADIOCHECK) ?
DFCS_MENUBULLET : DFCS_MENUCHECK);
+ //BitBlt( hdc, rc.left, (y - r.bottom) / 2, r.right, r.bottom, hdcMem, 0, 0, SRCCOPY );
+ //DeleteDC( hdcMem );
+ //DeleteObject( bm );
checked = TRUE;
}
}
- if ( lpitem->hbmpItem )
+ if ( lpitem->hbmpItem )//&& !( checked && (MenuInfo->dwStyle & MNS_CHECKORBMP)))
{
RECT bmpRect;
CopyRect(&bmpRect, &rect);
bmpRect.left += check_bitmap_width + 2;
if (!(checked && (MenuInfo->dwStyle & MNS_CHECKORBMP)))
{
+ //POINT origorg;
bmpRect.right = bmpRect.left + lpitem->maxBmpSize.cx;
+ /* some applications make this assumption on the DC's origin */
+ //SetViewportOrgEx( hdc, rect.left, rect.top, &origorg);
MenuDrawBitmapItem(hdc, lpitem, &bmpRect, MenuInfo, WndOwner, odaction, menuBar);
+ //SetViewportOrgEx( hdc, origorg.x, origorg.y, NULL);
}
}
/* Draw the popup-menu arrow */
if (lpitem->hSubMenu)
{
- RECT rectTemp;
+ /* RECT rectTemp;
CopyRect(&rectTemp, &rect);
rectTemp.left = rectTemp.right - GetSystemMetrics(SM_CXMENUCHECK);
DrawFrameControl(hdc, &rectTemp, DFC_MENU, DFCS_MENUARROW);
+ */
+ draw_popup_arrow( hdc, rect, arrow_bitmap_width, arrow_bitmap_height);
}
rect.left += 4;
if( !(MenuInfo->dwStyle & MNS_NOCHECK))
rect.left += check_bitmap_width;
- rect.right -= check_bitmap_width;
+ rect.right -= arrow_bitmap_width;//check_bitmap_width;
}
else if( lpitem->hbmpItem)
{ /* Draw the bitmap */
+ //POINT origorg;
+
+ //SetViewportOrgEx( hdc, rect.left, rect.top, &origorg);
MenuDrawBitmapItem(hdc, lpitem, &rect, MenuInfo, WndOwner, odaction, menuBar);
+ //SetViewportOrgEx( hdc, origorg.x, origorg.y, NULL);
}
/* process text if present */
if (lpitem->lpstr)
{
- register int i = 0;
+ int i = 0;
HFONT hfontOld = 0;
UINT uFormat = menuBar ?
DT_CENTER | DT_VCENTER | DT_SINGLELINE :
DT_LEFT | DT_VCENTER | DT_SINGLELINE;
- if((MenuInfo->dwStyle & MNS_CHECKORBMP))
+ if ((MenuInfo->dwStyle & MNS_CHECKORBMP))
rect.left += max(0, (int)(MenuInfo->cxTextAlign - GetSystemMetrics(SM_CXMENUCHECK)));
else
rect.left += MenuInfo->cxTextAlign;
}
if (menuBar) {
- rect.left += MENU_BAR_ITEMS_SPACE / 2;
- rect.right -= MENU_BAR_ITEMS_SPACE / 2;
+ if( lpitem->hbmpItem)
+ rect.left += lpitem->maxBmpSize.cx;
+ if( !(lpitem->hbmpItem == HBMMENU_CALLBACK))
+ rect.left += MenuCharSize.cx;
+ rect.right -= MenuCharSize.cx;
+ //rect.left += MENU_BAR_ITEMS_SPACE / 2;
+ //rect.right -= MENU_BAR_ITEMS_SPACE / 2;
}
- Text = (PWCHAR) lpitem->dwTypeData;
+ Text = lpitem->lpstr;
if(Text)
{
for (i = 0; L'\0' != Text[i]; i++)
--rect.left; --rect.top; --rect.right; --rect.bottom;
}
SetTextColor(hdc, RGB(0x80, 0x80, 0x80));
- }
- DrawTextW( hdc, Text + i + 1, -1, &rect, uFormat );
+ }
+ DrawTextW( hdc, Text + i + 1, -1, &rect, uFormat );
}
if (hfontOld)
else
DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT);
- /* draw menu items */
//TRACE("hmenu %p Style %08x\n", hmenu, menu->dwStyle);
+ /* draw menu items */
if (MenuGetRosMenuInfo(&MenuInfo, hmenu) && MenuInfo.cItems)
{
UINT u;
MenuInitRosMenuItemInfo(&ItemInfo);
+ //for (u = MenuInfo.cItems; u > 0; u--, item++)
for (u = 0; u < MenuInfo.cItems; u++)
{
if (MenuGetRosMenuItemInfo(MenuInfo.Self, u, &ItemInfo))
{
HWND WndOwner = MenuInfo.spwndNotify ? MenuInfo.spwndNotify->head.h : NULL;
MenuDrawMenuItem(hwnd, &MenuInfo, WndOwner, hdc, &ItemInfo,
- MenuInfo.cyMenu, FALSE, ODA_DRAWENTIRE);
+ MenuInfo.cyMenu, FALSE, ODA_DRAWENTIRE);
}
}
-
/* draw scroll arrows */
if (MenuInfo.dwArrowsOn)
+ {
MENU_DrawScrollArrows(&MenuInfo, hdc);
+ }
MenuSetRosMenuInfo(&MenuInfo);
MenuCleanupRosMenuItemInfo(&ItemInfo);
if (hfontOld) SelectObject( hDC, hfontOld);
return lppop.cyMenu;
}
- else
+ else
return DrawMenuBarTemp(hwnd, hDC, lprect, hMenu, NULL);
}
static BOOL MENU_InitPopup( HWND hwndOwner, HMENU hmenu, UINT flags )
{
MENU *menu;
- DWORD ex_style = 0;
+ DWORD ex_style = WS_EX_TOOLWINDOW;
ROSMENUINFO MenuInfo;
TRACE("owner=%p hmenu=%p\n", hwndOwner, hmenu);
lppop->iTop = item->Rect.bottom - nMaxHeight;
ScrollWindow(lppop->Wnd, 0, nOldPos - lppop->iTop, &rc, &rc);
MENU_DrawScrollArrows(lppop, hdc);
+ //ERR("Scroll Down iTop %d iMaxTop %d nMaxHeight %d\n",lppop->iTop,lppop->iMaxTop,nMaxHeight);
}
else if (item->Rect.top - MENU_TOP_MARGIN < lppop->iTop)
{
lppop->iTop = item->Rect.top - MENU_TOP_MARGIN;
ScrollWindow(lppop->Wnd, 0, nOldPos - lppop->iTop, &rc, &rc);
MENU_DrawScrollArrows(lppop, hdc);
+ //ERR("Scroll Up iTop %d iMaxTop %d nMaxHeight %d\n",lppop->iTop,lppop->iMaxTop,nMaxHeight);
}
+ MenuSetRosMenuInfo(lppop);
}
}
ItemInfo.fState &= ~(MF_HILITE|MF_MOUSESELECT);
MenuSetRosMenuItemInfo(hmenu->Self, hmenu->iItem, &ItemInfo);
}
- //MENU_EnsureMenuItemVisible(hmenu, &ItemInfo, hdc);
MenuDrawMenuItem(hmenu->Wnd, hmenu, hwndOwner, hdc, &ItemInfo,
hmenu->cyMenu, !(hmenu->fFlags & MNF_POPUP),
ODA_SELECT);
ItemInfo.fMask |= MIIM_STATE;
ItemInfo.fState |= MF_HILITE;
MenuSetRosMenuItemInfo(hmenu->Self, hmenu->iItem, &ItemInfo);
+ MENU_EnsureMenuItemVisible(hmenu, &ItemInfo, hdc);
MenuDrawMenuItem(hmenu->Wnd, hmenu, hwndOwner, hdc,
- &ItemInfo, hmenu->cyMenu, !(hmenu->fFlags & MNF_POPUP),
- ODA_SELECT);
+ &ItemInfo, hmenu->cyMenu, !(hmenu->fFlags & MNF_POPUP), ODA_SELECT);
}
if (sendMenuSelect)
{
WPARAM wParam = MAKEWPARAM( ItemInfo.hSubMenu ? wIndex : ItemInfo.wID,
ItemInfo.fType | ItemInfo.fState |
(ItemInfo.hSubMenu ? MF_POPUP : 0) |
- (hmenu->fFlags & MNF_SYSDESKMN ? MF_SYSMENU : 0 ) );
+ (hmenu->fFlags & MNF_SYSMENU ? MF_SYSMENU : 0 ) );
SendMessageW(hwndOwner, WM_MENUSELECT, wParam, (LPARAM) hmenu->Self);
}
{
WPARAM wParam = MAKEWPARAM( Pos, ItemInfo.fType | ItemInfo.fState |
(ItemInfo.hSubMenu ? MF_POPUP : 0) |
- (TopMenuInfo.fFlags & MNF_SYSDESKMN ? MF_SYSMENU : 0 ) );
+ (TopMenuInfo.fFlags & MNF_SYSMENU ? MF_SYSMENU : 0 ) );
SendMessageW(hwndOwner, WM_MENUSELECT, wParam, (LPARAM) topmenu);
}
TRACE("Menu item: [%08x,%08x,%04x,%04x,%S]\n",
mii.fType, mii.fState, mii.wID, resinfo, mii.dwTypeData);
- if (resinfo & 1) /* Pop-up? */
- {
+ if (resinfo & 1) /* Pop-up? */
+ {
/* DWORD helpid = GET_DWORD(res); FIXME: use this. */
res += sizeof(DWORD);
mii.hSubMenu = CreatePopupMenu();
}
else if (!mii.dwTypeData[0] && !(mii.fType & MF_SEPARATOR))
{
+ WARN("Converting NULL menu item %04x, type %04x to SEPARATOR\n",
+ mii.wID, mii.fType);
mii.fType |= MF_SEPARATOR;
}
InsertMenuItemW(hMenu, -1, MF_BYPOSITION, &mii);
TRACE("owner=%x menu=%p 0x%04x\n", WndOwner, MenuInfo, SelectFirst);
- if (NO_SELECTED_ITEM == MenuInfo->iItem)
- {
- return MenuInfo->Self;
- }
+ if (MenuInfo->iItem == NO_SELECTED_ITEM) return MenuInfo->Self;
MenuInitRosMenuItemInfo(&ItemInfo);
if (! MenuGetRosMenuItemInfo(MenuInfo->Self, MenuInfo->iItem, &ItemInfo))
- {
+ {
MenuCleanupRosMenuItemInfo(&ItemInfo);
return MenuInfo->Self;
- }
- if (0 == (ItemInfo.hSubMenu) || 0 != (ItemInfo.fState & (MF_GRAYED | MF_DISABLED)))
- {
+ }
+
+ //item = &menu->rgItems[menu->iItem];
+ if (!(ItemInfo.hSubMenu) || (ItemInfo.fState & (MF_GRAYED | MF_DISABLED)))
+ {
MenuCleanupRosMenuItemInfo(&ItemInfo);
return MenuInfo->Self;
- }
+ }
/* message must be sent before using item,
because nearly everything may be changed by the application ! */
/* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */
- if (0 == (Flags & TPM_NONOTIFY))
- {
+ if (!(Flags & TPM_NONOTIFY))
+ {
SendMessageW(WndOwner, WM_INITMENUPOPUP, (WPARAM) ItemInfo.hSubMenu,
MAKELPARAM(MenuInfo->iItem, IS_SYSTEM_MENU(MenuInfo)));
- }
+ }
if (! MenuGetRosMenuItemInfo(MenuInfo->Self, MenuInfo->iItem, &ItemInfo))
- {
+ {
MenuCleanupRosMenuItemInfo(&ItemInfo);
return MenuInfo->Self;
- }
+ }
+
+ //item = &menu->rgItems[menu->iItem];
Rect = ItemInfo.Rect;
/* correct item if modified as a reaction to WM_INITMENUPOPUP message */
- if (0 == (ItemInfo.fState & MF_HILITE))
- {
- if (0 != (MenuInfo->fFlags & MNF_POPUP))
- {
- Dc = GetDC(MenuInfo->Wnd);
- }
- else
- {
- Dc = GetDCEx(MenuInfo->Wnd, 0, DCX_CACHE | DCX_WINDOW);
- }
+ if (!(ItemInfo.fState & MF_HILITE))
+ {
+ if (MenuInfo->fFlags & MNF_POPUP) Dc = GetDC(MenuInfo->Wnd);
+ else Dc = GetDCEx(MenuInfo->Wnd, 0, DCX_CACHE | DCX_WINDOW);
SelectObject(Dc, hMenuFont);
ItemInfo.fMask |= MIIM_STATE;
MenuDrawMenuItem(MenuInfo->Wnd, MenuInfo, WndOwner, Dc, &ItemInfo, MenuInfo->cyMenu,
!(MenuInfo->fFlags & MNF_POPUP), ODA_DRAWENTIRE);
ReleaseDC(MenuInfo->Wnd, Dc);
- }
+ }
- if (0 == ItemInfo.Rect.top && 0 == ItemInfo.Rect.left
- && 0 == ItemInfo.Rect.bottom && 0 == ItemInfo.Rect.right)
- {
+ if (!ItemInfo.Rect.top && !ItemInfo.Rect.left && !ItemInfo.Rect.bottom && !ItemInfo.Rect.right)
ItemInfo.Rect = Rect;
- }
ItemInfo.fMask |= MIIM_STATE;
ItemInfo.fState |= MF_MOUSESELECT;
if (IS_SYSTEM_MENU(MenuInfo))
{
- ERR("Right click on window bar and Draw system menu!\n");
- MenuInitSysMenuPopup(ItemInfo.hSubMenu, GetWindowLongPtrW(MenuInfo->Wnd, GWL_STYLE),
+ MenuInitSysMenuPopup(ItemInfo.hSubMenu,
+ GetWindowLongPtrW(MenuInfo->Wnd, GWL_STYLE),
GetClassLongPtrW(MenuInfo->Wnd, GCL_STYLE), HTSYSMENU);
- if (Flags & TPM_LAYOUTRTL) Rect.left;
+
NcGetSysPopupPos(MenuInfo->Wnd, &Rect);
+ if (Flags & TPM_LAYOUTRTL) Rect.left = Rect.right;
Rect.top = Rect.bottom;
Rect.right = GetSystemMetrics(SM_CXSIZE);
Rect.bottom = GetSystemMetrics(SM_CYSIZE);
else
{
GetWindowRect(MenuInfo->Wnd, &Rect);
- if (0 != (MenuInfo->fFlags & MNF_POPUP))
+ if (MenuInfo->fFlags & MNF_POPUP)
{
RECT rc = ItemInfo.Rect;
MENU_AdjustMenuItemRect(MenuInfo, &rc);
+ /* The first item in the popup menu has to be at the
+ same y position as the focused menu item */
if(Flags & TPM_LAYOUTRTL)
Rect.left += GetSystemMetrics(SM_CXBORDER);
else
- Rect.left += ItemInfo.Rect.right- GetSystemMetrics(SM_CXBORDER);
+ Rect.left += rc.right /*ItemInfo.Rect.right*/ - GetSystemMetrics(SM_CXBORDER);
Rect.top += rc.top - MENU_TOP_MARGIN;//3;
Rect.right = rc.left - rc.right + GetSystemMetrics(SM_CXBORDER);
Rect.bottom = rc.top - rc.bottom - MENU_TOP_MARGIN - MENU_BOTTOM_MARGIN/*2*/
TRACE("owner=%x menu=%x 0x%04x\n", WndOwner, MenuInfo, SendMenuSelect);
- if (NULL != MenuInfo && NULL != top_popup && NO_SELECTED_ITEM != MenuInfo->iItem)
+ if (MenuInfo && top_popup && NO_SELECTED_ITEM != MenuInfo->iItem)
{
+ //item = &menu->rgItems[menu->iItem];
MenuInitRosMenuItemInfo(&ItemInfo);
ItemInfo.fMask |= MIIM_FTYPE | MIIM_STATE;
if (! MenuGetRosMenuItemInfo(MenuInfo->Self, MenuInfo->iItem, &ItemInfo)
- || 0 == (ItemInfo.hSubMenu)
- || 0 == (ItemInfo.fState & MF_MOUSESELECT))
+ || !(ItemInfo.hSubMenu)
+ || !(ItemInfo.fState & MF_MOUSESELECT))
{
MenuCleanupRosMenuItemInfo(&ItemInfo);
return;
MenuHideSubPopups(WndOwner, &SubMenuInfo, FALSE, wFlags);
MenuSelectItem(WndOwner, &SubMenuInfo, NO_SELECTED_ITEM, SendMenuSelect, NULL);
+ DestroyWindow(SubMenuInfo.Wnd);
+ /* Native returns handle to destroyed window */
if (!(wFlags & TPM_NONOTIFY))
SendMessageW( WndOwner, WM_UNINITMENUPOPUP, (WPARAM)ItemInfo.hSubMenu,
MAKELPARAM(0, IS_SYSTEM_MENU(&SubMenuInfo)) );
// Call WM_UNINITMENUPOPUP FIRST before destroy!!
// Fixes todo_wine User32 test menu.c line 2233 GetMenuBarInfo callback....
//
- DestroyWindow(SubMenuInfo.Wnd);
SubMenuInfo.Wnd = NULL;
MenuSetRosMenuInfo(&SubMenuInfo);
////
* Helper function for menu navigation routines.
*/
static void FASTCALL
-MenuSwitchTracking(MTRACKER* Mt, PROSMENUINFO PtMenuInfo, UINT Index, UINT wFlags)
+MenuSwitchTracking(MTRACKER* pmt, PROSMENUINFO PtMenuInfo, UINT Index, UINT wFlags)
{
ROSMENUINFO TopMenuInfo;
- TRACE("%x menu=%x 0x%04x\n", Mt, PtMenuInfo->Self, Index);
+ TRACE("%x menu=%x 0x%04x\n", pmt, PtMenuInfo->Self, Index);
- if (MenuGetRosMenuInfo(&TopMenuInfo, Mt->TopMenu) &&
- Mt->TopMenu != PtMenuInfo->Self &&
- 0 == ((PtMenuInfo->fFlags | TopMenuInfo.fFlags) & MNF_POPUP))
- {
+ if ( MenuGetRosMenuInfo(&TopMenuInfo, pmt->TopMenu) &&
+ pmt->TopMenu != PtMenuInfo->Self &&
+ !((PtMenuInfo->fFlags | TopMenuInfo.fFlags) & MNF_POPUP) )
+ {
/* both are top level menus (system and menu-bar) */
- MenuHideSubPopups(Mt->OwnerWnd, &TopMenuInfo, FALSE, wFlags);
- MenuSelectItem(Mt->OwnerWnd, &TopMenuInfo, NO_SELECTED_ITEM, FALSE, NULL);
- Mt->TopMenu = PtMenuInfo->Self;
- }
+ MenuHideSubPopups(pmt->OwnerWnd, &TopMenuInfo, FALSE, wFlags);
+ MenuSelectItem(pmt->OwnerWnd, &TopMenuInfo, NO_SELECTED_ITEM, FALSE, NULL);
+ pmt->TopMenu = PtMenuInfo->Self;
+ }
else
- {
- MenuHideSubPopups(Mt->OwnerWnd, PtMenuInfo, FALSE, wFlags);
- }
+ {
+ MenuHideSubPopups(pmt->OwnerWnd, PtMenuInfo, FALSE, wFlags);
+ }
- MenuSelectItem(Mt->OwnerWnd, PtMenuInfo, Index, TRUE, NULL);
+ MenuSelectItem(pmt->OwnerWnd, PtMenuInfo, Index, TRUE, NULL);
}
/***********************************************************************
*
*/
static INT FASTCALL
-MenuExecFocusedItem(MTRACKER *Mt, PROSMENUINFO MenuInfo, UINT Flags)
+MenuExecFocusedItem(MTRACKER *pmt, PROSMENUINFO MenuInfo, UINT Flags)
{
ROSMENUITEMINFO ItemInfo;
UINT wID;
- TRACE("%p menu=%p\n", Mt, MenuInfo);
+ TRACE("%p menu=%p\n", pmt, MenuInfo);
if (0 == MenuInfo->cItems || NO_SELECTED_ITEM == MenuInfo->iItem)
- {
+ {
return -1;
- }
+ }
MenuInitRosMenuItemInfo(&ItemInfo);
if (! MenuGetRosMenuItemInfo(MenuInfo->Self, MenuInfo->iItem, &ItemInfo))
- {
+ {
MenuCleanupRosMenuItemInfo(&ItemInfo);
return -1;
- }
+ }
TRACE("%p %08x %p\n", MenuInfo, ItemInfo.wID, ItemInfo.hSubMenu);
if (0 == (ItemInfo.hSubMenu))
- {
+ {
if (0 == (ItemInfo.fState & (MF_GRAYED | MF_DISABLED))
&& 0 == (ItemInfo.fType & MF_SEPARATOR))
- {
+ {
/* If TPM_RETURNCMD is set you return the id, but
do not send a message to the owner */
if (0 == (Flags & TPM_RETURNCMD))
- {
- if (0 != (MenuInfo->fFlags & MNF_SYSDESKMN))
- {
- PostMessageW(Mt->OwnerWnd, WM_SYSCOMMAND, ItemInfo.wID,
- MAKELPARAM((SHORT) Mt->Pt.x, (SHORT) Mt->Pt.y));
- }
+ {
+ if (0 != (MenuInfo->fFlags & MNF_SYSMENU))
+ {
+ PostMessageW(pmt->OwnerWnd, WM_SYSCOMMAND, ItemInfo.wID,
+ MAKELPARAM((SHORT) pmt->Pt.x, (SHORT) pmt->Pt.y));
+ }
else
- {
+ {
ROSMENUINFO topmenuI;
- BOOL ret = MenuGetRosMenuInfo(&topmenuI, Mt->TopMenu);
+ BOOL ret = MenuGetRosMenuInfo(&topmenuI, pmt->TopMenu);
DWORD dwStyle = MenuInfo->dwStyle | (ret ? topmenuI.dwStyle : 0);
if (dwStyle & MNS_NOTIFYBYPOS)
- PostMessageW(Mt->OwnerWnd, WM_MENUCOMMAND, MenuInfo->iItem, (LPARAM)MenuInfo->Self);
+ PostMessageW(pmt->OwnerWnd, WM_MENUCOMMAND, MenuInfo->iItem, (LPARAM)MenuInfo->Self);
else
- PostMessageW(Mt->OwnerWnd, WM_COMMAND, ItemInfo.wID, 0);
- }
- }
+ PostMessageW(pmt->OwnerWnd, WM_COMMAND, ItemInfo.wID, 0);
+ }
+ }
wID = ItemInfo.wID;
MenuCleanupRosMenuItemInfo(&ItemInfo);
return wID;
- }
- }
+ }
+ }
else
- {
- Mt->CurrentMenu = MenuShowSubPopup(Mt->OwnerWnd, MenuInfo, TRUE, Flags);
+ {
+ pmt->CurrentMenu = MenuShowSubPopup(pmt->OwnerWnd, MenuInfo, TRUE, Flags);
return -2;
- }
+ }
return -1;
}
* Return TRUE if we can go on with menu tracking.
*/
static BOOL FASTCALL
-MENU_ButtonDown(MTRACKER* Mt, HMENU PtMenu, UINT Flags)
+MENU_ButtonDown(MTRACKER* pmt, HMENU hPtMenu, UINT Flags)
{
int Index;
ROSMENUINFO MenuInfo;
ROSMENUITEMINFO Item;
- TRACE("%x PtMenu=%p\n", Mt, PtMenu);
+ TRACE("%x PtMenu=%p\n", pmt, hPtMenu);
- if (NULL != PtMenu)
- {
- if (! MenuGetRosMenuInfo(&MenuInfo, PtMenu))
- {
+ if (NULL != hPtMenu)
+ {
+ if (! MenuGetRosMenuInfo(&MenuInfo, hPtMenu))
+ {
return FALSE;
- }
+ }
if (IS_SYSTEM_MENU(&MenuInfo))
- {
+ {
Index = 0;
- }
+ }
else
- {
- Index = NtUserMenuItemFromPoint(Mt->OwnerWnd, PtMenu, Mt->Pt.x, Mt->Pt.y);
- }
+ {
+ Index = NtUserMenuItemFromPoint(pmt->OwnerWnd, hPtMenu, pmt->Pt.x, pmt->Pt.y);
+ }
MenuInitRosMenuItemInfo(&Item);
- if (NO_SELECTED_ITEM == Index || ! MenuGetRosMenuItemInfo(PtMenu, Index, &Item))
- {
+ if (NO_SELECTED_ITEM == Index || ! MenuGetRosMenuItemInfo(hPtMenu, Index, &Item))
+ {
MenuCleanupRosMenuItemInfo(&Item);
return FALSE;
- }
+ }
if (!(Item.fType & MF_SEPARATOR) &&
!(Item.fState & (MFS_DISABLED | MFS_GRAYED)) )
- {
+ {
if (MenuInfo.iItem != Index)
- {
- MenuSwitchTracking(Mt, &MenuInfo, Index, Flags);
- }
+ {
+ MenuSwitchTracking(pmt, &MenuInfo, Index, Flags);
+ }
/* If the popup menu is not already "popped" */
- if (0 == (Item.fState & MF_MOUSESELECT))
- {
- Mt->CurrentMenu = MenuShowSubPopup(Mt->OwnerWnd, &MenuInfo, FALSE, Flags);
- }
- }
-
- MenuCleanupRosMenuItemInfo(&Item);
-
- return TRUE;
- }
+ if (!(Item.fState & MF_MOUSESELECT))
+ {
+ pmt->CurrentMenu = MenuShowSubPopup(pmt->OwnerWnd, &MenuInfo, FALSE, Flags);
+ }
- /* else the click was on the menu bar, finish the tracking */
+ MenuCleanupRosMenuItemInfo(&Item);
+ return TRUE;
+ }
+ /* Else the click was on the menu bar, finish the tracking */
+ }
return FALSE;
}
*
*/
static INT FASTCALL
-MENU_ButtonUp(MTRACKER *Mt, HMENU PtMenu, UINT Flags)
+MENU_ButtonUp(MTRACKER *pmt, HMENU hPtMenu, UINT Flags)
{
INT Id;
ROSMENUINFO MenuInfo;
ROSMENUITEMINFO ItemInfo;
- TRACE("%p hmenu=%x\n", Mt, PtMenu);
+ TRACE("%p hmenu=%x\n", pmt, hPtMenu);
- if (NULL != PtMenu)
- {
+ if (hPtMenu)
+ {
Id = 0;
- if (! MenuGetRosMenuInfo(&MenuInfo, PtMenu))
- {
+ if (! MenuGetRosMenuInfo(&MenuInfo, hPtMenu))
+ {
return -1;
- }
+ }
if (! IS_SYSTEM_MENU(&MenuInfo))
- {
- Id = NtUserMenuItemFromPoint(Mt->OwnerWnd, MenuInfo.Self, Mt->Pt.x, Mt->Pt.y);
- }
+ {
+ Id = NtUserMenuItemFromPoint(pmt->OwnerWnd, MenuInfo.Self, pmt->Pt.x, pmt->Pt.y);
+ }
MenuInitRosMenuItemInfo(&ItemInfo);
if (0 <= Id && MenuGetRosMenuItemInfo(MenuInfo.Self, Id, &ItemInfo) &&
MenuInfo.iItem == Id)
- {
+ {
if (0 == (ItemInfo.hSubMenu))
- {
- INT ExecutedMenuId = MenuExecFocusedItem(Mt, &MenuInfo, Flags);
+ {
+ INT ExecutedMenuId = MenuExecFocusedItem( pmt, &MenuInfo, Flags);
MenuCleanupRosMenuItemInfo(&ItemInfo);
- return (ExecutedMenuId < 0) ? -1 : ExecutedMenuId;
- }
+ if (ExecutedMenuId == -1 || ExecutedMenuId == -2) return -1;
+ return ExecutedMenuId;
+ }
MenuCleanupRosMenuItemInfo(&ItemInfo);
- /* If we are dealing with the top-level menu */
+ /* If we are dealing with the menu bar */
/* and this is a click on an already "popped" item: */
/* Stop the menu tracking and close the opened submenus */
- if (Mt->TopMenu == MenuInfo.Self && MenuInfo.TimeToHide)
- {
+ if (pmt->TopMenu == MenuInfo.Self && MenuInfo.TimeToHide)
+ {
MenuCleanupRosMenuItemInfo(&ItemInfo);
return 0;
- }
- }
+ }
+ }
MenuCleanupRosMenuItemInfo(&ItemInfo);
- MenuInfo.TimeToHide = TRUE;
- MenuSetRosMenuInfo(&MenuInfo);
- }
-
+ if( GetMenu(MenuInfo.Wnd) == hPtMenu )
+ {
+ MenuInfo.TimeToHide = TRUE;
+ MenuSetRosMenuInfo(&MenuInfo);
+ }
+ }
return -1;
}
if (ht != HTNOWHERE && ht != HTERROR) ret = hMenu;
}
else if (ht == HTSYSMENU)
- ret = NtUserGetSystemMenu(menu->hWnd, FALSE);
+ ret = get_win_sys_menu(menu->hWnd);
else if (ht == HTMENU)
ret = GetMenu( menu->hWnd );
}
* Return TRUE if we can go on with menu tracking.
*/
static BOOL FASTCALL
-MenuMouseMove(MTRACKER *Mt, HMENU PtMenu, UINT Flags)
+MenuMouseMove(MTRACKER *pmt, HMENU PtMenu, UINT Flags)
{
INT Index;
ROSMENUINFO MenuInfo;
ROSMENUITEMINFO ItemInfo;
if (NULL != PtMenu)
- {
+ {
if (! MenuGetRosMenuInfo(&MenuInfo, PtMenu))
- {
+ {
return TRUE;
- }
+ }
if (IS_SYSTEM_MENU(&MenuInfo))
- {
+ {
Index = 0;
- }
+ }
else
- {
- Index = NtUserMenuItemFromPoint(Mt->OwnerWnd, PtMenu, Mt->Pt.x, Mt->Pt.y);
- }
- }
+ {
+ Index = NtUserMenuItemFromPoint(pmt->OwnerWnd, PtMenu, pmt->Pt.x, pmt->Pt.y);
+ }
+ }
else
- {
+ {
Index = NO_SELECTED_ITEM;
- }
+ }
if (NO_SELECTED_ITEM == Index)
- {
- if (Mt->CurrentMenu == MenuInfo.Self ||
- MenuGetRosMenuInfo(&MenuInfo, Mt->CurrentMenu))
- {
- MenuSelectItem(Mt->OwnerWnd, &MenuInfo, NO_SELECTED_ITEM,
- TRUE, Mt->TopMenu);
- }
- }
+ {
+ if (pmt->CurrentMenu == MenuInfo.Self ||
+ MenuGetRosMenuInfo(&MenuInfo, pmt->CurrentMenu))
+ {
+ MenuSelectItem(pmt->OwnerWnd, &MenuInfo, NO_SELECTED_ITEM,
+ TRUE, pmt->TopMenu);
+ }
+ }
else if (MenuInfo.iItem != Index)
- {
+ {
MenuInitRosMenuItemInfo(&ItemInfo);
if (MenuGetRosMenuItemInfo(MenuInfo.Self, Index, &ItemInfo) &&
- !(ItemInfo.fType & MF_SEPARATOR))
+ !(ItemInfo.fType & MF_SEPARATOR))
{
- MenuSwitchTracking(Mt, &MenuInfo, Index, Flags);
- if (!(ItemInfo.fState & (MFS_DISABLED | MFS_GRAYED)))
- Mt->CurrentMenu = MenuShowSubPopup(Mt->OwnerWnd, &MenuInfo, FALSE, Flags);
+ MenuSwitchTracking(pmt, &MenuInfo, Index, Flags);
+ if (!(ItemInfo.fState & (MFS_DISABLED | MFS_GRAYED)))
+ pmt->CurrentMenu = MenuShowSubPopup(pmt->OwnerWnd, &MenuInfo, FALSE, Flags);
}
MenuCleanupRosMenuItemInfo(&ItemInfo);
- }
+ }
return TRUE;
}
* NOTE: WM_NEXTMENU documented in Win32 is a bit different.
*/
static LRESULT FASTCALL
-MenuDoNextMenu(MTRACKER* Mt, UINT Vk, UINT wFlags)
+MenuDoNextMenu(MTRACKER* pmt, UINT Vk, UINT wFlags)
{
ROSMENUINFO TopMenuInfo;
ROSMENUINFO MenuInfo;
- if (! MenuGetRosMenuInfo(&TopMenuInfo, Mt->TopMenu))
- {
+ if (! MenuGetRosMenuInfo(&TopMenuInfo, pmt->TopMenu))
+ {
return (LRESULT) FALSE;
- }
+ }
if ((VK_LEFT == Vk && 0 == TopMenuInfo.iItem)
|| (VK_RIGHT == Vk && TopMenuInfo.iItem == TopMenuInfo.cItems - 1))
- {
+ {
MDINEXTMENU NextMenu;
HMENU NewMenu;
HWND NewWnd;
UINT Id = 0;
- NextMenu.hmenuIn = (IS_SYSTEM_MENU(&TopMenuInfo)) ? GetSubMenu(Mt->TopMenu, 0) : Mt->TopMenu;
+ NextMenu.hmenuIn = (IS_SYSTEM_MENU(&TopMenuInfo)) ? GetSubMenu(pmt->TopMenu, 0) : pmt->TopMenu;
NextMenu.hmenuNext = NULL;
NextMenu.hwndNext = NULL;
- SendMessageW(Mt->OwnerWnd, WM_NEXTMENU, Vk, (LPARAM) &NextMenu);
+ SendMessageW(pmt->OwnerWnd, WM_NEXTMENU, Vk, (LPARAM) &NextMenu);
TRACE("%p [%p] -> %p [%p]\n",
- Mt->CurrentMenu, Mt->OwnerWnd, NextMenu.hmenuNext, NextMenu.hwndNext );
+ pmt->CurrentMenu, pmt->OwnerWnd, NextMenu.hmenuNext, NextMenu.hwndNext );
if (NULL == NextMenu.hmenuNext || NULL == NextMenu.hwndNext)
- {
- DWORD Style = GetWindowLongPtrW(Mt->OwnerWnd, GWL_STYLE);
- NewWnd = Mt->OwnerWnd;
+ {
+ DWORD Style = GetWindowLongPtrW(pmt->OwnerWnd, GWL_STYLE);
+ NewWnd = pmt->OwnerWnd;
if (IS_SYSTEM_MENU(&TopMenuInfo))
- {
+ {
/* switch to the menu bar */
if (0 != (Style & WS_CHILD)
|| NULL == (NewMenu = GetMenu(NewWnd)))
- {
+ {
return FALSE;
- }
+ }
if (VK_LEFT == Vk)
- {
+ {
if (! MenuGetRosMenuInfo(&MenuInfo, NewMenu))
- {
+ {
return FALSE;
- }
+ }
Id = MenuInfo.cItems - 1;
- }
- }
+ }
+ }
else if (0 != (Style & WS_SYSMENU))
- {
+ {
/* switch to the system menu */
- NewMenu = NtUserGetSystemMenu(NewWnd, FALSE);
- }
+ NewMenu = get_win_sys_menu(NewWnd);
+ }
else
- {
+ {
return FALSE;
- }
- }
+ }
+ }
else /* application returned a new menu to switch to */
- {
+ {
NewMenu = NextMenu.hmenuNext;
NewWnd = NextMenu.hwndNext;
if (IsMenu(NewMenu) && IsWindow(NewWnd))
- {
+ {
DWORD Style = GetWindowLongPtrW(NewWnd, GWL_STYLE);
if (0 != (Style & WS_SYSMENU)
- && GetSystemMenu(NewWnd, FALSE) == NewMenu)
- {
+ && get_win_sys_menu(NewWnd) == NewMenu)
+ {
/* get the real system menu */
- NewMenu = NtUserGetSystemMenu(NewWnd, FALSE);
- }
+ NewMenu = get_win_sys_menu(NewWnd);
+ }
else if (0 != (Style & WS_CHILD) || GetMenu(NewWnd) != NewMenu)
- {
+ {
/* FIXME: Not sure what to do here;
* perhaps try to track NewMenu as a popup? */
WARN(" -- got confused.\n");
return FALSE;
- }
- }
+ }
+ }
else
- {
+ {
return FALSE;
- }
- }
+ }
+ }
- if (NewMenu != Mt->TopMenu)
- {
- MenuSelectItem(Mt->OwnerWnd, &TopMenuInfo, NO_SELECTED_ITEM,
+ if (NewMenu != pmt->TopMenu)
+ {
+ MenuSelectItem(pmt->OwnerWnd, &TopMenuInfo, NO_SELECTED_ITEM,
FALSE, 0 );
- if (Mt->CurrentMenu != Mt->TopMenu)
- {
- MenuHideSubPopups(Mt->OwnerWnd, &TopMenuInfo, FALSE, wFlags);
- }
- }
+ if (pmt->CurrentMenu != pmt->TopMenu)
+ {
+ MenuHideSubPopups(pmt->OwnerWnd, &TopMenuInfo, FALSE, wFlags);
+ }
+ }
- if (NewWnd != Mt->OwnerWnd)
- {
- Mt->OwnerWnd = NewWnd;
- NtUserxSetGUIThreadHandle(MSQ_STATE_MENUOWNER, Mt->OwnerWnd); // 1
- SetCapture(Mt->OwnerWnd); // 2
- }
+ if (NewWnd != pmt->OwnerWnd)
+ {
+ pmt->OwnerWnd = NewWnd;
+ NtUserxSetGUIThreadHandle(MSQ_STATE_MENUOWNER, pmt->OwnerWnd); // 1
+ SetCapture(pmt->OwnerWnd); // 2
+ }
- Mt->TopMenu = Mt->CurrentMenu = NewMenu; /* all subpopups are hidden */
- if (MenuGetRosMenuInfo(&TopMenuInfo, Mt->TopMenu))
- {
- MenuSelectItem(Mt->OwnerWnd, &TopMenuInfo, Id, TRUE, 0);
- }
+ pmt->TopMenu = pmt->CurrentMenu = NewMenu; /* all subpopups are hidden */
+ if (MenuGetRosMenuInfo(&TopMenuInfo, pmt->TopMenu))
+ {
+ MenuSelectItem(pmt->OwnerWnd, &TopMenuInfo, Id, TRUE, 0);
+ }
return TRUE;
- }
+ }
return FALSE;
}
* going to hide it anyway.
*/
static BOOL FASTCALL
-MenuSuspendPopup(MTRACKER* Mt, UINT uMsg)
+MenuSuspendPopup(MTRACKER* pmt, UINT uMsg)
{
MSG msg;
- msg.hwnd = Mt->OwnerWnd;
+ msg.hwnd = pmt->OwnerWnd;
PeekMessageW( &msg, 0, uMsg, uMsg, PM_NOYIELD | PM_REMOVE); // ported incorrectly since 8317 GvG
-// Mt->TrackFlags |= TF_SKIPREMOVE; // This sends TrackMenu into a loop with arrow keys!!!!
+ //pmt->TrackFlags |= TF_SKIPREMOVE; // This sends TrackMenu into a loop with arrow keys!!!!
switch( uMsg )
{
if( msg.message == WM_KEYDOWN &&
(msg.wParam == VK_LEFT || msg.wParam == VK_RIGHT))
{
- Mt->TrackFlags |= TF_SUSPENDPOPUP;
+ pmt->TrackFlags |= TF_SUSPENDPOPUP;
return TRUE;
}
}
break;
}
/* failures go through this */
- Mt->TrackFlags &= ~TF_SUSPENDPOPUP;
+ pmt->TrackFlags &= ~TF_SUSPENDPOPUP;
return FALSE;
}
* Handle a VK_ESCAPE key event in a menu.
*/
static BOOL FASTCALL
-MenuKeyEscape(MTRACKER *Mt, UINT Flags)
+MenuKeyEscape(MTRACKER *pmt, UINT Flags)
{
BOOL EndMenu = TRUE;
ROSMENUINFO MenuInfo;
HMENU MenuTmp, MenuPrev;
- if (Mt->CurrentMenu != Mt->TopMenu)
- {
- if (MenuGetRosMenuInfo(&MenuInfo, Mt->CurrentMenu)
+ if (pmt->CurrentMenu != pmt->TopMenu)
+ {
+ if (MenuGetRosMenuInfo(&MenuInfo, pmt->CurrentMenu)
&& 0 != (MenuInfo.fFlags & MNF_POPUP))
- {
- MenuPrev = MenuTmp = Mt->TopMenu;
+ {
+ MenuPrev = MenuTmp = pmt->TopMenu;
/* close topmost popup */
- while (MenuTmp != Mt->CurrentMenu)
- {
+ while (MenuTmp != pmt->CurrentMenu)
+ {
MenuPrev = MenuTmp;
MenuTmp = MENU_GetSubPopup(MenuPrev);
- }
+ }
if (MenuGetRosMenuInfo(&MenuInfo, MenuPrev))
- {
- MenuHideSubPopups(Mt->OwnerWnd, &MenuInfo, TRUE, Flags);
- }
- Mt->CurrentMenu = MenuPrev;
+ {
+ MenuHideSubPopups(pmt->OwnerWnd, &MenuInfo, TRUE, Flags);
+ }
+ pmt->CurrentMenu = MenuPrev;
EndMenu = FALSE;
- }
- }
+ }
+ }
return EndMenu;
}
* Handle a VK_LEFT key event in a menu.
*/
static void FASTCALL
-MenuKeyLeft(MTRACKER* Mt, UINT Flags)
+MenuKeyLeft(MTRACKER* pmt, UINT Flags)
{
ROSMENUINFO MenuInfo;
ROSMENUINFO TopMenuInfo;
HMENU MenuTmp, MenuPrev;
UINT PrevCol;
- MenuPrev = MenuTmp = Mt->TopMenu;
+ MenuPrev = MenuTmp = pmt->TopMenu;
/* Try to move 1 column left (if possible) */
- if ( (PrevCol = MENU_GetStartOfPrevColumn(Mt->CurrentMenu)) != NO_SELECTED_ITEM)
+ if ( (PrevCol = MENU_GetStartOfPrevColumn(pmt->CurrentMenu)) != NO_SELECTED_ITEM)
{
- if (MenuGetRosMenuInfo(&MenuInfo, Mt->CurrentMenu))
+ if (MenuGetRosMenuInfo(&MenuInfo, pmt->CurrentMenu))
{
- MenuSelectItem(Mt->OwnerWnd, &MenuInfo, PrevCol, TRUE, 0);
+ MenuSelectItem(pmt->OwnerWnd, &MenuInfo, PrevCol, TRUE, 0);
}
return;
}
/* close topmost popup */
- while (MenuTmp != Mt->CurrentMenu)
- {
+ while (MenuTmp != pmt->CurrentMenu)
+ {
MenuPrev = MenuTmp;
MenuTmp = MENU_GetSubPopup(MenuPrev);
- }
+ }
if (! MenuGetRosMenuInfo(&PrevMenuInfo, MenuPrev))
- {
+ {
return;
- }
- MenuHideSubPopups(Mt->OwnerWnd, &PrevMenuInfo, TRUE, Flags);
- Mt->CurrentMenu = MenuPrev;
+ }
+ MenuHideSubPopups(pmt->OwnerWnd, &PrevMenuInfo, TRUE, Flags);
+ pmt->CurrentMenu = MenuPrev;
- if (! MenuGetRosMenuInfo(&TopMenuInfo, Mt->TopMenu))
- {
+ if (! MenuGetRosMenuInfo(&TopMenuInfo, pmt->TopMenu))
+ {
return;
- }
- if ((MenuPrev == Mt->TopMenu) && !(TopMenuInfo.fFlags & MNF_POPUP))
- {
+ }
+ if ((MenuPrev == pmt->TopMenu) && !(TopMenuInfo.fFlags & MNF_POPUP))
+ {
/* move menu bar selection if no more popups are left */
- if (!MenuDoNextMenu(Mt, VK_LEFT, Flags))
- {
- MenuMoveSelection(Mt->OwnerWnd, &TopMenuInfo, ITEM_PREV);
- }
+ if (!MenuDoNextMenu(pmt, VK_LEFT, Flags))
+ {
+ MenuMoveSelection(pmt->OwnerWnd, &TopMenuInfo, ITEM_PREV);
+ }
- if (MenuPrev != MenuTmp || Mt->TrackFlags & TF_SUSPENDPOPUP)
- {
+ if (MenuPrev != MenuTmp || pmt->TrackFlags & TF_SUSPENDPOPUP)
+ {
/* A sublevel menu was displayed - display the next one
* unless there is another displacement coming up */
- if (! MenuSuspendPopup(Mt, WM_KEYDOWN)
- && MenuGetRosMenuInfo(&TopMenuInfo, Mt->TopMenu))
- {
- Mt->CurrentMenu = MenuShowSubPopup(Mt->OwnerWnd, &TopMenuInfo,
+ if (! MenuSuspendPopup(pmt, WM_KEYDOWN)
+ && MenuGetRosMenuInfo(&TopMenuInfo, pmt->TopMenu))
+ {
+ pmt->CurrentMenu = MenuShowSubPopup(pmt->OwnerWnd, &TopMenuInfo,
TRUE, Flags);
- }
- }
- }
+ }
+ }
+ }
}
/***********************************************************************
*
* Handle a VK_RIGHT key event in a menu.
*/
-static void FASTCALL MenuKeyRight(MTRACKER *Mt, UINT Flags)
+static void FASTCALL MenuKeyRight(MTRACKER *pmt, UINT Flags)
{
HMENU hmenutmp;
ROSMENUINFO MenuInfo;
UINT NextCol;
TRACE("MenuKeyRight called, cur %p, top %p.\n",
- Mt->CurrentMenu, Mt->TopMenu);
+ pmt->CurrentMenu, pmt->TopMenu);
- if (! MenuGetRosMenuInfo(&MenuInfo, Mt->TopMenu)) return;
- if ((MenuInfo.fFlags & MNF_POPUP) || (Mt->CurrentMenu != Mt->TopMenu))
+ if (! MenuGetRosMenuInfo(&MenuInfo, pmt->TopMenu)) return;
+ if ((MenuInfo.fFlags & MNF_POPUP) || (pmt->CurrentMenu != pmt->TopMenu))
{
/* If already displaying a popup, try to display sub-popup */
- hmenutmp = Mt->CurrentMenu;
- if (MenuGetRosMenuInfo(&CurrentMenuInfo, Mt->CurrentMenu))
+ hmenutmp = pmt->CurrentMenu;
+ if (MenuGetRosMenuInfo(&CurrentMenuInfo, pmt->CurrentMenu))
{
- Mt->CurrentMenu = MenuShowSubPopup(Mt->OwnerWnd, &CurrentMenuInfo, TRUE, Flags);
+ pmt->CurrentMenu = MenuShowSubPopup(pmt->OwnerWnd, &CurrentMenuInfo, TRUE, Flags);
}
/* if subpopup was displayed then we are done */
- if (hmenutmp != Mt->CurrentMenu) return;
+ if (hmenutmp != pmt->CurrentMenu) return;
}
/* Check to see if there's another column */
- if ( (NextCol = MENU_GetStartOfNextColumn(Mt->CurrentMenu)) != NO_SELECTED_ITEM)
+ if ( (NextCol = MENU_GetStartOfNextColumn(pmt->CurrentMenu)) != NO_SELECTED_ITEM)
{
TRACE("Going to %d.\n", NextCol);
- if (MenuGetRosMenuInfo(&MenuInfo, Mt->CurrentMenu))
+ if (MenuGetRosMenuInfo(&MenuInfo, pmt->CurrentMenu))
{
- MenuSelectItem(Mt->OwnerWnd, &MenuInfo, NextCol, TRUE, 0);
+ MenuSelectItem(pmt->OwnerWnd, &MenuInfo, NextCol, TRUE, 0);
}
return;
}
if (!(MenuInfo.fFlags & MNF_POPUP)) /* menu bar tracking */
{
- if (Mt->CurrentMenu != Mt->TopMenu)
- {
- MenuHideSubPopups(Mt->OwnerWnd, &MenuInfo, FALSE, Flags);
- hmenutmp = Mt->CurrentMenu = Mt->TopMenu;
- }
+ if (pmt->CurrentMenu != pmt->TopMenu)
+ {
+ MenuHideSubPopups(pmt->OwnerWnd, &MenuInfo, FALSE, Flags);
+ hmenutmp = pmt->CurrentMenu = pmt->TopMenu;
+ }
else
- {
+ {
hmenutmp = NULL;
- }
+ }
/* try to move to the next item */
- if ( !MenuDoNextMenu(Mt, VK_RIGHT, Flags))
- MenuMoveSelection(Mt->OwnerWnd, &MenuInfo, ITEM_NEXT);
+ if ( !MenuDoNextMenu(pmt, VK_RIGHT, Flags))
+ MenuMoveSelection(pmt->OwnerWnd, &MenuInfo, ITEM_NEXT);
- if ( hmenutmp || Mt->TrackFlags & TF_SUSPENDPOPUP )
- {
- if (! MenuSuspendPopup(Mt, WM_KEYDOWN)
- && MenuGetRosMenuInfo(&MenuInfo, Mt->TopMenu))
- {
- Mt->CurrentMenu = MenuShowSubPopup(Mt->OwnerWnd, &MenuInfo,
+ if ( hmenutmp || pmt->TrackFlags & TF_SUSPENDPOPUP )
+ {
+ if (! MenuSuspendPopup(pmt, WM_KEYDOWN)
+ && MenuGetRosMenuInfo(&MenuInfo, pmt->TopMenu))
+ {
+ pmt->CurrentMenu = MenuShowSubPopup(pmt->OwnerWnd, &MenuInfo,
TRUE, Flags);
- }
- }
+ }
+ }
}
}
/* Else, end menu tracking */
fRemove = MENU_ButtonDown(&mt, hmenu, wFlags);
fEndMenu = !fRemove;
+ if (msg.message == WM_LBUTTONDBLCLK) fEndMenu = TRUE; // Must exit or loop forever!
break;
case WM_RBUTTONUP:
IntNotifyWinEvent(EVENT_SYSTEM_MENUPOPUPEND, MenuInfo.Wnd, OBJID_CLIENT, CHILDID_SELF, 0);
DestroyWindow(MenuInfo.Wnd);
MenuInfo.Wnd = NULL;
+ MenuSetRosMenuInfo(&MenuInfo);
if (!(wFlags & TPM_NONOTIFY))
SendMessageW( mt.OwnerWnd, WM_UNINITMENUPOPUP, (WPARAM)mt.TopMenu,
*/
static BOOL FASTCALL MenuInitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags)
{
- ROSMENUINFO MenuInfo;
+ ROSMENUINFO MenuInfo = {0};
TRACE("hwnd=%p hmenu=%p\n", hWnd, hMenu);
+ if (!MenuGetRosMenuInfo(&MenuInfo, hMenu)) return FALSE;
+
HideCaret(0);
/* This makes the menus of applications built with Delphi work.
* It also enables menus to be displayed in more than one window,
* but there are some bugs left that need to be fixed in this case.
*/
- if (!bPopup && (MenuGetRosMenuInfo(&MenuInfo, hMenu)))
+ if (!bPopup)
{
MenuInfo.Wnd = hWnd;
MenuSetRosMenuInfo(&MenuInfo);
IntNotifyWinEvent( EVENT_SYSTEM_MENUSTART,
hWnd,
- MenuInfo.fFlags & MNF_SYSDESKMN ? OBJID_SYSMENU : OBJID_MENU,
+ MenuInfo.fFlags & MNF_SYSMENU ? OBJID_SYSMENU : OBJID_MENU,
CHILDID_SELF, 0);
return TRUE;
}
*/
VOID MenuTrackMouseMenuBar( HWND hWnd, ULONG ht, POINT pt)
{
- HMENU hMenu = (ht == HTSYSMENU) ? NtUserGetSystemMenu( hWnd, FALSE) : GetMenu(hWnd);
+ HMENU hMenu = (ht == HTSYSMENU) ? get_win_sys_menu( hWnd ) : GetMenu(hWnd);
UINT wFlags = TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON;
TRACE("wnd=%p ht=0x%04x (%ld,%ld)\n", hWnd, ht, pt.x, pt.y);
}
MenuInitTracking(hWnd, hMenu, FALSE, wFlags);
+ /* fetch the window menu again, it may have changed */
+ hMenu = (ht == HTSYSMENU) ? get_win_sys_menu( hWnd ) : GetMenu( hWnd );
MenuTrackMenu(hMenu, wFlags, pt.x, pt.y, hWnd, NULL);
MenuExitTracking(hWnd, FALSE);
}
if (!hTrackMenu || IsIconic(hwnd) || wChar == ' ' )
{
if (!(GetWindowLongPtrW( hwnd, GWL_STYLE ) & WS_SYSMENU)) return;
- hTrackMenu = NtUserGetSystemMenu(hwnd, FALSE);
+ hTrackMenu = get_win_sys_menu(hwnd);
uItem = 0;
wParam |= HTSYSMENU; /* prevent item lookup */
}
to normal items */
pmii_out->fState = pmii_in->fState & MENUITEMINFO_STATE_MASK;
+ if (pmii_out->fMask & MIIM_SUBMENU)
+ {
+ if ((pmii_out->hSubMenu != NULL) && !IsMenu(pmii_out->hSubMenu))
+ return FALSE;
+ }
+
return TRUE;
}
}
}
+HMENU FASTCALL MENU_LoadSystemMenu(BOOL mdi)
+{
+ HMENU hmenu = LoadMenuW(User32Instance, L"SYSMENU");
+
+ if (hmenu)
+ {
+ MENUINFO menuinfo = {0};
+ MENUITEMINFOW info = {0};
+ //WCHAR buf[128];
+
+ // removing space for checkboxes from menu
+ menuinfo.cbSize = sizeof(menuinfo);
+ menuinfo.fMask = MIM_STYLE;
+ GetMenuInfo(hmenu, &menuinfo);
+ menuinfo.dwStyle |= MNS_CHECKORBMP;
+ SetMenuInfo(hmenu, &menuinfo);
+
+ // adding bitmaps to menu items
+ info.cbSize = sizeof(info);
+ info.fMask |= MIIM_BITMAP;
+ info.hbmpItem = HBMMENU_POPUP_MINIMIZE;
+ SetMenuItemInfoW(hmenu, SC_MINIMIZE, FALSE, &info);
+ info.hbmpItem = HBMMENU_POPUP_RESTORE;
+ SetMenuItemInfoW(hmenu, SC_RESTORE, FALSE, &info);
+ info.hbmpItem = HBMMENU_POPUP_MAXIMIZE;
+ SetMenuItemInfoW(hmenu, SC_MAXIMIZE, FALSE, &info);
+ info.hbmpItem = HBMMENU_POPUP_CLOSE;
+ SetMenuItemInfoW(hmenu, SC_CLOSE, FALSE, &info);
+ if (mdi)
+ {
+ AppendMenuW(hmenu, MF_SEPARATOR, 0, NULL);
+ //LoadStringW(User32Instance, IDS_MDI_NEXT, buf, sizeof(buf)/sizeof(WCHAR));
+ //AppendMenuW(hmenu, MF_STRING, SC_NEXTWINDOW, buf);
+ }
+ }
+ return hmenu;
+}
+
NTSTATUS WINAPI
User32LoadSysMenuTemplateForKernel(PVOID Arguments, ULONG ArgumentLength)
{
- HMENU hmenu = LoadMenuW(User32Instance, L"SYSMENU");
- LRESULT Result = (LRESULT)hmenu;
- MENUINFO menuinfo = {0};
- MENUITEMINFOW info = {0};
-
- // removing space for checkboxes from menu
- menuinfo.cbSize = sizeof(menuinfo);
- menuinfo.fMask = MIM_STYLE;
- GetMenuInfo(hmenu, &menuinfo);
- menuinfo.dwStyle |= MNS_CHECKORBMP; // test_menu_bmp_and_string MNS_CHECKORBMP
- SetMenuInfo(hmenu, &menuinfo);
-
- // adding bitmaps to menu items
- info.cbSize = sizeof(info);
- info.fMask |= MIIM_BITMAP;
- info.hbmpItem = HBMMENU_POPUP_MINIMIZE;
- SetMenuItemInfoW(hmenu, SC_MINIMIZE, FALSE, &info);
- info.hbmpItem = HBMMENU_POPUP_RESTORE;
- SetMenuItemInfoW(hmenu, SC_RESTORE, FALSE, &info);
- info.hbmpItem = HBMMENU_POPUP_MAXIMIZE;
- SetMenuItemInfoW(hmenu, SC_MAXIMIZE, FALSE, &info);
- info.hbmpItem = HBMMENU_POPUP_CLOSE;
- SetMenuItemInfoW(hmenu, SC_CLOSE, FALSE, &info);
+ LRESULT Result = 0;
+
+ // Will be converted to load bitmaps for OBMI!
return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
}
Common = (PLOADMENU_CALLBACK_ARGUMENTS) Arguments;
- Result = (LRESULT)LoadMenuW( Common->hModule,
- IS_INTRESOURCE(Common->MenuName[0]) ?
- MAKEINTRESOURCE(Common->MenuName[0]) :
- (LPCWSTR)&Common->MenuName);
+ Result = (LRESULT)LoadMenuW( Common->hModule, Common->InterSource ? MAKEINTRESOURCE(Common->InterSource) : (LPCWSTR)&Common->MenuName);
return ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS);
}
MENU_mnu2mnuii( uFlags, uIDNewItem, (LPCWSTR)lpNewItem, &mii, FALSE);
- /* copy the text string, it wll be one or the other */
+ /* copy the text string, it will be one or the other */
if (lpNewItem && mii.fMask & MIIM_STRING && !mii.hbmpItem && mii.dwTypeData)
{
if (!RtlCreateUnicodeStringFromAsciiz(&UnicodeString, (LPSTR)mii.dwTypeData))
MENU_mnu2mnuii( uFlags, uIDNewItem, lpNewItem, &mii, TRUE);
- /* copy the text string, it wll be one or the other */
+ /* copy the text string, it will be one or the other */
if (lpNewItem && mii.fMask & MIIM_STRING && !mii.hbmpItem && mii.dwTypeData)
{
RtlInitUnicodeString(&MenuText, (PWSTR)mii.dwTypeData);
UINT uIDCheckItem,
UINT uCheck)
{
- PMENU pMenu;
PITEM item;
DWORD Ret;
+ UINT uID = uIDCheckItem;
- if (!(pMenu = ValidateHandle(hmenu, TYPE_MENU)))
+ if (!ValidateHandle(hmenu, TYPE_MENU))
return -1;
- if (!(item = MENU_FindItem( &hmenu, &uIDCheckItem, uCheck ))) return -1;
+ if (!(item = MENU_FindItem( &hmenu, &uID, uCheck ))) return -1;
Ret = item->fState & MFS_CHECKED;
if ( Ret == (uCheck & MFS_CHECKED)) return Ret; // Already Checked...
HWND hWnd,
BOOL bRevert)
{
- HMENU TopMenu;
-
- TopMenu = NtUserGetSystemMenu(hWnd, bRevert);
-
- return NULL == TopMenu ? NULL : GetSubMenu(TopMenu, 0);
+ return NtUserGetSystemMenu(hWnd, bRevert);
}
/*
MENU_mnu2mnuii( uFlags, uIDNewItem, (LPCWSTR)lpNewItem, &mii, FALSE);
- /* copy the text string, it wll be one or the other */
+ /* copy the text string, it will be one or the other */
if (lpNewItem && mii.fMask & MIIM_STRING && !mii.hbmpItem && mii.dwTypeData)
{
if (!RtlCreateUnicodeStringFromAsciiz(&UnicodeString, (LPSTR)mii.dwTypeData))
MENU_mnu2mnuii( uFlags, uIDNewItem, lpNewItem, &mii, TRUE);
- /* copy the text string, it wll be one or the other */
+ /* copy the text string, it will be one or the other */
if (lpNewItem && mii.fMask & MIIM_STRING && !mii.hbmpItem && mii.dwTypeData)
{
RtlInitUnicodeString(&MenuText, (PWSTR)mii.dwTypeData);
MENU_mnu2mnuii( uFlags, uIDNewItem, (LPCWSTR)lpNewItem, &mii, FALSE);
- /* copy the text string, it wll be one or the other */
+ /* copy the text string, it will be one or the other */
if (lpNewItem && mii.fMask & MIIM_STRING && !mii.hbmpItem && mii.dwTypeData)
{
if (!RtlCreateUnicodeStringFromAsciiz(&UnicodeString, (LPSTR)mii.dwTypeData))
MENU_mnu2mnuii( uFlags, uIDNewItem, lpNewItem, &mii, TRUE);
- /* copy the text string, it wll be one or the other */
+ /* copy the text string, it will be one or the other */
if (lpNewItem && mii.fMask & MIIM_STRING && !mii.hbmpItem && mii.dwTypeData)
{
RtlInitUnicodeString(&MenuText, (PWSTR)mii.dwTypeData);