explorerframe: Implement GetNextItem.

This commit is contained in:
David Hedberg 2010-08-18 07:08:14 +02:00 committed by Alexandre Julliard
parent 31f538516a
commit 29bf096f27
2 changed files with 91 additions and 2 deletions

View File

@ -1256,8 +1256,43 @@ static HRESULT WINAPI NSTC2_fnGetNextItem(INameSpaceTreeControl2* iface,
IShellItem **ppsiNext)
{
NSTC2Impl *This = (NSTC2Impl*)iface;
FIXME("stub, %p (%p, %x, %p)\n", This, psi, nstcgi, ppsiNext);
return E_NOTIMPL;
HTREEITEM hitem, hnext;
UINT tvgn;
TRACE("%p (%p, %x, %p)\n", This, psi, nstcgi, ppsiNext);
if(!ppsiNext) return E_POINTER;
if(!psi) return E_FAIL;
*ppsiNext = NULL;
hitem = treeitem_from_shellitem(This, psi);
if(!hitem)
return E_INVALIDARG;
switch(nstcgi)
{
case NSTCGNI_NEXT: tvgn = TVGN_NEXT; break;
case NSTCGNI_NEXTVISIBLE: tvgn = TVGN_NEXTVISIBLE; break;
case NSTCGNI_PREV: tvgn = TVGN_PREVIOUS; break;
case NSTCGNI_PREVVISIBLE: tvgn = TVGN_PREVIOUSVISIBLE; break;
case NSTCGNI_PARENT: tvgn = TVGN_PARENT; break;
case NSTCGNI_CHILD: tvgn = TVGN_CHILD; break;
case NSTCGNI_FIRSTVISIBLE: tvgn = TVGN_FIRSTVISIBLE; break;
case NSTCGNI_LASTVISIBLE: tvgn = TVGN_LASTVISIBLE; break;
default:
FIXME("Unknown nstcgi value %d\n", nstcgi);
return E_FAIL;
}
hnext = (HTREEITEM)SendMessageW(This->hwnd_tv, TVM_GETNEXTITEM, tvgn, (WPARAM)hitem);
if(hnext)
{
*ppsiNext = shellitem_from_treeitem(This, hnext);
IShellItem_AddRef(*ppsiNext);
return S_OK;
}
return E_FAIL;
}
static HRESULT WINAPI NSTC2_fnHitTest(INameSpaceTreeControl2* iface,

View File

@ -1329,6 +1329,7 @@ static void test_events(void)
IOleWindow *pow;
LPITEMIDLIST pidl_desktop;
NSTCITEMSTATE itemstate;
IShellItem *psi;
DWORD cookie1, cookie2;
HWND hwnd_tv;
HRESULT hr;
@ -1797,6 +1798,59 @@ static void test_events(void)
ok_event_count(pnstceimpl, OnItemDeleted, 1);
ok_no_events(pnstceimpl);
/* GetNextItem */
hr = INameSpaceTreeControl_GetNextItem(pnstc, NULL, 0, NULL);
ok(hr == E_POINTER, "Got (0x%08x)\n", hr);
ok_no_events(pnstceimpl);
hr = INameSpaceTreeControl_GetNextItem(pnstc, psidesktop, 0, NULL);
ok(hr == E_POINTER, "Got (0x%08x)\n", hr);
ok_no_events(pnstceimpl);
hr = INameSpaceTreeControl_GetNextItem(pnstc, NULL, 0, &psi);
ok(hr == E_FAIL, "Got (0x%08x)\n", hr);
ok_no_events(pnstceimpl);
hr = INameSpaceTreeControl_GetNextItem(pnstc, psidesktop, 0, &psi);
ok(hr == E_INVALIDARG, "Got (0x%08x)\n", hr);
ok_no_events(pnstceimpl);
hr = INameSpaceTreeControl_AppendRoot(pnstc, psidesktop, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, 0, NULL);
ok(hr == S_OK, "Got (0x%08x)\n", hr);
process_msgs();
ok_event_count_broken(pnstceimpl, OnItemAdded, 1, 0 /* Vista */);
ok_no_events(pnstceimpl);
/* Get child from unexpanded and unfilled parent */
psi = (void*)0xDEADBEEF;
hr = INameSpaceTreeControl_GetNextItem(pnstc, psidesktop, NSTCGNI_CHILD, &psi);
ok(hr == E_FAIL, "Got (0x%08x)\n", hr);
ok(psi == NULL, "psi is %p\n", psi);
process_msgs();
ok_no_events(pnstceimpl);
/* Expand and try again */
hr = INameSpaceTreeControl_SetItemState(pnstc, psidesktop, NSTCIS_EXPANDED, 0xffff);
ok(hr == S_OK, "Got (0x%08x)\n", hr);
process_msgs();
ok_event_count(pnstceimpl, OnBeforeExpand, 1);
ok_event_broken(pnstceimpl, OnItemAdded); /* Does not fire on Vista */
ok_event_count(pnstceimpl, OnAfterExpand, 1);
todo_wine ok_event_count_broken(pnstceimpl, OnSelectionChanged, 1, 0 /*Vista */);
ok_no_events(pnstceimpl);
psi = (void*)0xDEADBEEF;
hr = INameSpaceTreeControl_GetNextItem(pnstc, psidesktop, NSTCGNI_CHILD, &psi);
ok(hr == S_OK, "Got (0x%08x)\n", hr);
ok((psi != NULL) && (psi != (void*)0xDEADBEEF), "psi is %p\n", psi);
process_msgs();
ok_no_events(pnstceimpl);
if(SUCCEEDED(hr)) IShellItem_Release(psi);
hr = INameSpaceTreeControl_RemoveAllRoots(pnstc);
ok(hr == S_OK, "Got (0x%08x)\n", hr);
ok_event_count(pnstceimpl, OnItemDeleted, 1);
ok_no_events(pnstceimpl);
hr = INameSpaceTreeControl_QueryInterface(pnstc, &IID_IOleWindow, (void**)&pow);
ok(hr == S_OK, "Got 0x%08x\n", hr);
if(SUCCEEDED(hr))