explorerframe: Handle changing the selection.
This commit is contained in:
parent
4ad1050eb5
commit
f0d6d95ef8
|
@ -138,6 +138,13 @@ static HRESULT events_OnAfterExpand(NSTC2Impl *This, IShellItem *psi)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT events_OnSelectionChanged(NSTC2Impl *This, IShellItemArray *psia)
|
||||||
|
{
|
||||||
|
if(!This->pnstce) return S_OK;
|
||||||
|
|
||||||
|
return INameSpaceTreeControlEvents_OnSelectionChanged(This->pnstce, psia);
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* NamespaceTree helper functions
|
* NamespaceTree helper functions
|
||||||
*/
|
*/
|
||||||
|
@ -508,6 +515,26 @@ static LRESULT on_tvn_itemexpandedw(NSTC2Impl *This, LPARAM lParam)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LRESULT on_tvn_selchangedw(NSTC2Impl *This, LPARAM lParam)
|
||||||
|
{
|
||||||
|
NMTREEVIEWW *nmtv = (NMTREEVIEWW*)lParam;
|
||||||
|
IShellItemArray *psia;
|
||||||
|
IShellItem *psi;
|
||||||
|
HRESULT hr;
|
||||||
|
TRACE("%p\n", This);
|
||||||
|
|
||||||
|
/* Note: Only supports one selected item. */
|
||||||
|
psi = shellitem_from_treeitem(This, nmtv->itemNew.hItem);
|
||||||
|
hr = SHCreateShellItemArrayFromShellItem(psi, &IID_IShellItemArray, (void**)&psia);
|
||||||
|
if(SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
events_OnSelectionChanged(This, psia);
|
||||||
|
IShellItemArray_Release(psia);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK NSTC2_WndProc(HWND hWnd, UINT uMessage,
|
static LRESULT CALLBACK NSTC2_WndProc(HWND hWnd, UINT uMessage,
|
||||||
WPARAM wParam, LPARAM lParam)
|
WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -527,6 +554,7 @@ static LRESULT CALLBACK NSTC2_WndProc(HWND hWnd, UINT uMessage,
|
||||||
case TVN_GETDISPINFOW: return on_tvn_getdispinfow(This, lParam);
|
case TVN_GETDISPINFOW: return on_tvn_getdispinfow(This, lParam);
|
||||||
case TVN_ITEMEXPANDINGW: return on_tvn_itemexpandingw(This, lParam);
|
case TVN_ITEMEXPANDINGW: return on_tvn_itemexpandingw(This, lParam);
|
||||||
case TVN_ITEMEXPANDEDW: return on_tvn_itemexpandedw(This, lParam);
|
case TVN_ITEMEXPANDEDW: return on_tvn_itemexpandedw(This, lParam);
|
||||||
|
case TVN_SELCHANGEDW: return on_tvn_selchangedw(This, lParam);
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ static void test_events(void)
|
||||||
ok(hwnd_tv != NULL, "Failed to get hwnd_tv HWND.\n");
|
ok(hwnd_tv != NULL, "Failed to get hwnd_tv HWND.\n");
|
||||||
if(hwnd_tv)
|
if(hwnd_tv)
|
||||||
{
|
{
|
||||||
HTREEITEM hroot;
|
HTREEITEM hroot, hitem;
|
||||||
|
|
||||||
/* Test On*Expand */
|
/* Test On*Expand */
|
||||||
hroot = (HTREEITEM)SendMessageW(hwnd_tv, TVM_GETNEXTITEM, TVGN_ROOT, 0);
|
hroot = (HTREEITEM)SendMessageW(hwnd_tv, TVM_GETNEXTITEM, TVGN_ROOT, 0);
|
||||||
|
@ -1268,6 +1268,13 @@ static void test_events(void)
|
||||||
SendMessage(hwnd_tv, TVM_EXPAND, TVE_EXPAND, (LPARAM)hroot);
|
SendMessage(hwnd_tv, TVM_EXPAND, TVE_EXPAND, (LPARAM)hroot);
|
||||||
process_msgs();
|
process_msgs();
|
||||||
ok_no_events(pnstceimpl);
|
ok_no_events(pnstceimpl);
|
||||||
|
|
||||||
|
/* Test OnSelectionChanged */
|
||||||
|
hitem = (HTREEITEM)SendMessageW(hwnd_tv, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hroot);
|
||||||
|
SendMessageW(hwnd_tv, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hitem);
|
||||||
|
process_msgs();
|
||||||
|
ok_event_count(pnstceimpl, OnSelectionChanged, 1);
|
||||||
|
ok_no_events(pnstceimpl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
skip("Skipping some tests.\n");
|
skip("Skipping some tests.\n");
|
||||||
|
|
Loading…
Reference in New Issue