//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods internal static ProxySimple ElementProviderFromPoint(IntPtr hwnd, ProxyFragment parent, int item, int x, int y) { NativeMethods.LVHITTESTINFO_INTERNAL hitTest = WindowsListView.SubitemHitTest(hwnd, item, new NativeMethods.Win32Point(x, y)); if (hitTest.iSubItem >= 0) { return(new ListViewSubItem(hwnd, parent, hitTest.iSubItem, item)); } // subitems do not exist return(parent); }
// Returns a Proxy element corresponding to the specified screen coordinates. internal override ProxySimple ElementProviderFromPoint(int x, int y) { NativeMethods.Win32Point pt = new NativeMethods.Win32Point(x, y); NativeMethods.LVHITTESTINFO_INTERNAL hitTest = WindowsListView.SubitemHitTest(_hwnd, pt); if ((hitTest.flags & NativeMethods.LVHT_EX_GROUP_HEADER) != 0) { return(this); } if ((hitTest.flags & NativeMethods.LVHT_ONITEM) != 0 && hitTest.iItem >= 0) { // create the item return(new ListViewItem(_hwnd, this, hitTest.iItem)); } // If we did not land on an item we may be at a subset link these only exist // in v6 comctrl and vista or later. if (_isComctrlV6OnOsVerV6orHigher) { // Allocate a local LVHITTESTINFO struct. NativeMethods.LVHITTESTINFO_V6 hitTestNative = new NativeMethods.LVHITTESTINFO_V6(hitTest); unsafe { XSendMessage.XSendGetIndex(_hwnd, NativeMethods.LVM_HITTEST, new IntPtr(-1), new IntPtr(&hitTestNative), Marshal.SizeOf(hitTestNative.GetType())); } if ((hitTestNative.flags & NativeMethods.LVHT_EX_GROUP_SUBSETLINK) != 0) { GroupManager.GroupInfo groupInfo = GetGroupInfo(_hwnd, ID); int [] items = groupInfo._items; if (groupInfo._count <= 0 || groupInfo._count > items.Length) { return(null); } int index = items [groupInfo._count - 1]; return(CreateGroupSubsetLink(index + 1)); } } return(this); }