Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
RatinCN committed Jan 2, 2025
1 parent 0ba2854 commit 1194c3c
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Source/KNSoft.MakeLifeEasier/UI/Control/TreeView.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@

EXTERN_C_START

FORCEINLINE
_Success_(return != NULL)
HTREEITEM
_Ret_maybenull_
UI_TreeViewLocateItem(
_In_ HWND TreeView,
_In_ LONG X,
_In_ LONG Y,
_Out_opt_ PUINT Flags)
{
TVHITTESTINFO tvhti;
HTREEITEM Item;

tvhti.pt.x = X;
tvhti.pt.y = Y;
Item = (HTREEITEM)SendMessageW(TreeView, TVM_HITTEST, 0, (LPARAM)&tvhti);
if (Item != NULL && Flags != NULL)
{
*Flags = tvhti.flags;
}
return Item;
}

FORCEINLINE
_Success_(return != FALSE)
LOGICAL
UI_TreeViewGetItemParam(
_In_ HWND TreeView,
_In_ HTREEITEM Item,
_Out_ LPARAM* Param)
{
TVITEMW tvi;

tvi.mask = TVIF_PARAM;
tvi.hItem = Item;

if (SendMessageW(TreeView, TVM_GETITEMW, 0, (LPARAM)&tvi))
{
*Param = tvi.lParam;
return TRUE;
}
return FALSE;
}

// Return FALSE to stop enumeration, UI_EnumTreeViewItems will returns S_FALSE
typedef
_Function_class_(UI_TREEVIEW_ENUMITEM_FN)
Expand Down

0 comments on commit 1194c3c

Please sign in to comment.