[PATCH 4/6] explorerframe: Handle changing the selection.
David Hedberg
david.hedberg at gmail.com
Mon Aug 16 02:17:33 CDT 2010
---
dlls/explorerframe/nstc.c | 28 ++++++++++++++++++++++++++++
dlls/explorerframe/tests/nstc.c | 9 ++++++++-
2 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/dlls/explorerframe/nstc.c b/dlls/explorerframe/nstc.c
index e595260..d478d99 100644
--- a/dlls/explorerframe/nstc.c
+++ b/dlls/explorerframe/nstc.c
@@ -138,6 +138,13 @@ static HRESULT events_OnAfterExpand(NSTC2Impl *This, IShellItem *psi)
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
*/
@@ -508,6 +515,26 @@ static LRESULT on_tvn_itemexpandedw(NSTC2Impl *This, LPARAM lParam)
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,
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_ITEMEXPANDINGW: return on_tvn_itemexpandingw(This, lParam);
case TVN_ITEMEXPANDEDW: return on_tvn_itemexpandedw(This, lParam);
+ case TVN_SELCHANGEDW: return on_tvn_selchangedw(This, lParam);
default: break;
}
break;
diff --git a/dlls/explorerframe/tests/nstc.c b/dlls/explorerframe/tests/nstc.c
index a2e5773..e63784f 100644
--- a/dlls/explorerframe/tests/nstc.c
+++ b/dlls/explorerframe/tests/nstc.c
@@ -1251,7 +1251,7 @@ static void test_events(void)
ok(hwnd_tv != NULL, "Failed to get hwnd_tv HWND.\n");
if(hwnd_tv)
{
- HTREEITEM hroot;
+ HTREEITEM hroot, hitem;
/* Test On*Expand */
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);
process_msgs();
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
skip("Skipping some tests.\n");
--
1.7.2
More information about the wine-patches
mailing list