当前位置: 首页>>代码示例>>C++>>正文


C++ TreeView_GetRoot函数代码示例

本文整理汇总了C++中TreeView_GetRoot函数的典型用法代码示例。如果您正苦于以下问题:C++ TreeView_GetRoot函数的具体用法?C++ TreeView_GetRoot怎么用?C++ TreeView_GetRoot使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TreeView_GetRoot函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WndProcTocTree

static LRESULT CALLBACK WndProcTocTree(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    WindowInfo *win = FindWindowInfoByHwnd(hwnd);
    if (!win)
        return CallWindowProc(DefWndProcTocTree, hwnd, message, wParam, lParam);

    switch (message) {
        case WM_ERASEBKGND:
            return FALSE;
        case WM_CHAR:
            if (VK_ESCAPE == wParam && gGlobalPrefs->escToExit && MayCloseWindow(win))
                CloseWindow(win, true);
            break;
        case WM_KEYDOWN:
            // consistently expand/collapse whole (sub)trees
            if (VK_MULTIPLY == wParam && IsShiftPressed())
                TreeView_ExpandRecursively(hwnd, TreeView_GetRoot(hwnd), TVE_EXPAND);
            else if (VK_MULTIPLY == wParam)
                TreeView_ExpandRecursively(hwnd, TreeView_GetSelection(hwnd), TVE_EXPAND, true);
            else if (VK_DIVIDE == wParam && IsShiftPressed()) {
                HTREEITEM root = TreeView_GetRoot(hwnd);
                if (!TreeView_GetNextSibling(hwnd, root))
                    root = TreeView_GetChild(hwnd, root);
                TreeView_ExpandRecursively(hwnd, root, TVE_COLLAPSE);
            }
            else if (VK_DIVIDE == wParam)
                TreeView_ExpandRecursively(hwnd, TreeView_GetSelection(hwnd), TVE_COLLAPSE, true);
            else
                break;
            TreeView_EnsureVisible(hwnd, TreeView_GetSelection(hwnd));
            return 0;
        case WM_MOUSEWHEEL:
        case WM_MOUSEHWHEEL:
            // scroll the canvas if the cursor isn't over the ToC tree
            if (!IsCursorOverWindow(win->hwndTocTree))
                return SendMessage(win->hwndCanvas, message, wParam, lParam);
            break;
#ifdef DISPLAY_TOC_PAGE_NUMBERS
        case WM_SIZE:
        case WM_HSCROLL:
            // Repaint the ToC so that RelayoutTocItem is called for all items
            PostMessage(hwnd, WM_APP_REPAINT_TOC, 0, 0);
            break;
        case WM_APP_REPAINT_TOC:
            InvalidateRect(hwnd, nullptr, TRUE);
            UpdateWindow(hwnd);
            break;
#endif
    }
    return CallWindowProc(DefWndProcTocTree, hwnd, message, wParam, lParam);
}
开发者ID:Andy-Amoy,项目名称:sumatrapdf,代码行数:51,代码来源:TableOfContents.cpp

示例2: TreeView_ExpandAll

	// TreeView 全開・全閉
	void TreeView_ExpandAll(HWND hwndTree, bool bExpand, int nMaxDepth)
	{
		HTREEITEM	htiCur;
		HTREEITEM	htiItem;
		HTREEITEM	htiNext;

		::SendMessageAny(hwndTree, WM_SETREDRAW, (WPARAM)FALSE, 0);

		htiCur = htiItem = TreeView_GetSelection( hwndTree );
		if (!bExpand && htiCur != NULL) {
			// 閉じる時はトップに変更
			for (htiNext = htiCur; htiNext !=  NULL; ) {
				htiItem = htiNext;
				htiNext = TreeView_GetParent( hwndTree, htiItem );
			}
			if (htiCur != htiItem) {
				htiCur = htiItem;
				TreeView_SelectItem( hwndTree, htiCur );
			}
		}

		std::vector<HTREEITEM> tree;
		HTREEITEM item = TreeView_GetRoot(hwndTree);
		while( 0 < tree.size() || item != NULL ){
			while(item != NULL && (int)tree.size() < nMaxDepth ){
				// 先に展開してからGetChildしないと、ファイルツリーのサブアイテムが展開されない
				TreeView_Expand(hwndTree, item, bExpand ? TVE_EXPAND : TVE_COLLAPSE);
				tree.push_back(item);
				item = TreeView_GetChild(hwndTree, item);
			}
			item = tree.back();
			tree.pop_back();
			item = TreeView_GetNextSibling(hwndTree, item);
		}

		// 選択位置を戻す
		if (htiCur == NULL) {
			if (bExpand ) {
				htiItem = TreeView_GetRoot( hwndTree );
				TreeView_SelectSetFirstVisible( hwndTree, htiItem );
			}
			TreeView_SelectItem( hwndTree, NULL );
		}
		else {
			TreeView_SelectSetFirstVisible( hwndTree, htiCur );
		}

		::SendMessageAny(hwndTree, WM_SETREDRAW, (WPARAM)TRUE, 0);
	}
开发者ID:beru,项目名称:sakura,代码行数:50,代码来源:StdControl.cpp

示例3: TreeView_GetRoot

/**
 *\fn           HTREEITEM createItem(const char *path)
 *\brief        创建并得到树节点
 *\param[in]    const char * path 路径
 *\return       HTREEITEM 0成功,其它失败
 */
HTREEITEM CBrowseWnd::createItem(const char *path)
{
    VECTOR_STR vectorStr;
    CStrConver::TokenizeData(path, "/", vectorStr);

    HTREEITEM hItem = TreeView_GetRoot(tree_.m_hWnd);

    if (NULL == hItem)
    {
        hItem = addTreeItem(NULL, "/", false); // 根节点
    }

    HTREEITEM hChild = NULL;

    for (UINT i = 0; i < vectorStr.size(); i++)
    {
        hChild = findTreeItem(hItem, vectorStr[i].c_str());

        if (NULL == hChild)
        {
            hChild = addTreeItem(hItem, vectorStr[i].c_str(), false);
        }

        tree_.SendMessage(TVM_EXPAND, TVE_EXPAND, (LPARAM)hItem);

        hItem = hChild;
    }

    return hItem;
}
开发者ID:xt9852,项目名称:TestSet,代码行数:36,代码来源:BrowseWnd.cpp

示例4: TreeView_GetRoot

bool ShellBrowser::jump_to_pidl(LPCITEMIDLIST pidl)
{
    if (!_root._entry)
        return false;

    // iterate through the hierarchy and open all folders to reach pidl
    WaitCursor wait;

    HTREEITEM hitem = TreeView_GetRoot(_left_hwnd);
    Entry* entry = _root._entry;

    for(const void*p=pidl;;) {
        if (!p)
            return true;

        if (!entry || !hitem)
            break;

        entry->smart_scan(SORT_NAME, SCAN_DONT_ACCESS);

        Entry* found = entry->find_entry(p);
        p = entry->get_next_path_component(p);

        if (found)
            hitem = select_entry(hitem, found);

        entry = found;
    }

    return false;
}
开发者ID:svn2github,项目名称:ros-explorer,代码行数:31,代码来源:shellbrowser.cpp

示例5: saveCollapseState

static void saveCollapseState( HWND hwndTree )
{
	HTREEITEM hti;
	TVITEM tvi;
	hti = TreeView_GetRoot( hwndTree );
	while( hti != NULL ) {
		HTREEITEM ht;
		tvi.mask = TVIF_STATE | TVIF_HANDLE | TVIF_CHILDREN | TVIF_PARAM;
		tvi.hItem = hti;
		tvi.stateMask = (DWORD)-1;
		TreeView_GetItem( hwndTree, &tvi );
		if( tvi.cChildren > 0 ) {
			TreeItem *treeItem = (TreeItem *)tvi.lParam;
			if ( tvi.state & TVIS_EXPANDED )
				DBWriteContactSettingByte(NULL, "KeyBindingsUI", treeItem->paramName, TVIS_EXPANDED );
			else
				DBWriteContactSettingByte(NULL, "KeyBindingsUI", treeItem->paramName, 0 );
		}
		ht = TreeView_GetChild( hwndTree, hti );
		if( ht == NULL ) {
			ht = TreeView_GetNextSibling( hwndTree, hti );
			while( ht == NULL ) {
				hti = TreeView_GetParent( hwndTree, hti );
				if( hti == NULL ) break;
				ht = TreeView_GetNextSibling( hwndTree, hti );
		}	}
		hti = ht;
}	}
开发者ID:TonyAlloa,项目名称:miranda-dev,代码行数:28,代码来源:keybindings.cpp

示例6: OptTree_FindNamedTreeItemAt

HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name)
{
    TVITEM tvi = {0};
    TCHAR str[MAX_PATH];

    if (hItem)
        tvi.hItem = TreeView_GetChild(hwndTree, hItem);
    else
        tvi.hItem = TreeView_GetRoot(hwndTree);

    if (!name)
        return tvi.hItem;

    tvi.mask = TVIF_TEXT;
    tvi.pszText = str;
    tvi.cchTextMax = MAX_PATH;

    while (tvi.hItem)
    {
        TreeView_GetItem(hwndTree, &tvi);

        if (!lstrcmp(tvi.pszText, name))
            return tvi.hItem;

        tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
    }
    return NULL;
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:28,代码来源:opttree.cpp

示例7: TreeView_GetRoot

void TreeView::destroy()
{
	HTREEITEM root = TreeView_GetRoot(_hSelf);
	cleanSubEntries(root);
	::DestroyWindow(_hSelf);
	_hSelf = NULL;
} 
开发者ID:Loreia,项目名称:UDL2,代码行数:7,代码来源:TreeView.cpp

示例8: TreeView_GetRoot

void
CDeviceView::SelectNode(
    _In_ CNode *Node
    )
{
    HTREEITEM hRoot, hItem;

    // Check if there are any items in the tree
    hRoot = TreeView_GetRoot(m_hTreeView);
    if (hRoot == NULL) return;

    // If we don't want to set select a node, just select root
    if (Node == nullptr || Node->GetNodeType() == RootNode)
    {
        TreeView_SelectItem(m_hTreeView, hRoot);
        return;
    }

    // Scan the tree looking for the node we want
    hItem = RecurseFindDevice(hRoot, Node);
    if (hItem)
    {
        TreeView_SelectItem(m_hTreeView, hItem);
    }
    else
    {
        TreeView_SelectItem(m_hTreeView, hRoot);
    }
}
开发者ID:Strongc,项目名称:reactos,代码行数:29,代码来源:DeviceView.cpp

示例9: TraverseTreebarItems

void TraverseTreebarItems(void)
{
	SetWindowRedraw(Dcx::mIRC.getTreeview(), FALSE);
	TString buf((UINT)MIRC_BUFFER_SIZE_CCH);
	TString res;
	TVITEMEX item;
	ZeroMemory(&item, sizeof(item));
	for (HTREEITEM ptvitem = TreeView_GetRoot(Dcx::mIRC.getTreeview()); ptvitem != NULL; ptvitem = TreeView_GetNextSibling(Dcx::mIRC.getTreeview(), ptvitem)) {
		item.hItem = ptvitem;
		item.pszText = buf.to_chr();
		item.cchTextMax = MIRC_BUFFER_SIZE_CCH;
		item.mask = TVIF_TEXT|TVIF_PARAM;
		if (TreeView_GetItem(Dcx::mIRC.getTreeview(), &item))
		{
			{
				TString tsType;
				DcxDock::getTreebarItemType(tsType, item.lParam);
				Dcx::mIRC.execex("/!set -nu1 %%dcx_%d %s", item.lParam, item.pszText );
				Dcx::mIRC.tsEvalex(res, "$xtreebar_callback(geticons,%s,%%dcx_%d)", tsType.to_chr(), item.lParam);
			}
			item.mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE;
			int i = res.gettok( 1 ).to_int() -1;
			if (i < 0)
				i = 0;
			item.iImage = i;
			i = res.gettok( 2 ).to_int() -1;
			if (i < 0)
				i = 0;
			item.iSelectedImage = i;
			TreeView_SetItem(Dcx::mIRC.getTreeview(), &item);
		}
		TraverseChildren(ptvitem, buf, res, &item);
	}
	SetWindowRedraw(Dcx::mIRC.getTreeview(), TRUE);
}
开发者ID:dlsocool,项目名称:dcx,代码行数:35,代码来源:xTreebar.cpp

示例10: GetDlgItem

void ShareDialog::dialogInit(HWND hWnd,LPARAM lParam)
{
	m_hTreeView = GetDlgItem(hWnd,IDC_TREE_SETTINGS);

	WinUtil::TreeViewUtil::insertItem(m_hTreeView,NULL,"Setup",(LPARAM)&m_setupPage);
	WinUtil::TreeViewUtil::insertItem(m_hTreeView,NULL,"Permissions",(LPARAM)&m_permissionsPage);

	m_setupPage.init(hWnd,MAKEINTRESOURCE(IDD_PAGE_SHARESETUP),NULL);
	m_permissionsPage.init(hWnd,MAKEINTRESOURCE(IDD_PAGE_SHAREPERMISSIONS),NULL);

	WinUtil::WindowUtil::centerParent(hWnd);

	m_pShare = (Share*)lParam;
	if ( m_pShare->getName().empty() ) {
		SetWindowText(hWnd,WinUtil::ResourceUtil::loadString(IDS_ADDSHARE).c_str());
	}
	else {
		SetWindowText(hWnd,WinUtil::ResourceUtil::loadString(IDS_EDITSHARE).c_str());
	}

	TreeView_SelectItem(m_hTreeView,TreeView_GetRoot(m_hTreeView));
	SetFocus(m_hTreeView);

	m_setupPage.loadPage(m_pShare);
	m_permissionsPage.loadPage(m_pShare);
}
开发者ID:CIHANGIRCAN,项目名称:vibestreamer,代码行数:26,代码来源:ShareDialog.cpp

示例11: _GetTreeCtrl

void CSubclassedCopyMoveDlg::AfterInitDialog()
{
	HWND hTreeCtrl = _GetTreeCtrl();
	if (!hTreeCtrl)
	{
		// wrong dialog?
		PostMessage(WM_COMMAND, IDCANCEL, 0);
		return;
	}

	HTREEITEM hRoot = TreeView_GetRoot(hTreeCtrl);
	HTREEITEM hLocalFolders = COETricks::m_bVista ? hRoot : TreeView_GetChild(hTreeCtrl, hRoot);
	if (!hLocalFolders)
	{
		PostMessage(WM_COMMAND, IDCANCEL, 0);	// dunno what happened
		return;
	}

	FOLDERS_LIST arrFolders;
	_EnumFolders(hTreeCtrl, hLocalFolders, arrFolders);

	// select our target folder
	// then press OK
	FOLDERS_LIST::const_iterator it = arrFolders.find(m_dwFolderID);
	if (it == arrFolders.end())
	{
		// there's no love...
		PostMessage(WM_COMMAND, IDCANCEL, 0);
		return;
	}

	TreeView_SelectItem(hTreeCtrl, it->second);
	PostMessage(WM_COMMAND, IDOK, 0);
}
开发者ID:hackshields,项目名称:antivirus,代码行数:34,代码来源:SubclassedCopyMoveDlg.cpp

示例12: GetDlgItem

void GroupDialog::dialogInit(HWND hWnd,LPARAM lParam)
{
	m_hTreeView = GetDlgItem(hWnd,IDC_TREE_SETTINGS);

	WinUtil::TreeViewUtil::insertItem(m_hTreeView,NULL,"Setup",(LPARAM)&m_setupPage);
	WinUtil::TreeViewUtil::insertItem(m_hTreeView,NULL,"General",(LPARAM)&m_generalPage);

	m_setupPage.init(hWnd,MAKEINTRESOURCE(IDD_PAGE_GROUPSETUP),NULL);
	m_generalPage.init(hWnd,MAKEINTRESOURCE(IDD_PAGE_GROUPGENERAL),NULL);
	
	WinUtil::WindowUtil::centerParent(hWnd);

	m_pGroup = (Group*)lParam;
	if ( m_pGroup->getName().empty() ) {
		SetWindowText(hWnd,WinUtil::ResourceUtil::loadString(IDS_ADDGROUP).c_str());
	}
	else {
		SetWindowText(hWnd,WinUtil::ResourceUtil::loadString(IDS_EDITGROUP).c_str());
	}

	TreeView_SelectItem(m_hTreeView,TreeView_GetRoot(m_hTreeView));
	SetFocus(m_hTreeView);

	m_setupPage.loadPage(m_pGroup);
	m_generalPage.loadPage(m_pGroup);
}
开发者ID:CIHANGIRCAN,项目名称:vibestreamer,代码行数:26,代码来源:GroupDialog.cpp

示例13: AddDialogString

void AddDialogString(HWND hWndDlg, const PageHash key)
{
	TCHAR title[2048];
	GetWindowText(hWndDlg, title, _countof(title));
	if (mir_tstrlen(title) > 0)
		AddFilterString(key, title);

	TCHAR szClass[64];
	GetClassName(hWndDlg, szClass, _countof(szClass));

	if (mir_tstrcmpi(szClass, _T("SysTreeView32")) == 0) {
		HTREEITEM hItem = TreeView_GetRoot(hWndDlg);
		AddTreeViewNodes(hWndDlg, key, hItem);
		return;
	}

	if (mir_tstrcmpi(szClass, _T("listbox")) == 0) {
		if (GetWindowStyle(hWndDlg) & LBS_HASSTRINGS) {
			int count = ListBox_GetCount(hWndDlg);
			for (int i=0; i < count; i++) {
				title[0] = 0; //safety
				int res = ListBox_GetText(hWndDlg, i, title);
				if (res != LB_ERR) {
					title[_countof(title) - 1] = 0;
					if (mir_tstrlen(title) > 0)
						AddFilterString(key, title);
				}
			}
		}
		return;
	}

	if (mir_tstrcmpi(szClass, _T("SysListView32")) == 0) {
		int count = ListView_GetItemCount(hWndDlg);
		for (int i=0; i < count; i++) {
			title[0] = 0; //safety
			ListView_GetItemText(hWndDlg, i, 0, title, _countof(title));

			if (mir_tstrlen(title) > 0)
				AddFilterString(key, title);
		}
		return;
	}

	if (mir_tstrcmpi(szClass, _T("combobox")) == 0) {
		if (GetWindowStyle(hWndDlg) & CBS_HASSTRINGS) {
			int count = ComboBox_GetCount(hWndDlg);
			for (int i=0; i < count; i++) {
				title[0] = 0; //safety
				int res = ComboBox_GetLBText(hWndDlg, i, title);
				if (res != CB_ERR) {
					title[_countof(title) - 1] = 0;

					if (mir_tstrlen(title) > 0)
						AddFilterString(key, title);
				}
			}
		}
	}
}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:60,代码来源:filter.cpp

示例14: TV_ThemODia

// Them tat ca cac o dia hien co vao nut ROOT cua TreeView
BOOL TV_ThemODia()
{
	TCHAR szChuoiODia[101]; // Luu cac o dia hien co trong My Computer

	DWErr = GetLogicalDriveStrings(101, szChuoiODia); // Lay cac o dia co trong My Computer
	// Loi chua xac dinh
	if (DWErr == 0)
		ErrorExit(_T("ThemODia() \"GetLogicalDriveStrings\""));

	TCHAR szThongTin[PATHFILE_MAX_LEN];
	TCHAR *temp = szChuoiODia;
	TCHAR *szLParam; // szLParam[5] cho biet o dia da duoc expand lan nao chua
	TCHAR t[6];

	HTREEITEM hParent = TreeView_GetRoot(hwndTreeView);
	HTREEITEM hPrev = NULL;

	for (int i = 0; temp[i]; i += 4)
	{		
		szLParam = new TCHAR[5];
		wsprintf(szLParam, _T("%s"), temp + i);
		szLParam[4] = 0;

		// Lay thong tin ve o dia (Ten o dia)
		LayThongTinODia(temp + i, szThongTin);
		wsprintf(t, _T("%s*"), temp + i);	

		hPrev = addItemToTree(szThongTin, szLParam, hParent, hPrev, CoChuaThuMucCon(t));
	}

	return TRUE;
}
开发者ID:anhvinhitus,项目名称:myprojects2005-2009,代码行数:33,代码来源:stdafx.cpp

示例15: OptTree_Translate

void OptTree_Translate(HWND hwndTree)
{
    HTREEITEM hItem = TreeView_GetRoot(hwndTree);
    while (hItem)
    {
        HTREEITEM hItemTmp = 0;

        OptTree_TranslateItem(hwndTree, hItem);
        if (hItemTmp = TreeView_GetChild(hwndTree, hItem))
        {
            hItem = hItemTmp;
        } else if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem))
        {
            hItem = hItemTmp;
        } else
        {
            while (1)
            {
                if (!(hItem = TreeView_GetParent(hwndTree, hItem))) break;
                if (hItemTmp = TreeView_GetNextSibling(hwndTree, hItem))
                {
                    hItem = hItemTmp;
                    break;
                }
            }
        }
    }
}
开发者ID:0xmono,项目名称:miranda-ng,代码行数:28,代码来源:opttree.cpp


注:本文中的TreeView_GetRoot函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。