LRESULT MmHeapOnTreeListSort( IN HWND hWnd, IN UINT uMsg, IN WPARAM wp, IN LPARAM lp ) { ULONG Column; TVSORTCB Tsc = {0}; PTREELIST_OBJECT TreeList; PDIALOG_OBJECT Object; HTREEITEM hItemGroup; TVITEM tvi = {0}; PMM_FORM_CONTEXT Context; MM_SORT_CONTEXT SortContext; Column = (ULONG)wp; Object = (PDIALOG_OBJECT)SdkGetObject(hWnd); Context = SdkGetContext(Object, MM_FORM_CONTEXT); TreeList = Context->TreeList; // // Sort dll items // SortContext.Context = (LPARAM)NULL; SortContext.Column = Column; SortContext.Order = TreeList->SortOrder; Tsc.hParent = TVI_ROOT; Tsc.lParam = (LPARAM)&SortContext; Tsc.lpfnCompare = MmHeapCompareCallback; TreeView_SortChildrenCB(TreeList->hWndTree, &Tsc, 0); hItemGroup = TreeView_GetChild(TreeList->hWndTree, TVI_ROOT); while (hItemGroup != NULL) { tvi.mask = TVIF_PARAM; tvi.hItem = hItemGroup; TreeView_GetItem(TreeList->hWndTree, &tvi); // // Sort back trace item // SortContext.Context = tvi.lParam; SortContext.Column = Column; SortContext.Order = TreeList->SortOrder; Tsc.hParent = hItemGroup; Tsc.lParam = (LPARAM)&SortContext; Tsc.lpfnCompare = MmHeapCompareCallback; TreeView_SortChildrenCB(TreeList->hWndTree, &Tsc, 0); hItemGroup = TreeView_GetNextSibling(TreeList->hWndTree, hItemGroup); } return 0; }
LRESULT FullStackOnTreeListSort( __in HWND hWnd, __in UINT uMsg, __in WPARAM wp, __in LPARAM lp ) { PDIALOG_OBJECT Object; PFULLSTACK_CONTEXT Context; PTREELIST_OBJECT TreeList; TVSORTCB Tsc = {0}; CPU_SORT_CONTEXT SortContext; TVITEM tvi = {0}; Object = (PDIALOG_OBJECT)SdkGetObject(hWnd); Context = SdkGetContext(Object, FULLSTACK_CONTEXT); TreeList = Context->Base.TreeList; ASSERT(TreeList != NULL); SortContext.Column = wp; SortContext.Context = (LPARAM)NULL; SortContext.Order = TreeList->SortOrder; Tsc.hParent = TVI_ROOT; Tsc.lParam = (LPARAM)&SortContext; Tsc.lpfnCompare = FullStackCompareCallback; TreeView_SortChildrenCB(TreeList->hWndTree, &Tsc, 0); return 0; }
void CCList::SortContacts() { TVSORTCB tvSort = {}; tvSort.lpfnCompare = CompareItemsCallback; tvSort.hParent = TVI_ROOT; tvSort.lParam = (LPARAM)this; while (tvSort.hParent) { TreeView_SortChildrenCB(hTreeView, &tvSort, 0); tvSort.hParent = GetNextItem(MCLGN_NEXT | MCLGN_GROUP | MCLGN_MULTILEVEL, tvSort.hParent); } }
void TffdshowPageDec::sortOrder(void) { if (!htiPresets) { return; } TVSORTCB tvs; tvs.hParent = htiPresets; tvs.lpfnCompare = orderCompareFunc; tvs.lParam = 0; TreeView_SortChildrenCB(htv, &tvs, 0); }
void mxTreeView::sortTree( mxTreeViewItem *parent, bool recurse, void *func, int parameter ) { if (!d_this) return; TVSORTCB cb; memset( &cb, 0, sizeof( cb ) ); cb.hParent = (HTREEITEM)parent; cb.lParam = parameter; cb.lpfnCompare = (int (__stdcall *)(long,long,long)) func; TreeView_SortChildrenCB( d_this->d_hwnd, &cb, recurse ); }
LRESULT CounterOnTreeListSort( IN HWND hWnd, IN UINT uMsg, IN WPARAM wp, IN LPARAM lp ) { ULONG Column; TVSORTCB Tsc = {0}; PTREELIST_OBJECT TreeList; PDIALOG_OBJECT Object; PCOUNTER_CONTEXT Context; HTREEITEM hItemGroup; HTREEITEM hItemRoot; TVITEM tvi = {0}; COUNTER_SORT_CONTEXT SortContext; Column = (ULONG)wp; Object = (PDIALOG_OBJECT)SdkGetObject(hWnd); Context = SdkGetContext(Object, COUNTER_CONTEXT); TreeList = Context->TreeList; hItemRoot = TreeView_GetRoot(TreeList->hWndTree); hItemGroup = TreeView_GetChild(TreeList->hWndTree, hItemRoot); while (hItemGroup != NULL) { tvi.mask = TVIF_PARAM; tvi.hItem = hItemGroup; TreeView_GetItem(TreeList->hWndTree, &tvi); SortContext.Group = (PMSP_COUNTER_GROUP)tvi.lParam; SortContext.Column = Column; SortContext.Order = TreeList->SortOrder; Tsc.hParent = hItemGroup; Tsc.lParam = (LPARAM)&SortContext; Tsc.lpfnCompare = CounterCompareCallback; TreeView_SortChildrenCB(TreeList->hWndTree, &Tsc, 0); hItemGroup = TreeView_GetNextSibling(TreeList->hWndTree, hItemGroup); } return 0; }
void wxTreeCtrl::SortChildren(const wxTreeItemId& item) { wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); // rely on the fact that TreeView_SortChildren does the same thing as our // default behaviour, i.e. sorts items alphabetically and so call it // directly if we're not in derived class (much more efficient!) if ( GetClassInfo() == CLASSINFO(wxTreeCtrl) ) { TreeView_SortChildren(GetHwnd(), HITEM(item), 0); } else { TV_SORTCB tvSort; tvSort.hParent = HITEM(item); tvSort.lpfnCompare = wxTreeSortHelper::Compare; tvSort.lParam = (LPARAM)this; TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */); } }
BOOL cb_walk_dir_explorer(char *name, uint32_t flags, uint64_t len, int64_t lastWriteTime, uint32_t* ctx) { int iimg = select_iimage_according_fname(name, flags); HTREEITEM htvi; TVSORTCB tvscb; tv_walk_dir_param_t* wdp = (tv_walk_dir_param_t*)ctx; htvi = TreeView_AddLeaf(wdp->hctl, wdp->htvi); TreeView_SetItem1(wdp->hctl, htvi, TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_CHILDREN, (LPARAM)htvi, iimg, iimg, 0, name); tvscb.hParent = wdp->htvi; tvscb.lpfnCompare = fn_tvi_compare_sort; tvscb.lParam = (LPARAM)wdp->hctl; TreeView_SortChildrenCB(wdp->hctl, &tvscb, 0); if (flags & FILE_ATTRIBUTE_DIRECTORY ) { tv_walk_dir_param_t wdp2; sprintf(wdp2.curdir, "%s\\%s", wdp->curdir, name); if (wdp->maxdeep > wdp->deep) { tv_walk_dir_param_t wdp2; wdp2.hctl = wdp->hctl; wdp2.htvi = htvi; wdp2.maxdeep = wdp->maxdeep; wdp2.deep = wdp->deep + 1; walk_dir_win32_deepen(wdp2.curdir, 0, cb_walk_dir_explorer, (uint32_t *)&wdp2); } else if (!is_empty_dir(wdp2.curdir)) { // 枚举到此为止,但因为是目录,强制让出来前面+符号 TreeView_SetItem1(wdp->hctl, htvi, TVIF_CHILDREN, 0, 0, 0, 1, NULL); } } return TRUE; }