Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
	// 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);
	}
Exemplo n.º 3
0
/**
 *\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;
}
Exemplo n.º 4
0
void  AP_Win32Dialog_Stylist::setStyleInGUI(void)
{
	UT_sint32 row,col;
	UT_UTF8String sCurStyle = *getCurStyle();

	if((getStyleTree() == NULL) || (sCurStyle.size() == 0))
		updateDialog();

	if(isStyleTreeChanged())
		_fillTree();

	getStyleTree()->findStyle(sCurStyle,row,col);
	UT_DEBUGMSG(("After findStyle row %d col %d col \n",row,col));
	UT_UTF8String sPathFull = UT_UTF8String_sprintf("%d:%d",row,col);
	UT_UTF8String sPathRow = UT_UTF8String_sprintf("%d",row);
	UT_DEBUGMSG(("Full Path string is %s \n",sPathFull.utf8_str()));

	HWND hTree = GetDlgItem(m_hWnd, AP_RID_DIALOG_STYLIST_TREE_STYLIST);
	HTREEITEM hitem = NULL;

	hitem = TreeView_GetRoot(hTree);
	UT_sint32 i;
	// Go through each row until we've found ours
	for (i = 0; i < row; i++)
		hitem = TreeView_GetNextItem(hTree, hitem, TVGN_NEXT);

	hitem = TreeView_GetNextItem(hTree, hitem, TVGN_CHILD);
	for (i = 0; i < col; i++)
		hitem = TreeView_GetNextItem(hTree, hitem, TVGN_NEXT);

	TreeView_SelectItem(hTree, hitem);

	setStyleChanged(false);
}
Exemplo n.º 5
0
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;
}
Exemplo n.º 6
0
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;
}	}
Exemplo n.º 7
0
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;
}
Exemplo n.º 8
0
void TreeView::destroy()
{
	HTREEITEM root = TreeView_GetRoot(_hSelf);
	cleanSubEntries(root);
	::DestroyWindow(_hSelf);
	_hSelf = NULL;
} 
Exemplo n.º 9
0
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);
    }
}
Exemplo n.º 10
0
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);
}
Exemplo n.º 11
0
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);
}
Exemplo n.º 12
0
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);
}
Exemplo n.º 13
0
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);
}
Exemplo n.º 14
0
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);
				}
			}
		}
	}
}
Exemplo n.º 15
0
// 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;
}
Exemplo n.º 16
0
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;
                }
            }
        }
    }
}
Exemplo n.º 17
0
int rowOptFillRowTree(HWND hwnd)
{
	TreeView_DeleteAllItems(hwnd);
	rowOptGenerateTreeView(rowOptTmplRoot, NULL, hwnd);
	TreeView_Expand(hwnd, TreeView_GetRoot(hwnd), TVM_EXPAND);
	return 0;
}
Exemplo n.º 18
0
void SelectTreeViewFolder(int folder_id)
{
	HWND hTreeView = GetTreeView();
	HTREEITEM hti;
	TVITEM tvi;

	hti = TreeView_GetRoot(hTreeView);

	while (hti != NULL)
	{
		HTREEITEM hti_next;

		tvi.hItem = hti;
		tvi.mask = TVIF_PARAM;
		TreeView_GetItem(hTreeView,&tvi);

		if (((LPTREEFOLDER)tvi.lParam)->m_nFolderId == folder_id)
		{
			TreeView_SelectItem(hTreeView,tvi.hItem);
			SetCurrentFolder((LPTREEFOLDER)tvi.lParam);
			return;
		}
		
		hti_next = TreeView_GetChild(hTreeView,hti);
		if (hti_next == NULL)
		{
			hti_next = TreeView_GetNextSibling(hTreeView,hti);
			if (hti_next == NULL)
			{
				hti_next = TreeView_GetParent(hTreeView,hti);
				if (hti_next != NULL)
					hti_next = TreeView_GetNextSibling(hTreeView,hti_next);
			}
		}
		hti = hti_next;
	}

	// could not find folder to select
	// make sure we select something
	tvi.hItem = TreeView_GetRoot(hTreeView);
	tvi.mask = TVIF_PARAM;
	TreeView_GetItem(hTreeView,&tvi);

	TreeView_SelectItem(hTreeView,tvi.hItem);
	SetCurrentFolder((LPTREEFOLDER)tvi.lParam);

}
Exemplo n.º 19
0
VOID TreeListUpdateTooltips(
    HWND hwndTreeList
)
{
    HWND TreeControl = (HWND)GetWindowLongPtr(hwndTreeList, TL_TREECONTROL_SLOT),
        ToolTips = (HWND)GetWindowLongPtr(hwndTreeList, TL_TOOLTIPS_SLOT),
        Header = (HWND)GetWindowLongPtr(hwndTreeList, TL_HEADERCONTROL_SLOT);

    PTL_SUBITEMS subitems;

    HTREEITEM   item = TreeView_GetRoot(TreeControl);
    RECT        rc, subrc;
    TOOLINFO    tool;
    ULONG       i = 0, c;
    LONG        cx;
    TVITEMEX    itemex;

    RtlSecureZeroMemory(&rc, sizeof(rc));
    Header_GetItemRect(Header, 0, &rc);
    cx = rc.right;

    c = (ULONG)SendMessage(ToolTips, TTM_GETTOOLCOUNT, 0, 0);
    RtlSecureZeroMemory(&tool, sizeof(tool));
    tool.cbSize = sizeof(tool);

    while (SendMessage(ToolTips, TTM_ENUMTOOLS, i, (LPARAM)&tool) && (i < c)) {
        if (!TreeView_GetItemRect(TreeControl, (HTREEITEM)(tool.uId - tool.lParam), &rc, FALSE)) {
            SendMessage(ToolTips, TTM_DELTOOL, 0, (LPARAM)&tool);
            continue;
        }
        i++;
    }

    while (item) {
        if (TreeView_GetItemRect(TreeControl, item, &rc, TRUE)) {
            RtlSecureZeroMemory(&itemex, sizeof(itemex));
            itemex.hItem = item;
            itemex.mask = TVIF_HANDLE | TVIF_PARAM;
            TreeView_GetItem(TreeControl, &itemex);

            if (rc.right > cx)
                rc.right = cx;
            AddTooltipItemSub(TreeControl, ToolTips, (UINT_PTR)item, 0, &rc);

            if (itemex.lParam) {
                subitems = (PTL_SUBITEMS)itemex.lParam;
                for (i = 0; i < subitems->Count; i++) {
                    if (!Header_GetItemRect(Header, i + 1, &subrc))
                        break;
                    subrc.top = rc.top;
                    subrc.bottom = rc.bottom;
                    AddTooltipItemSub(TreeControl, ToolTips, i + 1 + (UINT_PTR)item, i + 1, &subrc);
                }
            }

        }
        item = TreeView_GetNextVisible(TreeControl, item);
    }
}
Exemplo n.º 20
0
static int SaveTree(HWND hwndDlg)
{
	TVITEM tvi;
	int count;
	TCHAR idstr[100];
	char menuItemName[256], DBString[256], MenuNameItems[256];
	int menupos;
	int MenuObjectId, runtimepos;
	TIntMenuObject* pimo;
	MenuItemOptData* iod;
	HWND hTree = GetDlgItem( hwndDlg, IDC_MENUITEMS );

	if ( !GetCurrentMenuObjectID( hwndDlg, &MenuObjectId ))
		return 0;

	tvi.hItem = TreeView_GetRoot( hTree );
	tvi.cchTextMax = 99;
	tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE;
	tvi.pszText = idstr;
	count = 0;

	menupos = GetMenuObjbyId( MenuObjectId );
	if ( menupos == -1 )
		return -1;

	pimo = g_menus[menupos];

	mir_snprintf( MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
	runtimepos = 100;

	while ( tvi.hItem != NULL ) {
		TreeView_GetItem( hTree, &tvi );
		iod = ( MenuItemOptData* )tvi.lParam;
		if ( iod->pimi ) {
			GetMenuItemName( iod->pimi, menuItemName, sizeof( menuItemName ));

			mir_snprintf( DBString, SIZEOF(DBString), "%s_visible", menuItemName );
			DBWriteContactSettingByte( NULL, MenuNameItems, DBString, iod->show );

			mir_snprintf( DBString, SIZEOF(DBString), "%s_pos", menuItemName );
			DBWriteContactSettingDword( NULL, MenuNameItems, DBString, runtimepos );

			mir_snprintf( DBString, SIZEOF(DBString), "%s_name", menuItemName );
			if ( lstrcmp( iod->name, iod->defname ) != 0 )
				DBWriteContactSettingTString( NULL, MenuNameItems, DBString, iod->name );
			else
				DBDeleteContactSetting( NULL, MenuNameItems, DBString );

			runtimepos += 100;
		}

		if ( iod->name && !_tcscmp( iod->name, STR_SEPARATOR) && iod->show )
			runtimepos += SEPARATORPOSITIONINTERVAL;

		tvi.hItem = TreeView_GetNextSibling( hTree, tvi.hItem );
		count++;
	}
	return 1;
}
Exemplo n.º 21
0
void    plResTreeView::ClearTreeView( HWND hWnd )
{
    HTREEITEM   root = TreeView_GetRoot( hWnd );
    if( root != nil )
        IDeleteRecurse( hWnd, root );

    TreeView_DeleteAllItems( hWnd );
}
Exemplo n.º 22
0
void StoreTreeToDB(HWND hTree, char * section)
{
  HTREEITEM tmp=NULL;
  tmp=TreeView_GetRoot(hTree);
  StoreTreeNode(hTree,tmp,section);
  ModernWriteSettingByte(NULL,section,"Modified",1);
  glSkinWasModified=2;
}
Exemplo n.º 23
0
wxTreeItemId wxTreeCtrl::GetRootItem() const
{
    // Root may be real (visible) or virtual (hidden).
    if ( GET_VIRTUAL_ROOT() )
        return TVI_ROOT;

    return wxTreeItemId(TreeView_GetRoot(GetHwnd()));
}
Exemplo n.º 24
0
    PTVDATA GetRootNode(void) {

        PTVDATA r = NULL;

        r = HandleToData(TreeView_GetRoot(m_hWnd));

        return r;
    }
Exemplo n.º 25
0
void    plResTreeView::FindObject( HWND tree )
{
    if( DialogBox( gInstance, MAKEINTRESOURCE( IDD_FINDOBJ ), tree, FindDialogProc ) == IDOK )
    {
        fFoundItem = TreeView_GetRoot( tree );
        IFindNextObject( tree );
    }
}
Exemplo n.º 26
0
void TffdshowPageBase::treeSelectItem(int uniqueId, int prevVisId)
{
    for (HTREEITEM hti = TreeView_GetRoot(htv); hti; hti = TreeView_GetNextVisible(htv, hti)) {
        TconfPageBase *page = hti2page(hti);
        if (page->uniqueID() == uniqueId) {
            TreeView_SelectItem(htv, hti);
            if (prevVisId)
                for (HTREEITEM htivis = TreeView_GetRoot(htv); htivis; htivis = TreeView_GetNextVisible(htv, htivis)) {
                    TconfPageBase *pagevis = hti2page(htivis);
                    if (pagevis->uniqueID() == prevVisId) {
                        TreeView_EnsureVisible(htv, htivis);
                    }
                }
            return;
        }
    }
}
Exemplo n.º 27
0
			TreeView::Item TreeView::operator [] (const uint index) const
			{
				HTREEITEM hItem = TreeView_GetRoot( control );

				for (uint i=index; i; --i)
					hItem = TreeView_GetNextSibling( control, hItem );

				return Item( control, hItem, hItem ? int(index) : -1 );
			}
Exemplo n.º 28
0
VOID
FreeDeviceStrings(HWND hTreeView)
{
    HTREEITEM hItem;

    hItem = TreeView_GetRoot(hTreeView);

    if (hItem)
    {
        hItem = TreeView_GetChild(hTreeView,
                                  hItem);
        /* loop the parent items */
        while (hItem)
        {
            hItem = TreeView_GetChild(hTreeView,
                                      hItem);
            if (hItem == NULL)
                break;

            /* loop the child items and free the DeviceID */
            while (TRUE)
            {
                HTREEITEM hOldItem;
                TV_ITEM tvItem;
                //TCHAR Buf[100];

                tvItem.hItem = hItem;
                tvItem.mask = TVIF_PARAM;// | TVIF_TEXT;
                //tvItem.pszText = Buf;
                //tvItem.cchTextMax = 99;

                (void)TreeView_GetItem(hTreeView, &tvItem);

                //MessageBox(NULL, Buf, NULL, 0);

                HeapFree(GetProcessHeap(),
                         0,
                         (LPTSTR)tvItem.lParam);

                hOldItem = hItem;

                hItem = TreeView_GetNextSibling(hTreeView,
                                                hItem);
                if (hItem == NULL)
                {
                    hItem = hOldItem;
                    break;
                }
            }

            hItem = TreeView_GetParent(hTreeView,
                                       hItem);
            hItem = TreeView_GetNextSibling(hTreeView,
                                            hItem);
        }
    }
}
Exemplo n.º 29
0
void ExpandTree(void)
{
   HTREEITEM hTree;

   hTree=TreeView_GetRoot(hTreeWnd);

   if(hTree)
   	TreeView_Expand(hTreeWnd,hTree,TVE_EXPAND);
}
Exemplo n.º 30
0
static void
cfgui_sync_node_list(cfgui_wnd_data * d, HWND hwnd) {
    HWND hwtv;
    HTREEITEM hItem;

    hwtv = GetDlgItem(hwnd, IDC_CFG_NODELIST);
    hItem = TreeView_GetRoot(hwtv);

    cfgui_sync_node(d, hwtv, NULL, hItem);
}