[PATCH v2] user32: In menu.c converted all tabs to spaces
Fabian Maurer
dark.shadow4 at web.de
Wed Feb 1 16:25:19 CST 2017
This change makes it a lot to edit easier with some editors.
Conversion done with Notepad++, with tabsize 8 spaces.
v2: removed trailing whitespace
Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
dlls/user32/menu.c | 1922 ++++++++++++++++++++++++++--------------------------
1 file changed, 961 insertions(+), 961 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 59fcd9c488..689d8363ad 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -65,19 +65,19 @@ WINE_DECLARE_DEBUG_CHANNEL(accel);
/* Menu item structure */
typedef struct {
/* ----------- MENUITEMINFO Stuff ----------- */
- UINT fType; /* Item type. */
- UINT fState; /* Item state. */
- UINT_PTR wID; /* Item id. */
- HMENU hSubMenu; /* Pop-up menu. */
- HBITMAP hCheckBit; /* Bitmap when checked. */
- HBITMAP hUnCheckBit; /* Bitmap when unchecked. */
- LPWSTR text; /* Item text. */
- ULONG_PTR dwItemData; /* Application defined. */
- LPWSTR dwTypeData; /* depends on fMask */
- HBITMAP hbmpItem; /* bitmap */
+ UINT fType; /* Item type. */
+ UINT fState; /* Item state. */
+ UINT_PTR wID; /* Item id. */
+ HMENU hSubMenu; /* Pop-up menu. */
+ HBITMAP hCheckBit; /* Bitmap when checked. */
+ HBITMAP hUnCheckBit; /* Bitmap when unchecked. */
+ LPWSTR text; /* Item text. */
+ ULONG_PTR dwItemData; /* Application defined. */
+ LPWSTR dwTypeData; /* depends on fMask */
+ HBITMAP hbmpItem; /* bitmap */
/* ----------- Wine stuff ----------- */
- RECT rect; /* Item area (relative to menu window) */
- UINT xTab; /* X position of text after Tab */
+ RECT rect; /* Item area (relative to menu window) */
+ UINT xTab; /* X position of text after Tab */
SIZE bmpsize; /* size needed for the HBMMENU_CALLBACK
* bitmap */
} MENUITEM;
@@ -86,23 +86,23 @@ typedef struct {
typedef struct {
struct user_object obj;
WORD wFlags; /* Menu flags (MF_POPUP, MF_SYSMENU) */
- WORD Width; /* Width of the whole menu */
- WORD Height; /* Height of the whole menu */
+ WORD Width; /* Width of the whole menu */
+ WORD Height; /* Height of the whole menu */
UINT nItems; /* Number of items in the menu */
HWND hWnd; /* Window containing the menu */
MENUITEM *items; /* Array of menu items */
UINT FocusedItem; /* Currently focused item */
- HWND hwndOwner; /* window receiving the messages for ownerdraw */
+ HWND hwndOwner; /* window receiving the messages for ownerdraw */
BOOL bTimeToHide; /* Request hiding when receiving a second click in the top-level menu item */
BOOL bScrolling; /* Scroll arrows are active */
UINT nScrollPos; /* Current scroll position */
UINT nTotalHeight; /* Total height of menu items inside menu */
/* ------------ MENUINFO members ------ */
- DWORD dwStyle; /* Extended menu style */
- UINT cyMax; /* max height of the whole menu, 0 is screen height */
- HBRUSH hbrBack; /* brush for menu background */
- DWORD dwContextHelpID;
- DWORD dwMenuData; /* application defined value */
+ DWORD dwStyle; /* Extended menu style */
+ UINT cyMax; /* max height of the whole menu, 0 is screen height */
+ HBRUSH hbrBack; /* brush for menu background */
+ DWORD dwContextHelpID;
+ DWORD dwMenuData; /* application defined value */
HMENU hSysMenuOwner; /* Handle to the dummy sys menu holder */
WORD textOffset; /* Offset of text when items have both bitmaps and text */
} POPUPMENU, *LPPOPUPMENU;
@@ -115,19 +115,19 @@ typedef struct {
typedef struct
{
- UINT trackFlags;
- HMENU hCurrentMenu; /* current submenu (can be equal to hTopMenu)*/
- HMENU hTopMenu; /* initial menu */
- HWND hOwnerWnd; /* where notifications are sent */
- POINT pt;
+ UINT trackFlags;
+ HMENU hCurrentMenu; /* current submenu (can be equal to hTopMenu)*/
+ HMENU hTopMenu; /* initial menu */
+ HWND hOwnerWnd; /* where notifications are sent */
+ POINT pt;
} MTRACKER;
-#define ITEM_PREV -1
-#define ITEM_NEXT 1
+#define ITEM_PREV -1
+#define ITEM_NEXT 1
/* Internal MENU_TrackMenu() flags */
-#define TPM_INTERNAL 0xF0000000
-#define TPM_BUTTONDOWN 0x40000000 /* menu was clicked before tracking */
+#define TPM_INTERNAL 0xF0000000
+#define TPM_BUTTONDOWN 0x40000000 /* menu was clicked before tracking */
#define TPM_POPUPMENU 0x20000000 /* menu is a popup menu */
/* Space between 2 columns */
@@ -153,12 +153,12 @@ typedef struct
#define IS_MAGIC_BITMAP(id) ((id) && ((INT_PTR)(id) < 12) && ((INT_PTR)(id) >= -1))
#define IS_SYSTEM_MENU(menu) \
- (!((menu)->wFlags & MF_POPUP) && ((menu)->wFlags & MF_SYSMENU))
+ (!((menu)->wFlags & MF_POPUP) && ((menu)->wFlags & MF_SYSMENU))
#define MENUITEMINFO_TYPE_MASK \
- (MFT_STRING | MFT_BITMAP | MFT_OWNERDRAW | MFT_SEPARATOR | \
- MFT_MENUBARBREAK | MFT_MENUBREAK | MFT_RADIOCHECK | \
- MFT_RIGHTORDER | MFT_RIGHTJUSTIFY /* same as MF_HELP */ )
+ (MFT_STRING | MFT_BITMAP | MFT_OWNERDRAW | MFT_SEPARATOR | \
+ MFT_MENUBARBREAK | MFT_MENUBREAK | MFT_RADIOCHECK | \
+ MFT_RIGHTORDER | MFT_RIGHTJUSTIFY /* same as MF_HELP */ )
#define TYPE_MASK (MENUITEMINFO_TYPE_MASK | MF_POPUP | MF_SYSMENU)
#define STATE_MASK (~TYPE_MASK)
#define MENUITEMINFO_STATE_MASK (STATE_MASK & ~(MF_BYPOSITION | MF_MOUSESELECT))
@@ -212,7 +212,7 @@ const struct builtin_class_descr MENU_builtin_class =
} while (0)
static void do_debug_print_menuitem(const char *prefix, const MENUITEM *mp,
- const char *postfix)
+ const char *postfix)
{
static const char * const hbmmenus[] = { "HBMMENU_CALLBACK", "", "HBMMENU_SYSTEM",
"HBMMENU_MBAR_RESTORE", "HBMMENU_MBAR_MINIMIZE", "UNKNOWN BITMAP", "HBMMENU_MBAR_CLOSE",
@@ -436,10 +436,10 @@ static HMENU MENU_CopySysPopup(BOOL mdi)
SetMenuItemInfoW( hMenu, SC_MAXIMIZE, FALSE, &miteminfo);
miteminfo.hbmpItem = HBMMENU_POPUP_MINIMIZE;
SetMenuItemInfoW( hMenu, SC_MINIMIZE, FALSE, &miteminfo);
- SetMenuDefaultItem(hMenu, SC_CLOSE, FALSE);
+ SetMenuDefaultItem(hMenu, SC_CLOSE, FALSE);
}
else
- ERR("Unable to load default system menu\n" );
+ ERR("Unable to load default system menu\n" );
TRACE("returning %p (mdi=%d).\n", hMenu, mdi );
@@ -463,35 +463,35 @@ static HMENU MENU_GetSysMenu( HWND hWnd, HMENU hPopupMenu )
TRACE("loading system menu, hWnd %p, hPopupMenu %p\n", hWnd, hPopupMenu);
if ((hMenu = CreateMenu()))
{
- POPUPMENU *menu = MENU_GetMenu(hMenu);
- menu->wFlags = MF_SYSMENU;
- menu->hWnd = WIN_GetFullHandle( hWnd );
- TRACE("hWnd %p (hMenu %p)\n", menu->hWnd, hMenu);
+ POPUPMENU *menu = MENU_GetMenu(hMenu);
+ menu->wFlags = MF_SYSMENU;
+ menu->hWnd = WIN_GetFullHandle( hWnd );
+ TRACE("hWnd %p (hMenu %p)\n", menu->hWnd, hMenu);
- if (!hPopupMenu)
+ if (!hPopupMenu)
{
if (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_MDICHILD)
- hPopupMenu = MENU_CopySysPopup(TRUE);
+ hPopupMenu = MENU_CopySysPopup(TRUE);
else
- hPopupMenu = MENU_CopySysPopup(FALSE);
+ hPopupMenu = MENU_CopySysPopup(FALSE);
}
- if (hPopupMenu)
- {
+ if (hPopupMenu)
+ {
if (GetClassLongW(hWnd, GCL_STYLE) & CS_NOCLOSE)
DeleteMenu(hPopupMenu, SC_CLOSE, MF_BYCOMMAND);
- InsertMenuW( hMenu, -1, MF_SYSMENU | MF_POPUP | MF_BYPOSITION,
+ InsertMenuW( hMenu, -1, MF_SYSMENU | MF_POPUP | MF_BYPOSITION,
(UINT_PTR)hPopupMenu, NULL );
menu->items[0].fType = MF_SYSMENU | MF_POPUP;
menu->items[0].fState = 0;
if ((menu = MENU_GetMenu(hPopupMenu))) menu->wFlags |= MF_SYSMENU;
- TRACE("hMenu=%p (hPopup %p)\n", hMenu, hPopupMenu );
- return hMenu;
- }
- DestroyMenu( hMenu );
+ TRACE("hMenu=%p (hPopup %p)\n", hMenu, hPopupMenu );
+ return hMenu;
+ }
+ DestroyMenu( hMenu );
}
ERR("failed to load system menu!\n");
return 0;
@@ -521,7 +521,7 @@ static void MENU_InitSysMenuPopup( HMENU hmenu, DWORD style, DWORD clsStyle )
/* The menu item must keep its state if it's disabled */
if(gray)
- EnableMenuItem( hmenu, SC_CLOSE, MF_GRAYED);
+ EnableMenuItem( hmenu, SC_CLOSE, MF_GRAYED);
}
@@ -539,15 +539,15 @@ static UINT MENU_GetStartOfNextColumn(
UINT i;
if(!menu)
- return NO_SELECTED_ITEM;
+ return NO_SELECTED_ITEM;
i = menu->FocusedItem + 1;
if( i == NO_SELECTED_ITEM )
- return i;
+ return i;
for( ; i < menu->nItems; ++i ) {
- if (menu->items[i].fType & (MF_MENUBREAK | MF_MENUBARBREAK))
- return i;
+ if (menu->items[i].fType & (MF_MENUBREAK | MF_MENUBARBREAK))
+ return i;
}
return NO_SELECTED_ITEM;
@@ -568,23 +568,23 @@ static UINT MENU_GetStartOfPrevColumn(
UINT i;
if( !menu )
- return NO_SELECTED_ITEM;
+ return NO_SELECTED_ITEM;
if( menu->FocusedItem == 0 || menu->FocusedItem == NO_SELECTED_ITEM )
- return NO_SELECTED_ITEM;
+ return NO_SELECTED_ITEM;
/* Find the start of the column */
for(i = menu->FocusedItem; i != 0 &&
- !(menu->items[i].fType & (MF_MENUBREAK | MF_MENUBARBREAK));
- --i); /* empty */
+ !(menu->items[i].fType & (MF_MENUBREAK | MF_MENUBARBREAK));
+ --i); /* empty */
if(i == 0)
- return NO_SELECTED_ITEM;
+ return NO_SELECTED_ITEM;
for(--i; i != 0; --i) {
- if (menu->items[i].fType & (MF_MENUBREAK | MF_MENUBARBREAK))
- break;
+ if (menu->items[i].fType & (MF_MENUBREAK | MF_MENUBARBREAK))
+ break;
}
TRACE("ret %d.\n", i );
@@ -610,36 +610,36 @@ static MENUITEM *MENU_FindItem( HMENU *hmenu, UINT *nPos, UINT wFlags )
if ((*hmenu == (HMENU)0xffff) || (!(menu = MENU_GetMenu(*hmenu)))) return NULL;
if (wFlags & MF_BYPOSITION)
{
- if (*nPos >= menu->nItems) return NULL;
- return &menu->items[*nPos];
+ if (*nPos >= menu->nItems) return NULL;
+ return &menu->items[*nPos];
}
else
{
MENUITEM *item = menu->items;
- for (i = 0; i < menu->nItems; i++, item++)
- {
- if (item->fType & MF_POPUP)
- {
- HMENU hsubmenu = item->hSubMenu;
- MENUITEM *subitem = MENU_FindItem( &hsubmenu, nPos, wFlags );
- if (subitem)
- {
- *hmenu = hsubmenu;
- return subitem;
- }
- else if (item->wID == *nPos)
- {
- /* fallback to this item if nothing else found */
- fallback_pos = i;
- fallback = item;
- }
- }
- else if (item->wID == *nPos)
- {
- *nPos = i;
- return item;
- }
- }
+ for (i = 0; i < menu->nItems; i++, item++)
+ {
+ if (item->fType & MF_POPUP)
+ {
+ HMENU hsubmenu = item->hSubMenu;
+ MENUITEM *subitem = MENU_FindItem( &hsubmenu, nPos, wFlags );
+ if (subitem)
+ {
+ *hmenu = hsubmenu;
+ return subitem;
+ }
+ else if (item->wID == *nPos)
+ {
+ /* fallback to this item if nothing else found */
+ fallback_pos = i;
+ fallback = item;
+ }
+ }
+ else if (item->wID == *nPos)
+ {
+ *nPos = i;
+ return item;
+ }
+ }
}
if (fallback)
@@ -719,7 +719,7 @@ MENU_AdjustMenuItemRect(const POPUPMENU *menu, LPRECT rect)
* an arbitrary system menu.
*/
static MENUITEM *MENU_FindItemByCoords( const POPUPMENU *menu,
- POINT pt, UINT *pos )
+ POINT pt, UINT *pos )
{
MENUITEM *item;
UINT i;
@@ -734,11 +734,11 @@ static MENUITEM *MENU_FindItemByCoords( const POPUPMENU *menu,
{
rect = item->rect;
MENU_AdjustMenuItemRect(menu, &rect);
- if (PtInRect(&rect, pt))
- {
- if (pos) *pos = i;
- return item;
- }
+ if (PtInRect(&rect, pt))
+ {
+ if (pos) *pos = i;
+ return item;
+ }
}
return NULL;
}
@@ -759,35 +759,35 @@ static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
if (hmenu)
{
- POPUPMENU *menu = MENU_GetMenu( hmenu );
- MENUITEM *item = menu->items;
- LRESULT menuchar;
-
- if( !forceMenuChar )
- {
- UINT i;
- BOOL cjk = GetSystemMetrics( SM_DBCSENABLED );
-
- for (i = 0; i < menu->nItems; i++, item++)
- {
- if( item->text)
- {
- const WCHAR *p = item->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;
- }
- }
- }
- menuchar = SendMessageW( hwndOwner, WM_MENUCHAR,
+ POPUPMENU *menu = MENU_GetMenu( hmenu );
+ MENUITEM *item = menu->items;
+ LRESULT menuchar;
+
+ if( !forceMenuChar )
+ {
+ UINT i;
+ BOOL cjk = GetSystemMetrics( SM_DBCSENABLED );
+
+ for (i = 0; i < menu->nItems; i++, item++)
+ {
+ if( item->text)
+ {
+ const WCHAR *p = item->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;
+ }
+ }
+ }
+ menuchar = SendMessageW( hwndOwner, WM_MENUCHAR,
MAKEWPARAM( key, menu->wFlags ), (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);
}
@@ -880,7 +880,7 @@ static void MENU_DrawBitmapItem( HDC hdc, MENUITEM *lpitem, const RECT *rect,
WCHAR bmchr = 0;
RECT r;
- switch((INT_PTR)hbmToDraw)
+ switch((INT_PTR)hbmToDraw)
{
case (INT_PTR)HBMMENU_SYSTEM:
if (lpitem->dwItemData)
@@ -1000,7 +1000,7 @@ static void MENU_DrawBitmapItem( HDC hdc, MENUITEM *lpitem, const RECT *rect,
* Calculate the size of the menu item and store it in lpitem->rect.
*/
static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
- INT orgX, INT orgY, BOOL menuBar, POPUPMENU* lppop )
+ INT orgX, INT orgY, BOOL menuBar, POPUPMENU* lppop )
{
WCHAR *p;
UINT check_bitmap_width = GetSystemMetrics( SM_CXMENUCHECK );
@@ -1010,7 +1010,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
TRACE("dc=%p owner=%p (%d,%d)\n", hdc, hwndOwner, orgX, orgY);
debug_print_menuitem("MENU_CalcItemSize: menuitem:", lpitem,
- (menuBar ? " (MenuBar)" : ""));
+ (menuBar ? " (MenuBar)" : ""));
GetObjectW( get_arrow_bitmap(), sizeof(bm), &bm );
arrow_bitmap_width = bm.bmWidth;
@@ -1096,9 +1096,9 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
RECT rc = lpitem->rect;
LONG txtheight, txtwidth;
- if ( lpitem->fState & MFS_DEFAULT ) {
- hfontOld = SelectObject( hdc, get_menu_font(TRUE) );
- }
+ if ( lpitem->fState & MFS_DEFAULT ) {
+ hfontOld = SelectObject( hdc, get_menu_font(TRUE) );
+ }
if (menuBar) {
txtheight = DrawTextW( hdc, lpitem->text, -1, &rc,
DT_SINGLELINE|DT_CALCRECT);
@@ -1134,7 +1134,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
itemheight = max( itemheight,
max( txtheight + 2, menucharsize.cy + 4));
}
- if (hfontOld) SelectObject (hdc, hfontOld);
+ if (hfontOld) SelectObject (hdc, hfontOld);
} else if( menuBar) {
itemheight = max( itemheight, GetSystemMetrics(SM_CYMENU)-1);
}
@@ -1181,40 +1181,40 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop )
while (start < lppop->nItems)
{
- lpitem = &lppop->items[start];
- orgX = maxX;
+ lpitem = &lppop->items[start];
+ orgX = maxX;
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 < lppop->nItems; i++, lpitem++)
- {
- if ((i != start) &&
- (lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break;
-
- MENU_CalcItemSize( hdc, lpitem, lppop->hwndOwner, orgX, orgY, FALSE, lppop );
- maxX = max( maxX, lpitem->rect.right );
- orgY = lpitem->rect.bottom;
- if (IS_STRING_ITEM(lpitem->fType) && lpitem->xTab)
- {
- maxTab = max( maxTab, lpitem->xTab );
- maxTabWidth = max(maxTabWidth,lpitem->rect.right-lpitem->xTab);
- }
+ orgY = MENU_TOP_MARGIN;
+
+ maxTab = maxTabWidth = 0;
+ /* Parse items until column break or end of menu */
+ for (i = start; i < lppop->nItems; i++, lpitem++)
+ {
+ if ((i != start) &&
+ (lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break;
+
+ MENU_CalcItemSize( hdc, lpitem, lppop->hwndOwner, orgX, orgY, FALSE, lppop );
+ maxX = max( maxX, lpitem->rect.right );
+ orgY = lpitem->rect.bottom;
+ if (IS_STRING_ITEM(lpitem->fType) && lpitem->xTab)
+ {
+ maxTab = max( maxTab, lpitem->xTab );
+ maxTabWidth = max(maxTabWidth,lpitem->rect.right-lpitem->xTab);
+ }
if( lpitem->text && lpitem->hbmpItem) textandbmp = TRUE;
- }
+ }
- /* Finish the column (set all items to the largest width found) */
- maxX = max( maxX, maxTab + maxTabWidth );
- for (lpitem = &lppop->items[start]; start < i; start++, lpitem++)
- {
- lpitem->rect.right = maxX;
- if (IS_STRING_ITEM(lpitem->fType) && lpitem->xTab)
- lpitem->xTab = maxTab;
+ /* Finish the column (set all items to the largest width found) */
+ maxX = max( maxX, maxTab + maxTabWidth );
+ for (lpitem = &lppop->items[start]; start < i; start++, lpitem++)
+ {
+ lpitem->rect.right = maxX;
+ if (IS_STRING_ITEM(lpitem->fType) && lpitem->xTab)
+ lpitem->xTab = maxTab;
- }
- lppop->Height = max( lppop->Height, orgY );
+ }
+ lppop->Height = max( lppop->Height, orgY );
}
lppop->Width = maxX;
@@ -1273,32 +1273,32 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect,
lppop->textOffset = 0;
while (start < lppop->nItems)
{
- lpitem = &lppop->items[start];
- orgX = lprect->left;
- orgY = maxY;
-
- /* Parse items until line break or end of menu */
- for (i = start; i < lppop->nItems; i++, lpitem++)
- {
- if ((helpPos == ~0U) && (lpitem->fType & MF_RIGHTJUSTIFY)) helpPos = i;
- if ((i != start) &&
- (lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break;
-
- TRACE("calling MENU_CalcItemSize org=(%d, %d)\n", orgX, orgY );
- debug_print_menuitem (" item: ", lpitem, "");
- MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, TRUE, lppop );
-
- if (lpitem->rect.right > lprect->right)
- {
- if (i != start) break;
- else lpitem->rect.right = lprect->right;
- }
- maxY = max( maxY, lpitem->rect.bottom );
- orgX = lpitem->rect.right;
- }
-
- /* Finish the line (set all items to the largest height found) */
- while (start < i) lppop->items[start++].rect.bottom = maxY;
+ lpitem = &lppop->items[start];
+ orgX = lprect->left;
+ orgY = maxY;
+
+ /* Parse items until line break or end of menu */
+ for (i = start; i < lppop->nItems; i++, lpitem++)
+ {
+ if ((helpPos == ~0U) && (lpitem->fType & MF_RIGHTJUSTIFY)) helpPos = i;
+ if ((i != start) &&
+ (lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break;
+
+ TRACE("calling MENU_CalcItemSize org=(%d, %d)\n", orgX, orgY );
+ debug_print_menuitem (" item: ", lpitem, "");
+ MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, TRUE, lppop );
+
+ if (lpitem->rect.right > lprect->right)
+ {
+ if (i != start) break;
+ else lpitem->rect.right = lprect->right;
+ }
+ maxY = max( maxY, lpitem->rect.bottom );
+ orgX = lpitem->rect.right;
+ }
+
+ /* Finish the line (set all items to the largest height found) */
+ while (start < i) lppop->items[start++].rect.bottom = maxY;
}
lprect->bottom = maxY;
@@ -1311,8 +1311,8 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect,
orgY = lpitem->rect.top;
orgX = lprect->right;
for (i = lppop->nItems - 1; i >= helpPos; i--, lpitem--) {
- if (lpitem->rect.top != orgY) break; /* Other line */
- if (lpitem->rect.right >= orgX) break; /* Too far right already */
+ if (lpitem->rect.top != orgY) break; /* Other line */
+ if (lpitem->rect.right >= orgX) break; /* Too far right already */
lpitem->rect.left += orgX - lpitem->rect.right;
lpitem->rect.right = orgX;
orgX = lpitem->rect.left;
@@ -1387,7 +1387,7 @@ static void draw_popup_arrow( HDC hdc, RECT rect, UINT arrow_bitmap_width,
* Draw a single menu item.
*/
static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, MENUITEM *lpitem,
- UINT height, BOOL menuBar, UINT odaction )
+ UINT height, BOOL menuBar, UINT odaction )
{
RECT rect;
BOOL flat_menu = FALSE;
@@ -1407,9 +1407,9 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
if (lpitem->fType & MF_SYSMENU)
{
- if( !IsIconic(hwnd) )
- NC_DrawSysButton( hwnd, hdc, lpitem->fState & (MF_HILITE | MF_MOUSESELECT) );
- return;
+ if( !IsIconic(hwnd) )
+ NC_DrawSysButton( hwnd, hdc, lpitem->fState & (MF_HILITE | MF_MOUSESELECT) );
+ return;
}
SystemParametersInfoW (SPI_GETFLATMENU, 0, &flat_menu, 0);
@@ -1420,23 +1420,23 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
if (lpitem->fState & MF_HILITE)
{
if(menuBar && !flat_menu) {
- SetTextColor(hdc, GetSysColor(COLOR_MENUTEXT));
+ SetTextColor(hdc, GetSysColor(COLOR_MENUTEXT));
SetBkColor(hdc, GetSysColor(COLOR_MENU));
- } else {
- if(lpitem->fState & MF_GRAYED)
- SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
- else
- SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
+ } else {
+ if(lpitem->fState & MF_GRAYED)
+ SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
+ else
+ SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
- }
+ }
}
else
{
- if (lpitem->fState & MF_GRAYED)
- SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) );
- else
- SetTextColor( hdc, GetSysColor( COLOR_MENUTEXT ) );
- SetBkColor( hdc, GetSysColor( bkgnd ) );
+ if (lpitem->fState & MF_GRAYED)
+ SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) );
+ else
+ SetTextColor( hdc, GetSysColor( COLOR_MENUTEXT ) );
+ SetBkColor( hdc, GetSysColor( bkgnd ) );
}
TRACE("rect=%s\n", wine_dbgstr_rect( &lpitem->rect));
@@ -1458,7 +1458,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
COLORREF old_bk, old_text;
dis.CtlType = ODT_MENU;
- dis.CtlID = 0;
+ dis.CtlID = 0;
dis.itemID = lpitem->wID;
dis.itemData = lpitem->dwItemData;
dis.itemState = 0;
@@ -1470,9 +1470,9 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
dis.hDC = hdc;
dis.rcItem = rect;
TRACE("Ownerdraw: owner=%p itemID=%d, itemState=%d, itemAction=%d, "
- "hwndItem=%p, hdc=%p, rcItem=%s\n", hwndOwner,
- dis.itemID, dis.itemState, dis.itemAction, dis.hwndItem,
- dis.hDC, wine_dbgstr_rect( &dis.rcItem));
+ "hwndItem=%p, hdc=%p, rcItem=%s\n", hwndOwner,
+ dis.itemID, dis.itemState, dis.itemAction, dis.hwndItem,
+ dis.hDC, wine_dbgstr_rect( &dis.rcItem));
old_bk = GetBkColor( hdc );
old_text = GetTextColor( hdc );
SendMessageW( hwndOwner, WM_DRAWITEM, 0, (LPARAM)&dis );
@@ -1550,11 +1550,11 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
return;
}
- /* helper lines for debugging */
-/* FrameRect(hdc, &rect, GetStockObject(BLACK_BRUSH));
- SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
- MoveToEx( hdc, rect.left, (rect.top + rect.bottom)/2, NULL );
- LineTo( hdc, rect.right, (rect.top + rect.bottom)/2 );
+ /* helper lines for debugging */
+/* FrameRect(hdc, &rect, GetStockObject(BLACK_BRUSH));
+ SelectObject( hdc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME) );
+ MoveToEx( hdc, rect.left, (rect.top + rect.bottom)/2, NULL );
+ LineTo( hdc, rect.right, (rect.top + rect.bottom)/2 );
*/
if (lpitem->hbmpItem) {
@@ -1636,14 +1636,14 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
odaction, FALSE);
SetViewportOrgEx( hdc, origorg.x, origorg.y, NULL);
}
- /* Draw the popup-menu arrow */
+ /* Draw the popup-menu arrow */
if (lpitem->fType & MF_POPUP)
draw_popup_arrow( hdc, rect, arrow_bitmap_width,
arrow_bitmap_height);
- rect.left += 4;
+ rect.left += 4;
if( !(menu->dwStyle & MNS_NOCHECK))
rect.left += check_bitmap_width;
- rect.right -= arrow_bitmap_width;
+ rect.right -= arrow_bitmap_width;
}
else if( lpitem->hbmpItem)
{ /* Draw the bitmap */
@@ -1657,77 +1657,77 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
/* process text if present */
if (lpitem->text)
{
- int i;
- HFONT hfontOld = 0;
+ int i;
+ HFONT hfontOld = 0;
- UINT uFormat = (menuBar) ?
- DT_CENTER | DT_VCENTER | DT_SINGLELINE :
- DT_LEFT | DT_VCENTER | DT_SINGLELINE;
+ UINT uFormat = (menuBar) ?
+ DT_CENTER | DT_VCENTER | DT_SINGLELINE :
+ DT_LEFT | DT_VCENTER | DT_SINGLELINE;
if( !(menu->dwStyle & MNS_CHECKORBMP))
rect.left += menu->textOffset;
- if ( lpitem->fState & MFS_DEFAULT )
- {
- hfontOld = SelectObject( hdc, get_menu_font(TRUE) );
- }
+ if ( lpitem->fState & MFS_DEFAULT )
+ {
+ hfontOld = SelectObject( hdc, get_menu_font(TRUE) );
+ }
- if (menuBar) {
+ if (menuBar) {
if( lpitem->hbmpItem)
rect.left += lpitem->bmpsize.cx;
if( !(lpitem->hbmpItem == HBMMENU_CALLBACK))
rect.left += menucharsize.cx;
rect.right -= menucharsize.cx;
- }
-
- for (i = 0; lpitem->text[i]; i++)
- if ((lpitem->text[i] == '\t') || (lpitem->text[i] == '\b'))
- break;
-
- if(lpitem->fState & MF_GRAYED)
- {
- if (!(lpitem->fState & MF_HILITE) )
- {
- ++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
- SetTextColor(hdc, RGB(0xff, 0xff, 0xff));
- DrawTextW( hdc, lpitem->text, i, &rect, uFormat );
- --rect.left; --rect.top; --rect.right; --rect.bottom;
- }
- SetTextColor(hdc, RGB(0x80, 0x80, 0x80));
- }
-
- DrawTextW( hdc, lpitem->text, i, &rect, uFormat);
-
- /* paint the shortcut text */
- if (!menuBar && lpitem->text[i]) /* There's a tab or flush-right char */
- {
- if (lpitem->text[i] == '\t')
- {
- rect.left = lpitem->xTab;
- uFormat = DT_LEFT | DT_VCENTER | DT_SINGLELINE;
- }
- else
- {
- rect.right = lpitem->xTab;
- uFormat = DT_RIGHT | DT_VCENTER | DT_SINGLELINE;
- }
-
- if(lpitem->fState & MF_GRAYED)
- {
- if (!(lpitem->fState & MF_HILITE) )
- {
- ++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
- SetTextColor(hdc, RGB(0xff, 0xff, 0xff));
- DrawTextW( hdc, lpitem->text + i + 1, -1, &rect, uFormat );
- --rect.left; --rect.top; --rect.right; --rect.bottom;
- }
- SetTextColor(hdc, RGB(0x80, 0x80, 0x80));
- }
- DrawTextW( hdc, lpitem->text + i + 1, -1, &rect, uFormat );
- }
-
- if (hfontOld)
- SelectObject (hdc, hfontOld);
+ }
+
+ for (i = 0; lpitem->text[i]; i++)
+ if ((lpitem->text[i] == '\t') || (lpitem->text[i] == '\b'))
+ break;
+
+ if(lpitem->fState & MF_GRAYED)
+ {
+ if (!(lpitem->fState & MF_HILITE) )
+ {
+ ++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
+ SetTextColor(hdc, RGB(0xff, 0xff, 0xff));
+ DrawTextW( hdc, lpitem->text, i, &rect, uFormat );
+ --rect.left; --rect.top; --rect.right; --rect.bottom;
+ }
+ SetTextColor(hdc, RGB(0x80, 0x80, 0x80));
+ }
+
+ DrawTextW( hdc, lpitem->text, i, &rect, uFormat);
+
+ /* paint the shortcut text */
+ if (!menuBar && lpitem->text[i]) /* There's a tab or flush-right char */
+ {
+ if (lpitem->text[i] == '\t')
+ {
+ rect.left = lpitem->xTab;
+ uFormat = DT_LEFT | DT_VCENTER | DT_SINGLELINE;
+ }
+ else
+ {
+ rect.right = lpitem->xTab;
+ uFormat = DT_RIGHT | DT_VCENTER | DT_SINGLELINE;
+ }
+
+ if(lpitem->fState & MF_GRAYED)
+ {
+ if (!(lpitem->fState & MF_HILITE) )
+ {
+ ++rect.left; ++rect.top; ++rect.right; ++rect.bottom;
+ SetTextColor(hdc, RGB(0xff, 0xff, 0xff));
+ DrawTextW( hdc, lpitem->text + i + 1, -1, &rect, uFormat );
+ --rect.left; --rect.top; --rect.right; --rect.bottom;
+ }
+ SetTextColor(hdc, RGB(0x80, 0x80, 0x80));
+ }
+ DrawTextW( hdc, lpitem->text + i + 1, -1, &rect, uFormat );
+ }
+
+ if (hfontOld)
+ SelectObject (hdc, hfontOld);
}
}
@@ -1751,20 +1751,20 @@ static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu )
if ((hPrevBrush = SelectObject( hdc, brush ))
&& SelectObject( hdc, get_menu_font(FALSE) ))
{
- HPEN hPrevPen;
+ HPEN hPrevPen;
- Rectangle( hdc, rect.left, rect.top, rect.right, rect.bottom );
+ Rectangle( hdc, rect.left, rect.top, rect.right, rect.bottom );
- hPrevPen = SelectObject( hdc, GetStockObject( NULL_PEN ) );
- if( hPrevPen )
- {
- BOOL flat_menu = FALSE;
+ hPrevPen = SelectObject( hdc, GetStockObject( NULL_PEN ) );
+ if( hPrevPen )
+ {
+ BOOL flat_menu = FALSE;
- SystemParametersInfoW (SPI_GETFLATMENU, 0, &flat_menu, 0);
- if (flat_menu)
- FrameRect(hdc, &rect, GetSysColorBrush(COLOR_BTNSHADOW));
- else
- DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT);
+ SystemParametersInfoW (SPI_GETFLATMENU, 0, &flat_menu, 0);
+ if (flat_menu)
+ FrameRect(hdc, &rect, GetSysColorBrush(COLOR_BTNSHADOW));
+ else
+ DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT);
if (menu)
{
@@ -1784,10 +1784,10 @@ static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu )
if (menu->bScrolling)
MENU_DrawScrollArrows(menu, hdc);
}
- } else
- {
- SelectObject( hdc, hPrevBrush );
- }
+ } else
+ {
+ SelectObject( hdc, hPrevBrush );
+ }
}
}
@@ -1867,8 +1867,8 @@ static BOOL MENU_ShowPopup( HWND hwndOwner, HMENU hmenu, UINT id, UINT flags,
if (!(menu = MENU_GetMenu( hmenu ))) return FALSE;
if (menu->FocusedItem != NO_SELECTED_ITEM)
{
- menu->items[menu->FocusedItem].fState &= ~(MF_HILITE|MF_MOUSESELECT);
- menu->FocusedItem = NO_SELECTED_ITEM;
+ menu->items[menu->FocusedItem].fState &= ~(MF_HILITE|MF_MOUSESELECT);
+ menu->FocusedItem = NO_SELECTED_ITEM;
}
menu->nScrollPos = 0;
@@ -1996,10 +1996,10 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex,
/* Clear previous highlighted item */
if (lppop->FocusedItem != NO_SELECTED_ITEM)
{
- lppop->items[lppop->FocusedItem].fState &= ~(MF_HILITE|MF_MOUSESELECT);
- MENU_DrawMenuItem(lppop->hWnd, hmenu, hwndOwner, hdc,&lppop->items[lppop->FocusedItem],
+ lppop->items[lppop->FocusedItem].fState &= ~(MF_HILITE|MF_MOUSESELECT);
+ MENU_DrawMenuItem(lppop->hWnd, hmenu, hwndOwner, hdc,&lppop->items[lppop->FocusedItem],
lppop->Height, !(lppop->wFlags & MF_POPUP),
- ODA_SELECT );
+ ODA_SELECT );
}
/* Highlight new item (if any) */
@@ -2016,7 +2016,7 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex,
if (sendMenuSelect)
{
MENUITEM *ip = &lppop->items[lppop->FocusedItem];
- SendMessageW( hwndOwner, WM_MENUSELECT,
+ SendMessageW( hwndOwner, WM_MENUSELECT,
MAKEWPARAM(ip->fType & MF_POPUP ? wIndex: ip->wID,
ip->fType | ip->fState |
(lppop->wFlags & MF_SYSMENU)), (LPARAM)hmenu);
@@ -2057,23 +2057,23 @@ static void MENU_MoveSelection( HWND hwndOwner, HMENU hmenu, INT offset )
if ( menu->FocusedItem != NO_SELECTED_ITEM )
{
- if( menu->nItems == 1 ) return; else
- for (i = menu->FocusedItem + offset ; i >= 0 && i < menu->nItems
- ; i += offset)
- if (!(menu->items[i].fType & MF_SEPARATOR))
- {
- MENU_SelectItem( hwndOwner, hmenu, i, TRUE, 0 );
- return;
- }
+ if( menu->nItems == 1 ) return; else
+ for (i = menu->FocusedItem + offset ; i >= 0 && i < menu->nItems
+ ; i += offset)
+ if (!(menu->items[i].fType & MF_SEPARATOR))
+ {
+ MENU_SelectItem( hwndOwner, hmenu, i, TRUE, 0 );
+ return;
+ }
}
for ( i = (offset > 0) ? 0 : menu->nItems - 1;
- i >= 0 && i < menu->nItems ; i += offset)
- if (!(menu->items[i].fType & MF_SEPARATOR))
- {
- MENU_SelectItem( hwndOwner, hmenu, i, TRUE, 0 );
- return;
- }
+ i >= 0 && i < menu->nItems ; i += offset)
+ if (!(menu->items[i].fType & MF_SEPARATOR))
+ {
+ MENU_SelectItem( hwndOwner, hmenu, i, TRUE, 0 );
+ return;
+ }
}
@@ -2124,10 +2124,10 @@ static MENUITEM *MENU_InsertItem( HMENU hMenu, UINT pos, UINT flags )
}
if (menu->nItems > 0)
{
- /* Copy the old array into the new one */
- if (pos > 0) memcpy( newItems, menu->items, pos * sizeof(MENUITEM) );
- if (pos < menu->nItems) memcpy( &newItems[pos+1], &menu->items[pos],
- (menu->nItems-pos)*sizeof(MENUITEM) );
+ /* Copy the old array into the new one */
+ if (pos > 0) memcpy( newItems, menu->items, pos * sizeof(MENUITEM) );
+ if (pos < menu->nItems) memcpy( &newItems[pos+1], &menu->items[pos],
+ (menu->nItems-pos)*sizeof(MENUITEM) );
HeapFree( GetProcessHeap(), 0, menu->items );
}
menu->items = newItems;
@@ -2192,48 +2192,48 @@ static LPCSTR MENUEX_ParseResource( LPCSTR res, HMENU hMenu)
{
WORD resinfo;
do {
- MENUITEMINFOW mii;
+ MENUITEMINFOW mii;
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_STATE | MIIM_ID | MIIM_TYPE;
- mii.fType = GET_DWORD(res);
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_STATE | MIIM_ID | MIIM_TYPE;
+ mii.fType = GET_DWORD(res);
res += sizeof(DWORD);
- mii.fState = GET_DWORD(res);
+ mii.fState = GET_DWORD(res);
res += sizeof(DWORD);
- mii.wID = GET_DWORD(res);
+ mii.wID = GET_DWORD(res);
res += sizeof(DWORD);
- resinfo = GET_WORD(res); /* FIXME: for 16-bit apps this is a byte. */
+ resinfo = GET_WORD(res); /* FIXME: for 16-bit apps this is a byte. */
res += sizeof(WORD);
- /* Align the text on a word boundary. */
- res += (~((UINT_PTR)res - 1)) & 1;
- mii.dwTypeData = (LPWSTR) res;
- res += (1 + strlenW(mii.dwTypeData)) * sizeof(WCHAR);
- /* Align the following fields on a dword boundary. */
- res += (~((UINT_PTR)res - 1)) & 3;
+ /* Align the text on a word boundary. */
+ res += (~((UINT_PTR)res - 1)) & 1;
+ mii.dwTypeData = (LPWSTR) res;
+ res += (1 + strlenW(mii.dwTypeData)) * sizeof(WCHAR);
+ /* Align the following fields on a dword boundary. */
+ res += (~((UINT_PTR)res - 1)) & 3;
TRACE("Menu item: [%08x,%08x,%04x,%04x,%s]\n",
mii.fType, mii.fState, mii.wID, resinfo, debugstr_w(mii.dwTypeData));
- if (resinfo & 1) { /* Pop-up? */
- /* DWORD helpid = GET_DWORD(res); FIXME: use this. */
- res += sizeof(DWORD);
- mii.hSubMenu = CreatePopupMenu();
- if (!mii.hSubMenu)
- return NULL;
- if (!(res = MENUEX_ParseResource(res, mii.hSubMenu))) {
- DestroyMenu(mii.hSubMenu);
+ if (resinfo & 1) { /* Pop-up? */
+ /* DWORD helpid = GET_DWORD(res); FIXME: use this. */
+ res += sizeof(DWORD);
+ mii.hSubMenu = CreatePopupMenu();
+ if (!mii.hSubMenu)
+ return NULL;
+ if (!(res = MENUEX_ParseResource(res, mii.hSubMenu))) {
+ DestroyMenu(mii.hSubMenu);
return NULL;
- }
- mii.fMask |= MIIM_SUBMENU;
- mii.fType |= MF_POPUP;
+ }
+ mii.fMask |= MIIM_SUBMENU;
+ mii.fType |= MF_POPUP;
}
- else if(!*mii.dwTypeData && !(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);
+ else if(!*mii.dwTypeData && !(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);
} while (!(resinfo & MF_END));
return res;
}
@@ -2274,22 +2274,22 @@ static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu,
if (menu && top_popup)
{
- HMENU hsubmenu;
- POPUPMENU *submenu;
- MENUITEM *item;
-
- if (menu->FocusedItem != NO_SELECTED_ITEM)
- {
- item = &menu->items[menu->FocusedItem];
- if (!(item->fType & MF_POPUP) ||
- !(item->fState & MF_MOUSESELECT)) return;
- item->fState &= ~MF_MOUSESELECT;
- hsubmenu = item->hSubMenu;
- } else return;
-
- if (!(submenu = MENU_GetMenu( hsubmenu ))) return;
- MENU_HideSubPopups( hwndOwner, hsubmenu, FALSE, wFlags );
- MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, sendMenuSelect, 0 );
+ HMENU hsubmenu;
+ POPUPMENU *submenu;
+ MENUITEM *item;
+
+ if (menu->FocusedItem != NO_SELECTED_ITEM)
+ {
+ item = &menu->items[menu->FocusedItem];
+ if (!(item->fType & MF_POPUP) ||
+ !(item->fState & MF_MOUSESELECT)) return;
+ item->fState &= ~MF_MOUSESELECT;
+ hsubmenu = item->hSubMenu;
+ } else return;
+
+ if (!(submenu = MENU_GetMenu( hsubmenu ))) return;
+ MENU_HideSubPopups( hwndOwner, hsubmenu, FALSE, wFlags );
+ MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, sendMenuSelect, 0 );
DestroyWindow( submenu->hWnd );
submenu->hWnd = 0;
@@ -2345,7 +2345,7 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
item->fState |= MF_HILITE;
MENU_DrawMenuItem( menu->hWnd, hmenu, hwndOwner, hdc, item, menu->Height, !(menu->wFlags & MF_POPUP), ODA_DRAWENTIRE );
- ReleaseDC( menu->hWnd, hdc );
+ ReleaseDC( menu->hWnd, hdc );
}
if (!item->rect.top && !item->rect.left && !item->rect.bottom && !item->rect.right)
item->rect = rect;
@@ -2354,46 +2354,46 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
if (IS_SYSTEM_MENU(menu))
{
- MENU_InitSysMenuPopup(item->hSubMenu,
+ MENU_InitSysMenuPopup(item->hSubMenu,
GetWindowLongW( menu->hWnd, GWL_STYLE ),
GetClassLongW( menu->hWnd, GCL_STYLE));
- NC_GetSysPopupPos( menu->hWnd, &rect );
- if (wFlags & TPM_LAYOUTRTL) rect.left = rect.right;
- rect.top = rect.bottom;
- rect.right = GetSystemMetrics(SM_CXSIZE);
+ NC_GetSysPopupPos( menu->hWnd, &rect );
+ if (wFlags & TPM_LAYOUTRTL) rect.left = rect.right;
+ rect.top = rect.bottom;
+ rect.right = GetSystemMetrics(SM_CXSIZE);
rect.bottom = GetSystemMetrics(SM_CYSIZE);
}
else
{
GetWindowRect( menu->hWnd, &rect );
- if (menu->wFlags & MF_POPUP)
- {
+ if (menu->wFlags & MF_POPUP)
+ {
RECT rc = item->rect;
MENU_AdjustMenuItemRect(menu, &rc);
- /* The first item in the popup menu has to be at the
- same y position as the focused menu item */
+ /* The first item in the popup menu has to be at the
+ same y position as the focused menu item */
if (wFlags & TPM_LAYOUTRTL)
rect.left += GetSystemMetrics(SM_CXBORDER);
- else
+ else
rect.left += rc.right - GetSystemMetrics(SM_CXBORDER);
- rect.top += rc.top - MENU_TOP_MARGIN;
- rect.right = rc.left - rc.right + GetSystemMetrics(SM_CXBORDER);
- rect.bottom = rc.top - rc.bottom - MENU_TOP_MARGIN
- - MENU_BOTTOM_MARGIN - GetSystemMetrics(SM_CYBORDER);
- }
- else
- {
+ rect.top += rc.top - MENU_TOP_MARGIN;
+ rect.right = rc.left - rc.right + GetSystemMetrics(SM_CXBORDER);
+ rect.bottom = rc.top - rc.bottom - MENU_TOP_MARGIN
+ - MENU_BOTTOM_MARGIN - GetSystemMetrics(SM_CYBORDER);
+ }
+ else
+ {
if (wFlags & TPM_LAYOUTRTL)
rect.left = rect.right - item->rect.left;
- else
+ else
rect.left += item->rect.left;
- rect.top += item->rect.bottom;
- rect.right = item->rect.right - item->rect.left;
- rect.bottom = item->rect.bottom - item->rect.top;
- }
+ rect.top += item->rect.bottom;
+ rect.right = item->rect.right - item->rect.left;
+ rect.bottom = item->rect.bottom - item->rect.top;
+ }
}
/* use default alignment for submenus */
@@ -2402,7 +2402,7 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu,
MENU_InitPopup( hwndOwner, item->hSubMenu, wFlags );
MENU_ShowPopup( hwndOwner, item->hSubMenu, menu->FocusedItem, wFlags,
- rect.left, rect.top, rect.right, rect.bottom );
+ rect.left, rect.top, rect.right, rect.bottom );
if (selectFirst)
MENU_MoveSelection( hwndOwner, item->hSubMenu, ITEM_NEXT );
return item->hSubMenu;
@@ -2482,7 +2482,7 @@ static INT MENU_ExecFocusedItem( MTRACKER* pmt, HMENU hMenu, UINT wFlags )
TRACE("%p hmenu=%p\n", pmt, hMenu);
if (!menu || !menu->nItems ||
- (menu->FocusedItem == NO_SELECTED_ITEM)) return -1;
+ (menu->FocusedItem == NO_SELECTED_ITEM)) return -1;
item = &menu->items[menu->FocusedItem];
@@ -2490,17 +2490,17 @@ static INT MENU_ExecFocusedItem( MTRACKER* pmt, HMENU hMenu, UINT wFlags )
if (!(item->fType & MF_POPUP))
{
- if (!(item->fState & (MF_GRAYED | MF_DISABLED)) && !(item->fType & MF_SEPARATOR))
- {
- /* If TPM_RETURNCMD is set you return the id, but
- do not send a message to the owner */
- if(!(wFlags & TPM_RETURNCMD))
- {
- if( menu->wFlags & MF_SYSMENU )
- PostMessageW( pmt->hOwnerWnd, WM_SYSCOMMAND, item->wID,
- MAKELPARAM((INT16)pmt->pt.x, (INT16)pmt->pt.y) );
- else
- {
+ if (!(item->fState & (MF_GRAYED | MF_DISABLED)) && !(item->fType & MF_SEPARATOR))
+ {
+ /* If TPM_RETURNCMD is set you return the id, but
+ do not send a message to the owner */
+ if(!(wFlags & TPM_RETURNCMD))
+ {
+ if( menu->wFlags & MF_SYSMENU )
+ PostMessageW( pmt->hOwnerWnd, WM_SYSCOMMAND, item->wID,
+ MAKELPARAM((INT16)pmt->pt.x, (INT16)pmt->pt.y) );
+ else
+ {
POPUPMENU *topmenu = MENU_GetMenu( pmt->hTopMenu );
DWORD dwStyle = menu->dwStyle | (topmenu ? topmenu->dwStyle : 0);
@@ -2509,15 +2509,15 @@ static INT MENU_ExecFocusedItem( MTRACKER* pmt, HMENU hMenu, UINT wFlags )
(LPARAM)hMenu);
else
PostMessageW( pmt->hOwnerWnd, WM_COMMAND, item->wID, 0 );
- }
- }
- return item->wID;
- }
+ }
+ }
+ return item->wID;
+ }
}
else
{
- pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hMenu, TRUE, wFlags);
- return -2;
+ pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hMenu, TRUE, wFlags);
+ return -2;
}
return -1;
@@ -2536,11 +2536,11 @@ static void MENU_SwitchTracking( MTRACKER* pmt, HMENU hPtMenu, UINT id, UINT wFl
TRACE("%p hmenu=%p 0x%04x\n", pmt, hPtMenu, id);
if( pmt->hTopMenu != hPtMenu &&
- !((ptmenu->wFlags | topmenu->wFlags) & MF_POPUP) )
+ !((ptmenu->wFlags | topmenu->wFlags) & MF_POPUP) )
{
- /* both are top level menus (system and menu-bar) */
- MENU_HideSubPopups( pmt->hOwnerWnd, pmt->hTopMenu, FALSE, wFlags );
- MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, NO_SELECTED_ITEM, FALSE, 0 );
+ /* both are top level menus (system and menu-bar) */
+ MENU_HideSubPopups( pmt->hOwnerWnd, pmt->hTopMenu, FALSE, wFlags );
+ MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, NO_SELECTED_ITEM, FALSE, 0 );
pmt->hTopMenu = hPtMenu;
}
else MENU_HideSubPopups( pmt->hOwnerWnd, hPtMenu, FALSE, wFlags );
@@ -2559,29 +2559,29 @@ static BOOL MENU_ButtonDown( MTRACKER* pmt, HMENU hPtMenu, UINT wFlags )
if (hPtMenu)
{
- UINT id = 0;
- POPUPMENU *ptmenu = MENU_GetMenu( hPtMenu );
- MENUITEM *item;
-
- if( IS_SYSTEM_MENU(ptmenu) )
- item = ptmenu->items;
- else
- item = MENU_FindItemByCoords( ptmenu, pmt->pt, &id );
-
- if( item )
- {
- if( ptmenu->FocusedItem != id )
- MENU_SwitchTracking( pmt, hPtMenu, id, wFlags );
-
- /* If the popup menu is not already "popped" */
- if(!(item->fState & MF_MOUSESELECT ))
- {
- pmt->hCurrentMenu = MENU_ShowSubPopup( pmt->hOwnerWnd, hPtMenu, FALSE, wFlags );
- }
-
- return TRUE;
- }
- /* Else the click was on the menu bar, finish the tracking */
+ UINT id = 0;
+ POPUPMENU *ptmenu = MENU_GetMenu( hPtMenu );
+ MENUITEM *item;
+
+ if( IS_SYSTEM_MENU(ptmenu) )
+ item = ptmenu->items;
+ else
+ item = MENU_FindItemByCoords( ptmenu, pmt->pt, &id );
+
+ if( item )
+ {
+ if( ptmenu->FocusedItem != id )
+ MENU_SwitchTracking( pmt, hPtMenu, id, wFlags );
+
+ /* If the popup menu is not already "popped" */
+ if(!(item->fState & MF_MOUSESELECT ))
+ {
+ pmt->hCurrentMenu = MENU_ShowSubPopup( pmt->hOwnerWnd, hPtMenu, FALSE, wFlags );
+ }
+
+ return TRUE;
+ }
+ /* Else the click was on the menu bar, finish the tracking */
}
return FALSE;
}
@@ -2600,34 +2600,34 @@ static INT MENU_ButtonUp( MTRACKER* pmt, HMENU hPtMenu, UINT wFlags)
if (hPtMenu)
{
- UINT id = 0;
- POPUPMENU *ptmenu = MENU_GetMenu( hPtMenu );
- MENUITEM *item;
+ UINT id = 0;
+ POPUPMENU *ptmenu = MENU_GetMenu( hPtMenu );
+ MENUITEM *item;
if( IS_SYSTEM_MENU(ptmenu) )
item = ptmenu->items;
else
item = MENU_FindItemByCoords( ptmenu, pmt->pt, &id );
- if( item && (ptmenu->FocusedItem == id ))
- {
+ if( item && (ptmenu->FocusedItem == id ))
+ {
debug_print_menuitem ("FocusedItem: ", item, "");
- if( !(item->fType & MF_POPUP) )
- {
- INT executedMenuId = MENU_ExecFocusedItem( pmt, hPtMenu, wFlags);
+ if( !(item->fType & MF_POPUP) )
+ {
+ INT executedMenuId = MENU_ExecFocusedItem( pmt, hPtMenu, wFlags);
if (executedMenuId == -1 || executedMenuId == -2) return -1;
return executedMenuId;
- }
+ }
- /* 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((pmt->hTopMenu == hPtMenu) && ptmenu->bTimeToHide)
- return 0;
- }
- if( GetMenu(ptmenu->hWnd) == hPtMenu )
- ptmenu->bTimeToHide = TRUE;
+ /* 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((pmt->hTopMenu == hPtMenu) && ptmenu->bTimeToHide)
+ return 0;
+ }
+ if( GetMenu(ptmenu->hWnd) == hPtMenu )
+ ptmenu->bTimeToHide = TRUE;
}
return -1;
}
@@ -2645,23 +2645,23 @@ static BOOL MENU_MouseMove( MTRACKER* pmt, HMENU hPtMenu, UINT wFlags )
if( hPtMenu )
{
- ptmenu = MENU_GetMenu( hPtMenu );
+ ptmenu = MENU_GetMenu( hPtMenu );
if( IS_SYSTEM_MENU(ptmenu) )
- id = 0;
+ id = 0;
else
MENU_FindItemByCoords( ptmenu, pmt->pt, &id );
}
if( id == NO_SELECTED_ITEM )
{
- MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
- NO_SELECTED_ITEM, TRUE, pmt->hTopMenu);
+ MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
+ NO_SELECTED_ITEM, TRUE, pmt->hTopMenu);
}
else if( ptmenu->FocusedItem != id )
{
- MENU_SwitchTracking( pmt, hPtMenu, id, wFlags );
- pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags);
+ MENU_SwitchTracking( pmt, hPtMenu, id, wFlags );
+ pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags);
}
return TRUE;
}
@@ -2710,9 +2710,9 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk, UINT wFlags )
if( atEnd )
{
MDINEXTMENU next_menu;
- HMENU hNewMenu;
- HWND hNewWnd;
- UINT id = 0;
+ HMENU hNewMenu;
+ HWND hNewWnd;
+ UINT id = 0;
next_menu.hmenuIn = (IS_SYSTEM_MENU(menu)) ? GetSubMenu(pmt->hTopMenu,0) : pmt->hTopMenu;
next_menu.hmenuNext = 0;
@@ -2722,80 +2722,80 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk, UINT wFlags )
TRACE("%p [%p] -> %p [%p]\n",
pmt->hCurrentMenu, pmt->hOwnerWnd, next_menu.hmenuNext, next_menu.hwndNext );
- if (!next_menu.hmenuNext || !next_menu.hwndNext)
- {
+ if (!next_menu.hmenuNext || !next_menu.hwndNext)
+ {
DWORD style = GetWindowLongW( pmt->hOwnerWnd, GWL_STYLE );
- hNewWnd = pmt->hOwnerWnd;
- if( IS_SYSTEM_MENU(menu) )
- {
- /* switch to the menu bar */
+ hNewWnd = pmt->hOwnerWnd;
+ if( IS_SYSTEM_MENU(menu) )
+ {
+ /* switch to the menu bar */
if(style & WS_CHILD || !(hNewMenu = GetMenu(hNewWnd))) return FALSE;
- if( vk == VK_LEFT )
- {
- menu = MENU_GetMenu( hNewMenu );
- id = menu->nItems - 1;
+ if( vk == VK_LEFT )
+ {
+ menu = MENU_GetMenu( hNewMenu );
+ id = menu->nItems - 1;
/* Skip backwards over any system predefined icons,
eg. MDI close, restore etc icons */
while ((id > 0) &&
(menu->items[id].wID >= SC_SIZE &&
menu->items[id].wID <= SC_RESTORE)) id--;
- }
- }
- else if (style & WS_SYSMENU )
- {
- /* switch to the system menu */
- hNewMenu = get_win_sys_menu( hNewWnd );
- }
+ }
+ }
+ else if (style & WS_SYSMENU )
+ {
+ /* switch to the system menu */
+ hNewMenu = get_win_sys_menu( hNewWnd );
+ }
else return FALSE;
- }
- else /* application returned a new menu to switch to */
- {
+ }
+ else /* application returned a new menu to switch to */
+ {
hNewMenu = next_menu.hmenuNext;
hNewWnd = WIN_GetFullHandle( next_menu.hwndNext );
- if( IsMenu(hNewMenu) && IsWindow(hNewWnd) )
- {
+ if( IsMenu(hNewMenu) && IsWindow(hNewWnd) )
+ {
DWORD style = GetWindowLongW( hNewWnd, GWL_STYLE );
- if (style & WS_SYSMENU &&
- GetSubMenu(get_win_sys_menu(hNewWnd), 0) == hNewMenu )
- {
- /* get the real system menu */
- hNewMenu = get_win_sys_menu(hNewWnd);
- }
- else if (style & WS_CHILD || GetMenu(hNewWnd) != hNewMenu )
- {
- /* FIXME: Not sure what to do here;
- * perhaps try to track hNewMenu as a popup? */
-
- TRACE(" -- got confused.\n");
- return FALSE;
- }
- }
- else return FALSE;
- }
-
- if( hNewMenu != pmt->hTopMenu )
- {
- MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, NO_SELECTED_ITEM,
+ if (style & WS_SYSMENU &&
+ GetSubMenu(get_win_sys_menu(hNewWnd), 0) == hNewMenu )
+ {
+ /* get the real system menu */
+ hNewMenu = get_win_sys_menu(hNewWnd);
+ }
+ else if (style & WS_CHILD || GetMenu(hNewWnd) != hNewMenu )
+ {
+ /* FIXME: Not sure what to do here;
+ * perhaps try to track hNewMenu as a popup? */
+
+ TRACE(" -- got confused.\n");
+ return FALSE;
+ }
+ }
+ else return FALSE;
+ }
+
+ if( hNewMenu != pmt->hTopMenu )
+ {
+ MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, NO_SELECTED_ITEM,
FALSE, 0 );
- if( pmt->hCurrentMenu != pmt->hTopMenu )
- MENU_HideSubPopups( pmt->hOwnerWnd, pmt->hTopMenu, FALSE, wFlags );
- }
+ if( pmt->hCurrentMenu != pmt->hTopMenu )
+ MENU_HideSubPopups( pmt->hOwnerWnd, pmt->hTopMenu, FALSE, wFlags );
+ }
- if( hNewWnd != pmt->hOwnerWnd )
- {
- pmt->hOwnerWnd = hNewWnd;
+ if( hNewWnd != pmt->hOwnerWnd )
+ {
+ pmt->hOwnerWnd = hNewWnd;
set_capture_window( pmt->hOwnerWnd, GUI_INMENUMODE, NULL );
- }
+ }
- pmt->hTopMenu = pmt->hCurrentMenu = hNewMenu; /* all subpopups are hidden */
- MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, id, TRUE, 0 );
+ pmt->hTopMenu = pmt->hCurrentMenu = hNewMenu; /* all subpopups are hidden */
+ MENU_SelectItem( pmt->hOwnerWnd, pmt->hTopMenu, id, TRUE, 0 );
- return TRUE;
+ return TRUE;
}
return FALSE;
}
@@ -2817,20 +2817,20 @@ static BOOL MENU_SuspendPopup( MTRACKER* pmt, UINT uMsg )
switch( uMsg )
{
- case WM_KEYDOWN:
- PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE);
- if( msg.message == WM_KEYUP || msg.message == WM_PAINT )
- {
- PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_REMOVE);
- PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE);
- if( msg.message == WM_KEYDOWN &&
- (msg.wParam == VK_LEFT || msg.wParam == VK_RIGHT))
- {
- pmt->trackFlags |= TF_SUSPENDPOPUP;
- return TRUE;
- }
- }
- break;
+ case WM_KEYDOWN:
+ PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE);
+ if( msg.message == WM_KEYUP || msg.message == WM_PAINT )
+ {
+ PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_REMOVE);
+ PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE);
+ if( msg.message == WM_KEYDOWN &&
+ (msg.wParam == VK_LEFT || msg.wParam == VK_RIGHT))
+ {
+ pmt->trackFlags |= TF_SUSPENDPOPUP;
+ return TRUE;
+ }
+ }
+ break;
}
/* failures go through this */
@@ -2889,18 +2889,18 @@ static void MENU_KeyLeft( MTRACKER* pmt, UINT wFlags, UINT msg )
/* Try to move 1 column left (if possible) */
if( (prevcol = MENU_GetStartOfPrevColumn( pmt->hCurrentMenu )) !=
- NO_SELECTED_ITEM ) {
+ NO_SELECTED_ITEM ) {
- MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
- prevcol, TRUE, 0 );
- return;
+ MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
+ prevcol, TRUE, 0 );
+ return;
}
/* close topmost popup */
while (hmenutmp != pmt->hCurrentMenu)
{
- hmenuprev = hmenutmp;
- hmenutmp = MENU_GetSubPopup( hmenuprev );
+ hmenuprev = hmenutmp;
+ hmenutmp = MENU_GetSubPopup( hmenuprev );
}
MENU_HideSubPopups( pmt->hOwnerWnd, hmenuprev, TRUE, wFlags );
@@ -2908,20 +2908,20 @@ static void MENU_KeyLeft( MTRACKER* pmt, UINT wFlags, UINT msg )
if ( (hmenuprev == pmt->hTopMenu) && !(menu->wFlags & MF_POPUP) )
{
- /* move menu bar selection if no more popups are left */
+ /* move menu bar selection if no more popups are left */
- if( !MENU_DoNextMenu( pmt, VK_LEFT, wFlags ) )
- MENU_MoveSelection( pmt->hOwnerWnd, pmt->hTopMenu, ITEM_PREV );
+ if( !MENU_DoNextMenu( pmt, VK_LEFT, wFlags ) )
+ MENU_MoveSelection( pmt->hOwnerWnd, pmt->hTopMenu, ITEM_PREV );
- if ( hmenuprev != hmenutmp || pmt->trackFlags & TF_SUSPENDPOPUP )
- {
- /* A sublevel menu was displayed - display the next one
- * unless there is another displacement coming up */
+ if ( hmenuprev != hmenutmp || pmt->trackFlags & TF_SUSPENDPOPUP )
+ {
+ /* A sublevel menu was displayed - display the next one
+ * unless there is another displacement coming up */
- if( !MENU_SuspendPopup( pmt, msg ) )
- pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,
- pmt->hTopMenu, TRUE, wFlags);
- }
+ if( !MENU_SuspendPopup( pmt, msg ) )
+ pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,
+ pmt->hTopMenu, TRUE, wFlags);
+ }
}
}
@@ -2944,40 +2944,40 @@ static void MENU_KeyRight( MTRACKER* pmt, UINT wFlags, UINT msg )
if ( (menu->wFlags & MF_POPUP) || (pmt->hCurrentMenu != pmt->hTopMenu))
{
- /* If already displaying a popup, try to display sub-popup */
+ /* If already displaying a popup, try to display sub-popup */
- hmenutmp = pmt->hCurrentMenu;
- pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hmenutmp, TRUE, wFlags);
+ hmenutmp = pmt->hCurrentMenu;
+ pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hmenutmp, TRUE, wFlags);
- /* if subpopup was displayed then we are done */
- if (hmenutmp != pmt->hCurrentMenu) return;
+ /* if subpopup was displayed then we are done */
+ if (hmenutmp != pmt->hCurrentMenu) return;
}
/* Check to see if there's another column */
if( (nextcol = MENU_GetStartOfNextColumn( pmt->hCurrentMenu )) !=
- NO_SELECTED_ITEM ) {
- TRACE("Going to %d.\n", nextcol );
- MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
- nextcol, TRUE, 0 );
- return;
+ NO_SELECTED_ITEM ) {
+ TRACE("Going to %d.\n", nextcol );
+ MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
+ nextcol, TRUE, 0 );
+ return;
}
- if (!(menu->wFlags & MF_POPUP)) /* menu bar tracking */
+ if (!(menu->wFlags & MF_POPUP)) /* menu bar tracking */
{
- if( pmt->hCurrentMenu != pmt->hTopMenu )
- {
- MENU_HideSubPopups( pmt->hOwnerWnd, pmt->hTopMenu, FALSE, wFlags );
- hmenutmp = pmt->hCurrentMenu = pmt->hTopMenu;
- } else hmenutmp = 0;
+ if( pmt->hCurrentMenu != pmt->hTopMenu )
+ {
+ MENU_HideSubPopups( pmt->hOwnerWnd, pmt->hTopMenu, FALSE, wFlags );
+ hmenutmp = pmt->hCurrentMenu = pmt->hTopMenu;
+ } else hmenutmp = 0;
- /* try to move to the next item */
- if( !MENU_DoNextMenu( pmt, VK_RIGHT, wFlags ) )
- MENU_MoveSelection( pmt->hOwnerWnd, pmt->hTopMenu, ITEM_NEXT );
+ /* try to move to the next item */
+ if( !MENU_DoNextMenu( pmt, VK_RIGHT, wFlags ) )
+ MENU_MoveSelection( pmt->hOwnerWnd, pmt->hTopMenu, ITEM_NEXT );
- if( hmenutmp || pmt->trackFlags & TF_SUSPENDPOPUP )
- if( !MENU_SuspendPopup( pmt, msg ) )
- pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,
- pmt->hTopMenu, TRUE, wFlags);
+ if( hmenutmp || pmt->trackFlags & TF_SUSPENDPOPUP )
+ if( !MENU_SuspendPopup( pmt, msg ) )
+ pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,
+ pmt->hTopMenu, TRUE, wFlags);
}
}
@@ -3021,9 +3021,9 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
if (wFlags & TPM_BUTTONDOWN)
{
- /* Get the result in order to start the tracking or not */
- fRemove = MENU_ButtonDown( &mt, hmenu, wFlags );
- fEndMenu = !fRemove;
+ /* Get the result in order to start the tracking or not */
+ fRemove = MENU_ButtonDown( &mt, hmenu, wFlags );
+ fEndMenu = !fRemove;
}
if (wFlags & TF_ENDMENU) fEndMenu = TRUE;
@@ -3037,12 +3037,12 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
__TRY while (!fEndMenu)
{
- menu = MENU_GetMenu( mt.hCurrentMenu );
- if (!menu) /* sometimes happens if I do a window manager close */
- break;
+ menu = MENU_GetMenu( mt.hCurrentMenu );
+ if (!menu) /* sometimes happens if I do a window manager close */
+ break;
- /* we have to keep the message in the queue until it's
- * clear that menu loop is not over yet. */
+ /* we have to keep the message in the queue until it's
+ * clear that menu loop is not over yet. */
for (;;)
{
@@ -3064,28 +3064,28 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
}
}
- /* check if EndMenu() tried to cancel us, by posting this message */
+ /* check if EndMenu() tried to cancel us, by posting this message */
if(msg.message == WM_CANCELMODE)
- {
- /* we are now out of the loop */
- fEndMenu = TRUE;
+ {
+ /* we are now out of the loop */
+ fEndMenu = TRUE;
- /* remove the message from the queue */
- PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
+ /* remove the message from the queue */
+ PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
- /* break out of internal loop, ala ESCAPE */
- break;
- }
+ /* break out of internal loop, ala ESCAPE */
+ break;
+ }
TranslateMessage( &msg );
mt.pt = msg.pt;
- if ( (msg.hwnd==menu->hWnd) || (msg.message!=WM_TIMER) )
- enterIdleSent=FALSE;
+ if ( (msg.hwnd==menu->hWnd) || (msg.message!=WM_TIMER) )
+ enterIdleSent=FALSE;
fRemove = FALSE;
- if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST))
- {
+ if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST))
+ {
/*
* Use the mouse coordinates in lParam instead of those in the MSG
* struct to properly handle synthetic messages. They are already
@@ -3094,168 +3094,168 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
mt.pt.x = (short)LOWORD(msg.lParam);
mt.pt.y = (short)HIWORD(msg.lParam);
- /* Find a menu for this mouse event */
- hmenu = MENU_PtMenu( mt.hTopMenu, mt.pt );
-
- switch(msg.message)
- {
- /* no WM_NC... messages in captured state */
-
- case WM_RBUTTONDBLCLK:
- case WM_RBUTTONDOWN:
- if (!(wFlags & TPM_RIGHTBUTTON)) break;
- /* fall through */
- case WM_LBUTTONDBLCLK:
- case WM_LBUTTONDOWN:
- /* If the message belongs to the menu, removes it from the queue */
- /* Else, end menu tracking */
- fRemove = MENU_ButtonDown( &mt, hmenu, wFlags );
- fEndMenu = !fRemove;
- break;
-
- case WM_RBUTTONUP:
- if (!(wFlags & TPM_RIGHTBUTTON)) break;
- /* fall through */
- case WM_LBUTTONUP:
- /* Check if a menu was selected by the mouse */
- if (hmenu)
- {
+ /* Find a menu for this mouse event */
+ hmenu = MENU_PtMenu( mt.hTopMenu, mt.pt );
+
+ switch(msg.message)
+ {
+ /* no WM_NC... messages in captured state */
+
+ case WM_RBUTTONDBLCLK:
+ case WM_RBUTTONDOWN:
+ if (!(wFlags & TPM_RIGHTBUTTON)) break;
+ /* fall through */
+ case WM_LBUTTONDBLCLK:
+ case WM_LBUTTONDOWN:
+ /* If the message belongs to the menu, removes it from the queue */
+ /* Else, end menu tracking */
+ fRemove = MENU_ButtonDown( &mt, hmenu, wFlags );
+ fEndMenu = !fRemove;
+ break;
+
+ case WM_RBUTTONUP:
+ if (!(wFlags & TPM_RIGHTBUTTON)) break;
+ /* fall through */
+ case WM_LBUTTONUP:
+ /* Check if a menu was selected by the mouse */
+ if (hmenu)
+ {
executedMenuId = MENU_ButtonUp( &mt, hmenu, wFlags);
TRACE("executedMenuId %d\n", executedMenuId);
- /* End the loop if executedMenuId is an item ID */
- /* or if the job was done (executedMenuId = 0). */
+ /* End the loop if executedMenuId is an item ID */
+ /* or if the job was done (executedMenuId = 0). */
fEndMenu = fRemove = (executedMenuId != -1);
- }
+ }
/* No menu was selected by the mouse */
/* if the function was called by TrackPopupMenu, continue
with the menu tracking. If not, stop it */
else
fEndMenu = !(wFlags & TPM_POPUPMENU);
- break;
+ break;
- case WM_MOUSEMOVE:
+ case WM_MOUSEMOVE:
/* the selected menu item must be changed every time */
- /* the mouse moves. */
+ /* the mouse moves. */
if (hmenu)
- fEndMenu |= !MENU_MouseMove( &mt, hmenu, wFlags );
+ fEndMenu |= !MENU_MouseMove( &mt, hmenu, wFlags );
- } /* switch(msg.message) - mouse */
- }
- else if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST))
- {
+ } /* switch(msg.message) - mouse */
+ }
+ else if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST))
+ {
fRemove = TRUE; /* Keyboard messages are always removed */
- switch(msg.message)
- {
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- switch(msg.wParam)
- {
- case VK_MENU:
- case VK_F10:
- fEndMenu = TRUE;
- break;
-
- case VK_HOME:
- case VK_END:
- MENU_SelectItem( mt.hOwnerWnd, mt.hCurrentMenu,
- NO_SELECTED_ITEM, FALSE, 0 );
- MENU_MoveSelection( mt.hOwnerWnd, mt.hCurrentMenu,
- (msg.wParam == VK_HOME)? ITEM_NEXT : ITEM_PREV );
- break;
-
- case VK_UP:
- case VK_DOWN: /* If on menu bar, pull-down the menu */
-
- menu = MENU_GetMenu( mt.hCurrentMenu );
- if (!(menu->wFlags & MF_POPUP))
- mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, mt.hTopMenu, TRUE, wFlags);
- else /* otherwise try to move selection */
- MENU_MoveSelection( mt.hOwnerWnd, mt.hCurrentMenu,
+ switch(msg.message)
+ {
+ case WM_KEYDOWN:
+ case WM_SYSKEYDOWN:
+ switch(msg.wParam)
+ {
+ case VK_MENU:
+ case VK_F10:
+ fEndMenu = TRUE;
+ break;
+
+ case VK_HOME:
+ case VK_END:
+ MENU_SelectItem( mt.hOwnerWnd, mt.hCurrentMenu,
+ NO_SELECTED_ITEM, FALSE, 0 );
+ MENU_MoveSelection( mt.hOwnerWnd, mt.hCurrentMenu,
+ (msg.wParam == VK_HOME)? ITEM_NEXT : ITEM_PREV );
+ break;
+
+ case VK_UP:
+ case VK_DOWN: /* If on menu bar, pull-down the menu */
+
+ menu = MENU_GetMenu( mt.hCurrentMenu );
+ if (!(menu->wFlags & MF_POPUP))
+ mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, mt.hTopMenu, TRUE, wFlags);
+ else /* otherwise try to move selection */
+ MENU_MoveSelection( mt.hOwnerWnd, mt.hCurrentMenu,
(msg.wParam == VK_UP)? ITEM_PREV : ITEM_NEXT );
- break;
+ break;
- case VK_LEFT:
- MENU_KeyLeft( &mt, wFlags, msg.message );
- break;
+ case VK_LEFT:
+ MENU_KeyLeft( &mt, wFlags, msg.message );
+ break;
- case VK_RIGHT:
- MENU_KeyRight( &mt, wFlags, msg.message );
- break;
+ case VK_RIGHT:
+ MENU_KeyRight( &mt, wFlags, msg.message );
+ break;
- case VK_ESCAPE:
+ case VK_ESCAPE:
fEndMenu = MENU_KeyEscape(&mt, wFlags);
- break;
-
- case VK_F1:
- {
- HELPINFO hi;
- hi.cbSize = sizeof(HELPINFO);
- hi.iContextType = HELPINFO_MENUITEM;
- if (menu->FocusedItem == NO_SELECTED_ITEM)
- hi.iCtrlId = 0;
- else
- hi.iCtrlId = menu->items[menu->FocusedItem].wID;
- hi.hItemHandle = hmenu;
- hi.dwContextId = menu->dwContextHelpID;
- hi.MousePos = msg.pt;
- SendMessageW(hwnd, WM_HELP, 0, (LPARAM)&hi);
- break;
- }
-
- default:
- break;
- }
- break; /* WM_KEYDOWN */
-
- case WM_CHAR:
- case WM_SYSCHAR:
- {
- UINT pos;
-
- if (msg.wParam == '\r' || msg.wParam == ' ')
- {
+ break;
+
+ case VK_F1:
+ {
+ HELPINFO hi;
+ hi.cbSize = sizeof(HELPINFO);
+ hi.iContextType = HELPINFO_MENUITEM;
+ if (menu->FocusedItem == NO_SELECTED_ITEM)
+ hi.iCtrlId = 0;
+ else
+ hi.iCtrlId = menu->items[menu->FocusedItem].wID;
+ hi.hItemHandle = hmenu;
+ hi.dwContextId = menu->dwContextHelpID;
+ hi.MousePos = msg.pt;
+ SendMessageW(hwnd, WM_HELP, 0, (LPARAM)&hi);
+ break;
+ }
+
+ default:
+ break;
+ }
+ break; /* WM_KEYDOWN */
+
+ case WM_CHAR:
+ case WM_SYSCHAR:
+ {
+ UINT pos;
+
+ if (msg.wParam == '\r' || msg.wParam == ' ')
+ {
executedMenuId = MENU_ExecFocusedItem(&mt,mt.hCurrentMenu, wFlags);
fEndMenu = (executedMenuId != -2);
- break;
- }
+ break;
+ }
- /* Hack to avoid control chars. */
- /* We will find a better way real soon... */
- if (msg.wParam < 32) break;
+ /* Hack to avoid control chars. */
+ /* We will find a better way real soon... */
+ if (msg.wParam < 32) break;
- pos = MENU_FindItemByKey( mt.hOwnerWnd, mt.hCurrentMenu,
+ pos = MENU_FindItemByKey( mt.hOwnerWnd, mt.hCurrentMenu,
LOWORD(msg.wParam), FALSE );
- if (pos == (UINT)-2) fEndMenu = TRUE;
- else if (pos == (UINT)-1) MessageBeep(0);
- else
- {
- MENU_SelectItem( mt.hOwnerWnd, mt.hCurrentMenu, pos,
+ if (pos == (UINT)-2) fEndMenu = TRUE;
+ else if (pos == (UINT)-1) MessageBeep(0);
+ else
+ {
+ MENU_SelectItem( mt.hOwnerWnd, mt.hCurrentMenu, pos,
TRUE, 0 );
executedMenuId = MENU_ExecFocusedItem(&mt,mt.hCurrentMenu, wFlags);
fEndMenu = (executedMenuId != -2);
- }
- }
- break;
- } /* switch(msg.message) - kbd */
- }
- else
- {
- PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
- DispatchMessageW( &msg );
- continue;
- }
-
- if (!fEndMenu) fRemove = TRUE;
-
- /* finally remove message from the queue */
+ }
+ }
+ break;
+ } /* switch(msg.message) - kbd */
+ }
+ else
+ {
+ PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
+ DispatchMessageW( &msg );
+ continue;
+ }
+
+ if (!fEndMenu) fRemove = TRUE;
+
+ /* finally remove message from the queue */
if (fRemove && !(mt.trackFlags & TF_SKIPREMOVE) )
- PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
- else mt.trackFlags &= ~TF_SKIPREMOVE;
+ PeekMessageW( &msg, 0, msg.message, msg.message, PM_REMOVE );
+ else mt.trackFlags &= ~TF_SKIPREMOVE;
}
__FINALLY( release_capture )
@@ -3265,23 +3265,23 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
check for this first. */
if( IsMenu( mt.hTopMenu ) )
{
- menu = MENU_GetMenu( mt.hTopMenu );
+ menu = MENU_GetMenu( mt.hTopMenu );
if( IsWindow( mt.hOwnerWnd ) )
{
- MENU_HideSubPopups( mt.hOwnerWnd, mt.hTopMenu, FALSE, wFlags );
+ MENU_HideSubPopups( mt.hOwnerWnd, mt.hTopMenu, FALSE, wFlags );
- if (menu && (menu->wFlags & MF_POPUP))
- {
+ if (menu && (menu->wFlags & MF_POPUP))
+ {
DestroyWindow( menu->hWnd );
menu->hWnd = 0;
if (!(wFlags & TPM_NONOTIFY))
SendMessageW( mt.hOwnerWnd, WM_UNINITMENUPOPUP, (WPARAM)mt.hTopMenu,
MAKELPARAM(0, IS_SYSTEM_MENU(menu)) );
- }
- MENU_SelectItem( mt.hOwnerWnd, mt.hTopMenu, NO_SELECTED_ITEM, FALSE, 0 );
- SendMessageW( mt.hOwnerWnd, WM_MENUSELECT, MAKEWPARAM(0,0xffff), 0 );
+ }
+ MENU_SelectItem( mt.hOwnerWnd, mt.hTopMenu, NO_SELECTED_ITEM, FALSE, 0 );
+ SendMessageW( mt.hOwnerWnd, WM_MENUSELECT, MAKEWPARAM(0,0xffff), 0 );
}
/* Reset the variable for hiding menu */
@@ -3366,12 +3366,12 @@ void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt )
if (GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL) wFlags |= TPM_LAYOUTRTL;
if (IsMenu(hMenu))
{
- MENU_InitTracking( hWnd, hMenu, FALSE, wFlags );
+ MENU_InitTracking( hWnd, hMenu, FALSE, wFlags );
/* fetch the window menu again, it may have changed */
hMenu = (ht == HTSYSMENU) ? get_win_sys_menu( hWnd ) : GetMenu( hWnd );
- MENU_TrackMenu( hMenu, wFlags, pt.x, pt.y, hWnd, NULL );
- MENU_ExitTracking(hWnd, FALSE);
+ MENU_TrackMenu( hMenu, wFlags, pt.x, pt.y, hWnd, NULL );
+ MENU_ExitTracking(hWnd, FALSE);
}
}
@@ -3524,28 +3524,28 @@ LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM
switch(message)
{
case WM_CREATE:
- {
- CREATESTRUCTW *cs = (CREATESTRUCTW*)lParam;
- SetWindowLongPtrW( hwnd, 0, (LONG_PTR)cs->lpCreateParams );
+ {
+ CREATESTRUCTW *cs = (CREATESTRUCTW*)lParam;
+ SetWindowLongPtrW( hwnd, 0, (LONG_PTR)cs->lpCreateParams );
return 0;
- }
+ }
case WM_MOUSEACTIVATE: /* We don't want to be activated */
return MA_NOACTIVATE;
case WM_PAINT:
- {
- PAINTSTRUCT ps;
- BeginPaint( hwnd, &ps );
- MENU_DrawPopupMenu( hwnd, ps.hdc,
+ {
+ PAINTSTRUCT ps;
+ BeginPaint( hwnd, &ps );
+ MENU_DrawPopupMenu( hwnd, ps.hdc,
(HMENU)GetWindowLongPtrW( hwnd, 0 ) );
- EndPaint( hwnd, &ps );
+ EndPaint( hwnd, &ps );
return 0;
- }
+ }
case WM_PRINTCLIENT:
- {
- MENU_DrawPopupMenu( hwnd, (HDC)wParam,
+ {
+ MENU_DrawPopupMenu( hwnd, (HDC)wParam,
(HMENU)GetWindowLongPtrW( hwnd, 0 ) );
return 0;
}
@@ -3563,13 +3563,13 @@ LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_SHOWWINDOW:
- if( wParam )
- {
+ if( wParam )
+ {
if (!GetWindowLongPtrW( hwnd, 0 )) ERR("no menu to display\n");
- }
- else
+ }
+ else
SetWindowLongPtrW( hwnd, 0, 0 );
- break;
+ break;
case MN_GETHMENU:
return GetWindowLongPtrW( hwnd, 0 );
@@ -3675,10 +3675,10 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags )
/* Get the Popupmenu to access the owner menu */
if (!(menu = MENU_GetMenu(hMenu)))
- return (UINT)-1;
+ return (UINT)-1;
if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags )))
- return (UINT)-1;
+ return (UINT)-1;
oldflags = item->fState & (MF_GRAYED | MF_DISABLED);
item->fState ^= (oldflags ^ wFlags) & (MF_GRAYED | MF_DISABLED);
@@ -3686,20 +3686,20 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags )
/* If the close item in the system menu change update the close button */
if((item->wID == SC_CLOSE) && (oldflags != wFlags))
{
- if (menu->hSysMenuOwner != 0)
- {
+ if (menu->hSysMenuOwner != 0)
+ {
RECT rc;
- POPUPMENU* parentMenu;
+ POPUPMENU* parentMenu;
- /* Get the parent menu to access*/
- if (!(parentMenu = MENU_GetMenu(menu->hSysMenuOwner)))
- return (UINT)-1;
+ /* Get the parent menu to access*/
+ if (!(parentMenu = MENU_GetMenu(menu->hSysMenuOwner)))
+ return (UINT)-1;
/* Refresh the frame to reflect the change */
WIN_GetRectangles( parentMenu->hWnd, COORDS_CLIENT, &rc, NULL );
rc.bottom = 0;
RedrawWindow(parentMenu->hWnd, &rc, 0, RDW_FRAME | RDW_INVALIDATE | RDW_NOCHILDREN);
- }
+ }
}
return oldflags;
@@ -3710,11 +3710,11 @@ BOOL WINAPI EnableMenuItem( HMENU hMenu, UINT wItemID, UINT wFlags )
* GetMenuStringA (USER32.@)
*/
INT WINAPI GetMenuStringA(
- HMENU hMenu, /* [in] menuhandle */
- UINT wItemID, /* [in] menu item (dep. on wFlags) */
- LPSTR str, /* [out] outbuffer. If NULL, func returns entry length*/
- INT nMaxSiz, /* [in] length of buffer. if 0, func returns entry len*/
- UINT wFlags /* [in] MF_ flags */
+ HMENU hMenu, /* [in] menuhandle */
+ UINT wItemID, /* [in] menu item (dep. on wFlags) */
+ LPSTR str, /* [out] outbuffer. If NULL, func returns entry length*/
+ INT nMaxSiz, /* [in] length of buffer. if 0, func returns entry len*/
+ UINT wFlags /* [in] MF_ flags */
) {
MENUITEM *item;
@@ -3786,16 +3786,16 @@ UINT WINAPI GetMenuState( HMENU hMenu, UINT wItemID, UINT wFlags )
debug_print_menuitem (" item: ", item, "");
if (item->fType & MF_POPUP)
{
- POPUPMENU *menu = MENU_GetMenu( item->hSubMenu );
- if (!menu) return -1;
- else return (menu->nItems << 8) | ((item->fState|item->fType) & 0xff);
+ POPUPMENU *menu = MENU_GetMenu( item->hSubMenu );
+ if (!menu) return -1;
+ else return (menu->nItems << 8) | ((item->fState|item->fType) & 0xff);
}
else
{
- /* We used to (from way back then) mask the result to 0xff. */
- /* I don't know why and it seems wrong as the documented */
- /* return flag MF_SEPARATOR is outside that mask. */
- return (item->fType | item->fState);
+ /* We used to (from way back then) mask the result to 0xff. */
+ /* I don't know why and it seems wrong as the documented */
+ /* return flag MF_SEPARATOR is outside that mask. */
+ return (item->fType | item->fState);
}
}
@@ -3805,7 +3805,7 @@ UINT WINAPI GetMenuState( HMENU hMenu, UINT wItemID, UINT wFlags )
*/
INT WINAPI GetMenuItemCount( HMENU hMenu )
{
- LPPOPUPMENU menu = MENU_GetMenu(hMenu);
+ LPPOPUPMENU menu = MENU_GetMenu(hMenu);
if (!menu) return -1;
TRACE("(%p) returning %d\n", hMenu, menu->nItems );
return menu->nItems;
@@ -3946,7 +3946,7 @@ BOOL WINAPI AppendMenuW( HMENU hMenu, UINT flags,
*/
BOOL WINAPI RemoveMenu( HMENU hMenu, UINT nPos, UINT wFlags )
{
- LPPOPUPMENU menu;
+ LPPOPUPMENU menu;
MENUITEM *item;
TRACE("(menu=%p pos=%04x flags=%04x)\n",hMenu, nPos, wFlags);
@@ -3964,12 +3964,12 @@ BOOL WINAPI RemoveMenu( HMENU hMenu, UINT nPos, UINT wFlags )
}
else
{
- while(nPos < menu->nItems)
- {
- *item = *(item+1);
- item++;
- nPos++;
- }
+ while(nPos < menu->nItems)
+ {
+ *item = *(item+1);
+ item++;
+ nPos++;
+ }
menu->items = HeapReAlloc( GetProcessHeap(), 0, menu->items,
menu->nItems * sizeof(MENUITEM) );
}
@@ -4079,13 +4079,13 @@ BOOL WINAPI SetMenuItemBitmaps( HMENU hMenu, UINT nPos, UINT wFlags,
if (!hNewCheck && !hNewUnCheck)
{
- item->fState &= ~MF_USECHECKBITMAPS;
+ item->fState &= ~MF_USECHECKBITMAPS;
}
else /* Install new bitmaps */
{
- item->hCheckBit = hNewCheck;
- item->hUnCheckBit = hNewUnCheck;
- item->fState |= MF_USECHECKBITMAPS;
+ item->hCheckBit = hNewCheck;
+ item->hUnCheckBit = hNewUnCheck;
+ item->fState |= MF_USECHECKBITMAPS;
}
return TRUE;
}
@@ -4161,25 +4161,25 @@ HMENU WINAPI GetSystemMenu( HWND hWnd, BOOL bRevert )
}
else if (wndPtr)
{
- if (wndPtr->hSysMenu && bRevert)
- {
+ if (wndPtr->hSysMenu && bRevert)
+ {
DestroyMenu(wndPtr->hSysMenu);
wndPtr->hSysMenu = 0;
- }
+ }
- if(!wndPtr->hSysMenu && (wndPtr->dwStyle & WS_SYSMENU) )
- wndPtr->hSysMenu = MENU_GetSysMenu( hWnd, 0 );
+ if(!wndPtr->hSysMenu && (wndPtr->dwStyle & WS_SYSMENU) )
+ wndPtr->hSysMenu = MENU_GetSysMenu( hWnd, 0 );
- if( wndPtr->hSysMenu )
+ if( wndPtr->hSysMenu )
{
- POPUPMENU *menu;
- retvalue = GetSubMenu(wndPtr->hSysMenu, 0);
-
- /* Store the dummy sysmenu handle to facilitate the refresh */
- /* of the close button if the SC_CLOSE item change */
- menu = MENU_GetMenu(retvalue);
- if ( menu )
- menu->hSysMenuOwner = wndPtr->hSysMenu;
+ POPUPMENU *menu;
+ retvalue = GetSubMenu(wndPtr->hSysMenu, 0);
+
+ /* Store the dummy sysmenu handle to facilitate the refresh */
+ /* of the close button if the SC_CLOSE item change */
+ menu = MENU_GetMenu(retvalue);
+ if ( menu )
+ menu->hSysMenuOwner = wndPtr->hSysMenu;
}
WIN_ReleasePtr( wndPtr );
}
@@ -4196,10 +4196,10 @@ BOOL WINAPI SetSystemMenu( HWND hwnd, HMENU hMenu )
if (wndPtr && wndPtr != WND_OTHER_PROCESS && wndPtr != WND_DESKTOP)
{
- if (wndPtr->hSysMenu) DestroyMenu( wndPtr->hSysMenu );
- wndPtr->hSysMenu = MENU_GetSysMenu( hwnd, hMenu );
+ if (wndPtr->hSysMenu) DestroyMenu( wndPtr->hSysMenu );
+ wndPtr->hSysMenu = MENU_GetSysMenu( hwnd, hMenu );
WIN_ReleasePtr( wndPtr );
- return TRUE;
+ return TRUE;
}
return FALSE;
}
@@ -4460,13 +4460,13 @@ BOOL WINAPI EndMenu(void)
/* if we are in the menu code, and it is active */
if (!fEndMenu && top_popup)
{
- /* terminate the menu handling code */
+ /* terminate the menu handling code */
fEndMenu = TRUE;
- /* needs to be posted to wakeup the internal menu handler */
- /* which will now terminate the menu, in the event that */
- /* the main window was minimized, or lost focus, so we */
- /* don't end up with an orphaned menu */
+ /* needs to be posted to wakeup the internal menu handler */
+ /* which will now terminate the menu, in the event that */
+ /* the main window was minimized, or lost focus, so we */
+ /* don't end up with an orphaned menu */
PostMessageW( top_popup, WM_CANCELMODE, 0, 0);
}
return fEndMenu;
@@ -4496,7 +4496,7 @@ HMENU WINAPI LoadMenuW( HINSTANCE instance, LPCWSTR name )
/**********************************************************************
- * LoadMenuIndirectW (USER32.@)
+ * LoadMenuIndirectW (USER32.@)
*/
HMENU WINAPI LoadMenuIndirectW( LPCVOID template )
{
@@ -4510,25 +4510,25 @@ HMENU WINAPI LoadMenuIndirectW( LPCVOID template )
switch (version)
{
case 0: /* standard format is version of 0 */
- offset = GET_WORD(p);
- p += sizeof(WORD) + offset;
- if (!(hMenu = CreateMenu())) return 0;
- if (!MENU_ParseResource( p, hMenu ))
- {
- DestroyMenu( hMenu );
- return 0;
- }
- return hMenu;
+ offset = GET_WORD(p);
+ p += sizeof(WORD) + offset;
+ if (!(hMenu = CreateMenu())) return 0;
+ if (!MENU_ParseResource( p, hMenu ))
+ {
+ DestroyMenu( hMenu );
+ return 0;
+ }
+ return hMenu;
case 1: /* extended format is version of 1 */
- offset = GET_WORD(p);
- p += sizeof(WORD) + offset;
- if (!(hMenu = CreateMenu())) return 0;
- if (!MENUEX_ParseResource( p, hMenu))
- {
- DestroyMenu( hMenu );
- return 0;
- }
- return hMenu;
+ offset = GET_WORD(p);
+ p += sizeof(WORD) + offset;
+ if (!(hMenu = CreateMenu())) return 0;
+ if (!MENUEX_ParseResource( p, hMenu))
+ {
+ DestroyMenu( hMenu );
+ return 0;
+ }
+ return hMenu;
default:
ERR("version %d not supported.\n", version);
return 0;
@@ -4537,7 +4537,7 @@ HMENU WINAPI LoadMenuIndirectW( LPCVOID template )
/**********************************************************************
- * LoadMenuIndirectA (USER32.@)
+ * LoadMenuIndirectA (USER32.@)
*/
HMENU WINAPI LoadMenuIndirectA( LPCVOID template )
{
@@ -4546,7 +4546,7 @@ HMENU WINAPI LoadMenuIndirectA( LPCVOID template )
/**********************************************************************
- * IsMenu (USER32.@)
+ * IsMenu (USER32.@)
*/
BOOL WINAPI IsMenu(HMENU hmenu)
{
@@ -4561,11 +4561,11 @@ BOOL WINAPI IsMenu(HMENU hmenu)
}
/**********************************************************************
- * GetMenuItemInfo_common
+ * GetMenuItemInfo_common
*/
static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos,
- LPMENUITEMINFOW lpmii, BOOL unicode)
+ LPMENUITEMINFOW lpmii, BOOL unicode)
{
MENUITEM *menu = MENU_FindItem (&hmenu, &item, bypos ? MF_BYPOSITION : 0);
@@ -4583,17 +4583,17 @@ static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos,
SetLastError( ERROR_INVALID_PARAMETER);
return FALSE;
}
- lpmii->fType = menu->fType & MENUITEMINFO_TYPE_MASK;
+ lpmii->fType = menu->fType & MENUITEMINFO_TYPE_MASK;
if (menu->hbmpItem && !IS_MAGIC_BITMAP(menu->hbmpItem))
lpmii->fType |= MFT_BITMAP;
- lpmii->hbmpItem = menu->hbmpItem; /* not on Win9x/ME */
+ lpmii->hbmpItem = menu->hbmpItem; /* not on Win9x/ME */
if( lpmii->fType & MFT_BITMAP) {
- lpmii->dwTypeData = (LPWSTR) menu->hbmpItem;
- lpmii->cch = 0;
+ lpmii->dwTypeData = (LPWSTR) menu->hbmpItem;
+ lpmii->cch = 0;
} else if( lpmii->fType & (MFT_OWNERDRAW | MFT_SEPARATOR)) {
/* this does not happen on Win9x/ME */
- lpmii->dwTypeData = 0;
- lpmii->cch = 0;
+ lpmii->dwTypeData = 0;
+ lpmii->cch = 0;
}
}
@@ -4639,19 +4639,19 @@ static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos,
}
if (lpmii->fMask & MIIM_FTYPE)
- lpmii->fType = menu->fType & MENUITEMINFO_TYPE_MASK;
+ lpmii->fType = menu->fType & MENUITEMINFO_TYPE_MASK;
if (lpmii->fMask & MIIM_BITMAP)
- lpmii->hbmpItem = menu->hbmpItem;
+ lpmii->hbmpItem = menu->hbmpItem;
if (lpmii->fMask & MIIM_STATE)
- lpmii->fState = menu->fState & MENUITEMINFO_STATE_MASK;
+ lpmii->fState = menu->fState & MENUITEMINFO_STATE_MASK;
if (lpmii->fMask & MIIM_ID)
- lpmii->wID = menu->wID;
+ lpmii->wID = menu->wID;
if (lpmii->fMask & MIIM_SUBMENU)
- lpmii->hSubMenu = menu->hSubMenu;
+ lpmii->hSubMenu = menu->hSubMenu;
else {
/* hSubMenu is always cleared
* (not on Win9x/ME ) */
@@ -4659,17 +4659,17 @@ static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos,
}
if (lpmii->fMask & MIIM_CHECKMARKS) {
- lpmii->hbmpChecked = menu->hCheckBit;
- lpmii->hbmpUnchecked = menu->hUnCheckBit;
+ lpmii->hbmpChecked = menu->hCheckBit;
+ lpmii->hbmpUnchecked = menu->hUnCheckBit;
}
if (lpmii->fMask & MIIM_DATA)
- lpmii->dwItemData = menu->dwItemData;
+ lpmii->dwItemData = menu->dwItemData;
return TRUE;
}
/**********************************************************************
- * GetMenuItemInfoA (USER32.@)
+ * GetMenuItemInfoA (USER32.@)
*/
BOOL WINAPI GetMenuItemInfoA( HMENU hmenu, UINT item, BOOL bypos,
LPMENUITEMINFOA lpmii)
@@ -4691,7 +4691,7 @@ BOOL WINAPI GetMenuItemInfoA( HMENU hmenu, UINT item, BOOL bypos,
}
/**********************************************************************
- * GetMenuItemInfoW (USER32.@)
+ * GetMenuItemInfoW (USER32.@)
*/
BOOL WINAPI GetMenuItemInfoW( HMENU hmenu, UINT item, BOOL bypos,
LPMENUITEMINFOW lpmii)
@@ -4733,7 +4733,7 @@ static inline void set_menu_item_text( MENUITEM *menu, LPCWSTR text, BOOL unicod
/**********************************************************************
- * MENU_depth
+ * MENU_depth
*
* detect if there are loops in the menu tree (or the depth is too large)
*/
@@ -4761,15 +4761,15 @@ static int MENU_depth( POPUPMENU *pmenu, int depth)
/**********************************************************************
- * SetMenuItemInfo_common
+ * SetMenuItemInfo_common
*
* Note: does not support the MIIM_TYPE flag. Use the MIIM_FTYPE,
* MIIM_BITMAP and MIIM_STRING flags instead.
*/
static BOOL SetMenuItemInfo_common(MENUITEM * menu,
- const MENUITEMINFOW *lpmii,
- BOOL unicode)
+ const MENUITEMINFOW *lpmii,
+ BOOL unicode)
{
if (!menu) return FALSE;
@@ -4791,39 +4791,39 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
menu->fState = lpmii->fState & MENUITEMINFO_STATE_MASK;
if (lpmii->fMask & MIIM_ID)
- menu->wID = lpmii->wID;
+ menu->wID = lpmii->wID;
if (lpmii->fMask & MIIM_SUBMENU) {
- menu->hSubMenu = lpmii->hSubMenu;
- if (menu->hSubMenu) {
- POPUPMENU *subMenu = MENU_GetMenu(menu->hSubMenu);
- if (subMenu) {
+ menu->hSubMenu = lpmii->hSubMenu;
+ if (menu->hSubMenu) {
+ POPUPMENU *subMenu = MENU_GetMenu(menu->hSubMenu);
+ if (subMenu) {
if( MENU_depth( subMenu, 0) > MAXMENUDEPTH) {
ERR( "Loop detected in menu hierarchy or maximum menu depth exceeded!\n");
menu->hSubMenu = 0;
return FALSE;
}
- subMenu->wFlags |= MF_POPUP;
- menu->fType |= MF_POPUP;
- } else {
+ subMenu->wFlags |= MF_POPUP;
+ menu->fType |= MF_POPUP;
+ } else {
SetLastError( ERROR_INVALID_PARAMETER);
return FALSE;
}
- }
- else
- menu->fType &= ~MF_POPUP;
+ }
+ else
+ menu->fType &= ~MF_POPUP;
}
if (lpmii->fMask & MIIM_CHECKMARKS)
{
- menu->hCheckBit = lpmii->hbmpChecked;
- menu->hUnCheckBit = lpmii->hbmpUnchecked;
+ menu->hCheckBit = lpmii->hbmpChecked;
+ menu->hUnCheckBit = lpmii->hbmpUnchecked;
}
if (lpmii->fMask & MIIM_DATA)
- menu->dwItemData = lpmii->dwItemData;
+ menu->dwItemData = lpmii->dwItemData;
if (lpmii->fMask & MIIM_BITMAP)
- menu->hbmpItem = lpmii->hbmpItem;
+ menu->hbmpItem = lpmii->hbmpItem;
if( !menu->text && !(menu->fType & MFT_OWNERDRAW) && !menu->hbmpItem)
menu->fType |= MFT_SEPARATOR;
@@ -4833,7 +4833,7 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu,
}
/**********************************************************************
- * MENU_NormalizeMenuItemInfoStruct
+ * MENU_NormalizeMenuItemInfoStruct
*
* Helper for SetMenuItemInfo and InsertMenuItemInfo:
* check, copy and extend the MENUITEMINFO struct from the version that the application
@@ -4877,7 +4877,7 @@ static BOOL MENU_NormalizeMenuItemInfoStruct( const MENUITEMINFOW *pmii_in,
}
/**********************************************************************
- * SetMenuItemInfoA (USER32.@)
+ * SetMenuItemInfoA (USER32.@)
*/
BOOL WINAPI SetMenuItemInfoA(HMENU hmenu, UINT item, BOOL bypos,
const MENUITEMINFOA *lpmii)
@@ -4899,7 +4899,7 @@ BOOL WINAPI SetMenuItemInfoA(HMENU hmenu, UINT item, BOOL bypos,
}
/**********************************************************************
- * SetMenuItemInfoW (USER32.@)
+ * SetMenuItemInfoW (USER32.@)
*/
BOOL WINAPI SetMenuItemInfoW(HMENU hmenu, UINT item, BOOL bypos,
const MENUITEMINFOW *lpmii)
@@ -4920,98 +4920,98 @@ BOOL WINAPI SetMenuItemInfoW(HMENU hmenu, UINT item, BOOL bypos,
}
/**********************************************************************
- * SetMenuDefaultItem (USER32.@)
+ * SetMenuDefaultItem (USER32.@)
*
*/
BOOL WINAPI SetMenuDefaultItem(HMENU hmenu, UINT uItem, UINT bypos)
{
- UINT i;
- POPUPMENU *menu;
- MENUITEM *item;
-
- TRACE("(%p,%d,%d)\n", hmenu, uItem, bypos);
-
- if (!(menu = MENU_GetMenu(hmenu))) return FALSE;
-
- /* reset all default-item flags */
- item = menu->items;
- for (i = 0; i < menu->nItems; i++, item++)
- {
- item->fState &= ~MFS_DEFAULT;
- }
-
- /* no default item */
- if ( -1 == uItem)
- {
- return TRUE;
- }
-
- item = menu->items;
- if ( bypos )
- {
- if ( uItem >= menu->nItems ) return FALSE;
- item[uItem].fState |= MFS_DEFAULT;
- return TRUE;
- }
- else
- {
- for (i = 0; i < menu->nItems; i++, item++)
- {
- if (item->wID == uItem)
- {
- item->fState |= MFS_DEFAULT;
- return TRUE;
- }
- }
-
- }
- return FALSE;
+ UINT i;
+ POPUPMENU *menu;
+ MENUITEM *item;
+
+ TRACE("(%p,%d,%d)\n", hmenu, uItem, bypos);
+
+ if (!(menu = MENU_GetMenu(hmenu))) return FALSE;
+
+ /* reset all default-item flags */
+ item = menu->items;
+ for (i = 0; i < menu->nItems; i++, item++)
+ {
+ item->fState &= ~MFS_DEFAULT;
+ }
+
+ /* no default item */
+ if ( -1 == uItem)
+ {
+ return TRUE;
+ }
+
+ item = menu->items;
+ if ( bypos )
+ {
+ if ( uItem >= menu->nItems ) return FALSE;
+ item[uItem].fState |= MFS_DEFAULT;
+ return TRUE;
+ }
+ else
+ {
+ for (i = 0; i < menu->nItems; i++, item++)
+ {
+ if (item->wID == uItem)
+ {
+ item->fState |= MFS_DEFAULT;
+ return TRUE;
+ }
+ }
+
+ }
+ return FALSE;
}
/**********************************************************************
- * GetMenuDefaultItem (USER32.@)
+ * GetMenuDefaultItem (USER32.@)
*/
UINT WINAPI GetMenuDefaultItem(HMENU hmenu, UINT bypos, UINT flags)
{
- POPUPMENU *menu;
- MENUITEM * item;
- UINT i = 0;
+ POPUPMENU *menu;
+ MENUITEM * item;
+ UINT i = 0;
- TRACE("(%p,%d,%d)\n", hmenu, bypos, flags);
+ TRACE("(%p,%d,%d)\n", hmenu, bypos, flags);
- if (!(menu = MENU_GetMenu(hmenu))) return -1;
+ if (!(menu = MENU_GetMenu(hmenu))) return -1;
- /* find default item */
- item = menu->items;
+ /* find default item */
+ item = menu->items;
- /* empty menu */
- if (! item) return -1;
+ /* empty menu */
+ if (! item) return -1;
- while ( !( item->fState & MFS_DEFAULT ) )
- {
- i++; item++;
- if (i >= menu->nItems ) return -1;
- }
+ while ( !( item->fState & MFS_DEFAULT ) )
+ {
+ i++; item++;
+ if (i >= menu->nItems ) return -1;
+ }
- /* default: don't return disabled items */
- if ( (!(GMDI_USEDISABLED & flags)) && (item->fState & MFS_DISABLED )) return -1;
+ /* default: don't return disabled items */
+ if ( (!(GMDI_USEDISABLED & flags)) && (item->fState & MFS_DISABLED )) return -1;
- /* search rekursiv when needed */
- if ( (item->fType & MF_POPUP) && (flags & GMDI_GOINTOPOPUPS) )
- {
- UINT ret;
- ret = GetMenuDefaultItem( item->hSubMenu, bypos, flags );
- if ( -1 != ret ) return ret;
+ /* search rekursiv when needed */
+ if ( (item->fType & MF_POPUP) && (flags & GMDI_GOINTOPOPUPS) )
+ {
+ UINT ret;
+ ret = GetMenuDefaultItem( item->hSubMenu, bypos, flags );
+ if ( -1 != ret ) return ret;
- /* when item not found in submenu, return the popup item */
- }
- return ( bypos ) ? i : item->wID;
+ /* when item not found in submenu, return the popup item */
+ }
+ return ( bypos ) ? i : item->wID;
}
/**********************************************************************
- * InsertMenuItemA (USER32.@)
+ * InsertMenuItemA (USER32.@)
*/
BOOL WINAPI InsertMenuItemA(HMENU hMenu, UINT uItem, BOOL bypos,
const MENUITEMINFOA *lpmii)
@@ -5029,7 +5029,7 @@ BOOL WINAPI InsertMenuItemA(HMENU hMenu, UINT uItem, BOOL bypos,
/**********************************************************************
- * InsertMenuItemW (USER32.@)
+ * InsertMenuItemW (USER32.@)
*/
BOOL WINAPI InsertMenuItemW(HMENU hMenu, UINT uItem, BOOL bypos,
const MENUITEMINFOW *lpmii)
@@ -5046,12 +5046,12 @@ BOOL WINAPI InsertMenuItemW(HMENU hMenu, UINT uItem, BOOL bypos,
}
/**********************************************************************
- * CheckMenuRadioItem (USER32.@)
+ * CheckMenuRadioItem (USER32.@)
*/
BOOL WINAPI CheckMenuRadioItem(HMENU hMenu,
- UINT first, UINT last, UINT check,
- UINT bypos)
+ UINT first, UINT last, UINT check,
+ UINT bypos)
{
BOOL done = FALSE;
UINT i;
@@ -5098,7 +5098,7 @@ BOOL WINAPI CheckMenuRadioItem(HMENU hMenu,
/**********************************************************************
- * GetMenuItemRect (USER32.@)
+ * GetMenuItemRect (USER32.@)
*
* ATTENTION: Here, the returned values in rect are the screen
* coordinates of the item just like if the menu was
@@ -5106,7 +5106,7 @@ BOOL WINAPI CheckMenuRadioItem(HMENU hMenu,
*
*/
BOOL WINAPI GetMenuItemRect (HWND hwnd, HMENU hMenu, UINT uItem,
- LPRECT rect)
+ LPRECT rect)
{
POPUPMENU *itemMenu;
MENUITEM *item;
@@ -5119,17 +5119,17 @@ BOOL WINAPI GetMenuItemRect (HWND hwnd, HMENU hMenu, UINT uItem,
if(!hwnd)
{
- itemMenu = MENU_GetMenu(hMenu);
- if (itemMenu == NULL)
- return FALSE;
+ itemMenu = MENU_GetMenu(hMenu);
+ if (itemMenu == NULL)
+ return FALSE;
- if(itemMenu->hWnd == 0)
- return FALSE;
- referenceHwnd = itemMenu->hWnd;
+ if(itemMenu->hWnd == 0)
+ return FALSE;
+ referenceHwnd = itemMenu->hWnd;
}
if ((rect == NULL) || (item == NULL))
- return FALSE;
+ return FALSE;
*rect = item->rect;
@@ -5139,10 +5139,10 @@ BOOL WINAPI GetMenuItemRect (HWND hwnd, HMENU hMenu, UINT uItem,
}
/**********************************************************************
- * SetMenuInfo (USER32.@)
+ * SetMenuInfo (USER32.@)
*
* FIXME
- * actually use the items to draw the menu
+ * actually use the items to draw the menu
* (recalculate and/or redraw)
*/
static BOOL menu_SetMenuInfo( HMENU hMenu, LPCMENUINFO lpmi)
@@ -5179,11 +5179,11 @@ BOOL WINAPI SetMenuInfo (HMENU hMenu, LPCMENUINFO lpmi)
{
TRACE("(%p %p)\n", hMenu, lpmi);
if( lpmi && (lpmi->cbSize == sizeof( MENUINFO)) && (menu_SetMenuInfo( hMenu, lpmi))) {
- if( lpmi->fMask & MIM_STYLE) {
- if (lpmi->dwStyle & MNS_AUTODISMISS) FIXME("MNS_AUTODISMISS unimplemented\n");
- if (lpmi->dwStyle & MNS_DRAGDROP) FIXME("MNS_DRAGDROP unimplemented\n");
- if (lpmi->dwStyle & MNS_MODELESS) FIXME("MNS_MODELESS unimplemented\n");
- }
+ if( lpmi->fMask & MIM_STYLE) {
+ if (lpmi->dwStyle & MNS_AUTODISMISS) FIXME("MNS_AUTODISMISS unimplemented\n");
+ if (lpmi->dwStyle & MNS_DRAGDROP) FIXME("MNS_DRAGDROP unimplemented\n");
+ if (lpmi->dwStyle & MNS_MODELESS) FIXME("MNS_MODELESS unimplemented\n");
+ }
return TRUE;
}
SetLastError( ERROR_INVALID_PARAMETER);
@@ -5191,10 +5191,10 @@ BOOL WINAPI SetMenuInfo (HMENU hMenu, LPCMENUINFO lpmi)
}
/**********************************************************************
- * GetMenuInfo (USER32.@)
+ * GetMenuInfo (USER32.@)
*
* NOTES
- * win98/NT5.0
+ * win98/NT5.0
*
*/
BOOL WINAPI GetMenuInfo (HMENU hMenu, LPMENUINFO lpmi)
@@ -5205,22 +5205,22 @@ BOOL WINAPI GetMenuInfo (HMENU hMenu, LPMENUINFO lpmi)
if (lpmi && (lpmi->cbSize == sizeof( MENUINFO)) && (menu = MENU_GetMenu(hMenu)))
{
- if (lpmi->fMask & MIM_BACKGROUND)
- lpmi->hbrBack = menu->hbrBack;
+ if (lpmi->fMask & MIM_BACKGROUND)
+ lpmi->hbrBack = menu->hbrBack;
- if (lpmi->fMask & MIM_HELPID)
- lpmi->dwContextHelpID = menu->dwContextHelpID;
+ if (lpmi->fMask & MIM_HELPID)
+ lpmi->dwContextHelpID = menu->dwContextHelpID;
- if (lpmi->fMask & MIM_MAXHEIGHT)
- lpmi->cyMax = menu->cyMax;
+ if (lpmi->fMask & MIM_MAXHEIGHT)
+ lpmi->cyMax = menu->cyMax;
- if (lpmi->fMask & MIM_MENUDATA)
- lpmi->dwMenuData = menu->dwMenuData;
+ if (lpmi->fMask & MIM_MENUDATA)
+ lpmi->dwMenuData = menu->dwMenuData;
- if (lpmi->fMask & MIM_STYLE)
- lpmi->dwStyle = menu->dwStyle;
+ if (lpmi->fMask & MIM_STYLE)
+ lpmi->dwStyle = menu->dwStyle;
- return TRUE;
+ return TRUE;
}
SetLastError( ERROR_INVALID_PARAMETER);
return FALSE;
@@ -5238,8 +5238,8 @@ BOOL WINAPI SetMenuContextHelpId( HMENU hMenu, DWORD dwContextHelpID)
if ((menu = MENU_GetMenu(hMenu)))
{
- menu->dwContextHelpID = dwContextHelpID;
- return TRUE;
+ menu->dwContextHelpID = dwContextHelpID;
+ return TRUE;
}
return FALSE;
}
@@ -5256,7 +5256,7 @@ DWORD WINAPI GetMenuContextHelpId( HMENU hMenu )
if ((menu = MENU_GetMenu(hMenu)))
{
- return menu->dwContextHelpID;
+ return menu->dwContextHelpID;
}
return 0;
}
--
2.11.0
More information about the wine-patches
mailing list