* I was telling AddButton that all the items were the last, except the last. Now the submenus display properly. Some of them at least. Others get an exception, it seems.
CORE-7881

svn path=/branches/shell-experiments/; revision=62416
This commit is contained in:
David Quintana 2014-03-03 17:55:43 +00:00
parent d21bce9206
commit d1e5c6a2b9

View file

@ -791,6 +791,7 @@ HRESULT CMenuStaticToolbar::FillToolbar()
int i; int i;
int ic = GetMenuItemCount(m_hmenu); int ic = GetMenuItemCount(m_hmenu);
int count = 0;
for (i = 0; i < ic; i++) for (i = 0; i < ic; i++)
{ {
BOOL last = i + 1 == ic; BOOL last = i + 1 == ic;
@ -807,6 +808,8 @@ HRESULT CMenuStaticToolbar::FillToolbar()
continue; continue;
} }
count++;
DbgPrint("Found item with fType=%x, cmdId=%d\n", info.fType, info.wID); DbgPrint("Found item with fType=%x, cmdId=%d\n", info.fType, info.wID);
if (info.fType & MFT_SEPARATOR) if (info.fType & MFT_SEPARATOR)
@ -836,6 +839,8 @@ HRESULT CMenuStaticToolbar::FillToolbar()
} }
} }
DbgPrint("Created toolbar with %d buttons.\n", count);
return S_OK; return S_OK;
} }
@ -937,7 +942,7 @@ HRESULT CMenuSFToolbar::FillToolbar()
// Fetch next item already, so we know if the current one is the last // Fetch next item already, so we know if the current one is the last
hr = eidl->Next(1, &item, &fetched); hr = eidl->Next(1, &item, &fetched);
AddButton(++i, MenuString, attrs & SFGAO_FOLDER, index, dwData, SUCCEEDED(hr) && fetched > 0); AddButton(++i, MenuString, attrs & SFGAO_FOLDER, index, dwData, FAILED(hr) || fetched == 0);
CoTaskMemFree(MenuString); CoTaskMemFree(MenuString);
} }
@ -946,9 +951,13 @@ HRESULT CMenuSFToolbar::FillToolbar()
// If no items were added, show the "empty" placeholder // If no items were added, show the "empty" placeholder
if (i == 0) if (i == 0)
{ {
DbgPrint("The toolbar is empty, adding placeholder.\n");
return AddPlaceholder(); return AddPlaceholder();
} }
DbgPrint("Created toolbar with %d buttons.\n", i);
return hr; return hr;
} }