Пример #1
0
int FillSettingsBox(HWND htree,const char *szModule)
{
	DBCONTACTENUMSETTINGS dbces;
	HANDOVER hndvr;
	HANDLE hcontact;
	TVINSERTSTRUCT tvis;
	HTREEITEM htvi;
	char *pszContact;

	hndvr.htree=htree;
	hndvr.valid=0;
	dbces.lParam=(LPARAM)&hndvr;
	dbces.pfnEnumProc=EnumSettings;
	dbces.szModule=szModule;

	hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
	while(hcontact!=NULL)
	{
		pszContact=strdup((const char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hcontact,0));

		tvis.hParent=TVI_ROOT;
		tvis.hInsertAfter=TVI_SORT;
		tvis.item.mask=TVIF_TEXT|TVIF_PARAM;
		tvis.item.pszText=pszContact;
		tvis.item.cchTextMax=strlen(pszContact);
		tvis.item.lParam=(LPARAM)hcontact;

		htvi=TreeView_InsertItem(htree,&tvis);

		hndvr.htvi=htvi;

		if(CallService(MS_DB_CONTACT_ENUMSETTINGS,(WPARAM)hcontact,(LPARAM)&dbces)==-1)
			TreeView_DeleteItem(htree,htvi);

		hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hcontact,0);
	}

	hcontact=NULL;
	pszContact=Translate("Main contact");

	tvis.hParent=TVI_ROOT;
	tvis.hInsertAfter=TVI_FIRST;
	tvis.item.mask=TVIF_TEXT|TVIF_PARAM;
	tvis.item.pszText=pszContact;
	tvis.item.cchTextMax=strlen(pszContact);
	tvis.item.lParam=(LPARAM)NULL;

	htvi=TreeView_InsertItem(htree,&tvis);

	hndvr.htvi=htvi;

	if(CallService(MS_DB_CONTACT_ENUMSETTINGS,(WPARAM)hcontact,(LPARAM)&dbces)==-1)
		TreeView_DeleteItem(htree,htvi);

	return hndvr.valid;
}
Пример #2
0
void ExpandPointer(VARINFO *v, int code, int page)
{
    if (v->pointer)
    {
        if (code == TVE_EXPAND)
        {
            int val;
            int outofscope = (val = v->derefaddress) == -1 && !ReadValue(v->address, &val, 4, v) || !val;
            if (!v->subtype && watchinfo_list[page][v->watchindex].dbg_info)
            {
                TreeView_DeleteItem(hwndTree[page], v->hTreeHolder);
                ExpandPointerInfo(watchinfo_list[page][v->watchindex].dbg_info, v);
                if (v->subtype->structure)
                {
                    InsertSubTree(v->hTreeItem, 0, v->subtype->subtype, v->watchindex, page);
                }
                else
                    InsertSubTree(v->hTreeItem, 0, v->subtype, v->watchindex, page);
            }
            RefreshAddresses(v->subtype, val, NULL, outofscope);
            RefreshData(watchinfo_list[page][v->watchindex].dbg_info, v);
        }
        else if (code == TVE_COLLAPSE)
        {
            if (v->subtype)
            {
                FreeTree(v->subtype, page);
                FreeVarInfo(v->subtype);
                v->subtype = 0;
                v->hTreeHolder = InsertItem(v->hTreeItem, TVI_LAST, v, page);
            }
        }
    }
}
Пример #3
0
void freeTree(HWND hwnd2Tree, MCONTACT hContact)
{
	TVITEM item;
	HTREEITEM lastItem;
	if (!TreeView_GetCount(hwnd2Tree))
		return;

	item.mask = TVIF_STATE | TVIF_PARAM;
	item.hItem = TVI_ROOT;
	do {
		do {
			lastItem = item.hItem;
			if (lastItem != TVI_ROOT) {
				TreeView_GetItem(hwnd2Tree, &item);
				/* these next 2 lines are not from code guru..... */
				if (item.lParam) {
					ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)item.lParam;

					if (!hContact || (hContact == mtis->hContact)) {
						if (hContact != NULL) {
							TreeView_DeleteItem(hwnd2Tree, item.hItem);
							mir_free(mtis);
						}
						else
							mtis->type = STUB;
					}
				}
				/* back to coduguru's code*/
			}
		} while (item.hItem = TreeView_GetChild(hwnd2Tree, lastItem));

		while (!(item.hItem = TreeView_GetNextSibling(hwnd2Tree, lastItem)) && (lastItem = item.hItem = TreeView_GetParent(hwnd2Tree, lastItem))) {}

	} while (item.hItem);
}
Пример #4
0
HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsertAfter)
{
	TVITEM tvi={0};
	tvi.mask=TVIF_HANDLE|TVIF_PARAM;
	tvi.hItem=hItem;
	if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvi))
		return NULL;
	if (hItem && hInsertAfter) {
		TVINSERTSTRUCT tvis;
		TCHAR name[128];
		if (hItem == hInsertAfter)
			return hItem;

		tvis.item.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
		tvis.item.stateMask=0xFFFFFFFF;
		tvis.item.pszText=name;
		tvis.item.cchTextMax=sizeof(name);
		tvis.item.hItem=hItem;      
		tvis.item.iImage=tvis.item.iSelectedImage=((MenuItemOptData *)tvi.lParam)->show;
		if(!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item))
			return NULL;
		if (!TreeView_DeleteItem(hTreeWnd,hItem)) 
			return NULL;
		tvis.hParent=NULL;
		tvis.hInsertAfter=hInsertAfter;
		return TreeView_InsertItem(hTreeWnd, &tvis);
	}
	return NULL;    
}
Пример #5
0
// @fSubLeaf: 是否要遍子下级以及更下级叶子
// 遍历(hctl, htvi)叶子下的所有叶子, 分别调用fn.
// 注:
// 1. 调用函数中不要去删除本叶子,要删除使用函数给的fDelete置TRUE
void TreeView_Walk(HWND hctl, HTREEITEM htvi, BOOL fSubLeaf, fn_treeview_walk fn, uint32_t *ctx, BOOL fDelete)
{
	HTREEITEM			hChildTreeItem = NULL;
	HTREEITEM			hPrevChildTreeItem;

	hChildTreeItem = TreeView_GetChild(hctl, htvi);
	while (hChildTreeItem) {
		//
        // Call the fn on the node itself.
        //
		if (fSubLeaf) {
			TreeView_Walk(hctl, hChildTreeItem, fSubLeaf, fn, ctx);
		}
		if (fn) {
			fn(hctl, hChildTreeItem, ctx);
		}
		
        hPrevChildTreeItem = hChildTreeItem;
		hChildTreeItem = TreeView_GetNextSibling(hctl, hChildTreeItem);
		if (fDelete) {
			TreeView_DeleteItem(hctl, hPrevChildTreeItem);
		}
    }
	return;
}
Пример #6
0
void node::purge_empty_children(HWND wnd)
{
	t_size i = children.get_count(), index_first_removed = pfc_infinite;
	for (; i; i--)
	{
		if (!children[i - 1]->get_entries().get_count())
		{
			if (p_dbe && p_dbe->p_selection == children[i - 1])
				p_dbe->p_selection = NULL;
			TreeView_DeleteItem(wnd, children[i - 1]->m_ti);
			children.remove_by_idx(i - 1);
			index_first_removed = i - 1;
		}
	}
	if (index_first_removed != pfc_infinite && cfg_show_numbers)
		m_label_dirty = true;

	if (index_first_removed != pfc_infinite && cfg_show_numbers2)
	{
		t_size count = children.get_count();
		for (i = index_first_removed; i<count; i++)
		{
			children[i]->m_label_dirty = true;
		}
	}
}
Пример #7
0
void 
FileTransfer::ShowTreeViewItems(HWND hwnd, LPNMTREEVIEW m_lParam)
{
	HANDLE m_handle;
	WIN32_FIND_DATA m_FindFileData;
	TVITEM tvi;
	TVINSERTSTRUCT tvins;
	char path[rfbMAX_PATH];
	GetTVPath(GetDlgItem(hwnd, IDC_FTBROWSETREE), m_lParam->itemNew.hItem, path);
	strcat(path, "\\*");
	while (TreeView_GetChild(GetDlgItem(hwnd, IDC_FTBROWSETREE), m_lParam->itemNew.hItem) != NULL) {
		TreeView_DeleteItem(GetDlgItem(hwnd, IDC_FTBROWSETREE), TreeView_GetChild(GetDlgItem(hwnd, IDC_FTBROWSETREE), m_lParam->itemNew.hItem));
	}
	SetErrorMode(SEM_FAILCRITICALERRORS);
	m_handle = FindFirstFile(path, &m_FindFileData);
	SetErrorMode(0);
	if (m_handle == INVALID_HANDLE_VALUE) return;
	while(1) {
		if ((strcmp(m_FindFileData.cFileName, ".") != 0) && 
			(strcmp(m_FindFileData.cFileName, "..") != 0)) {
			if (m_FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {	
				tvi.mask = TVIF_TEXT;
				tvi.pszText = m_FindFileData.cFileName;
				tvins.hParent = m_lParam->itemNew.hItem;
				tvins.item = tvi;
				tvins.hParent = TreeView_InsertItem(GetDlgItem(hwnd, IDC_FTBROWSETREE), &tvins);
				TreeView_InsertItem(GetDlgItem(hwnd, IDC_FTBROWSETREE), &tvins);
			}
		}
		if (!FindNextFile(m_handle, &m_FindFileData)) break;
	}
	FindClose(m_handle);
}
CATResult CATTreeCtrl::OSRemoveItem( CATTREEINFO* treeItem )
{
    if (TreeView_DeleteItem(fControlWnd, treeItem->ItemHandle))
    {
        return CAT_SUCCESS;
    }
    return CATRESULT(CAT_ERR_TREE_REMOVE_ERROR);
}
Пример #9
0
int ShellBrowserChild::InsertSubitems(HTREEITEM hParentItem, ShellDirectory* dir)
{
	CONTEXT("ShellBrowserChild::InsertSubitems()");

	WaitCursor wait;

	int cnt = 0;

	SendMessage(_left_hwnd, WM_SETREDRAW, FALSE, 0);

	try {
		dir->smart_scan();
	} catch(COMException& e) {
		HandleException(e, g_Globals._hMainWnd);
	}

	 // remove old children items
	for(HTREEITEM hchild,hnext=TreeView_GetChild(_left_hwnd, hParentItem); hchild=hnext; ) {
		hnext = TreeView_GetNextSibling(_left_hwnd, hchild);
		TreeView_DeleteItem(_left_hwnd, hchild);
	}

	TV_ITEM tvItem;
	TV_INSERTSTRUCT tvInsert;

	for(ShellEntry*entry=dir->_down; entry; entry=entry->_next) {
#ifndef _LEFT_FILES
		if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#endif
		{
			ZeroMemory(&tvItem, sizeof(tvItem));

			tvItem.mask = TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN;
			tvItem.pszText = LPSTR_TEXTCALLBACK;
			tvItem.iImage = tvItem.iSelectedImage = I_IMAGECALLBACK;
			tvItem.lParam = (LPARAM)entry;
			tvItem.cChildren = entry->_shell_attribs & SFGAO_HASSUBFOLDER? 1: 0;

			if (entry->_shell_attribs & SFGAO_SHARE) {
				tvItem.mask |= TVIF_STATE;
				tvItem.stateMask |= TVIS_OVERLAYMASK;
				tvItem.state |= INDEXTOOVERLAYMASK(1);
			}

			tvInsert.item = tvItem;
			tvInsert.hInsertAfter = TVI_LAST;
			tvInsert.hParent = hParentItem;

			TreeView_InsertItem(_left_hwnd, &tvInsert);

			++cnt;
		}
	}

	SendMessage(_left_hwnd, WM_SETREDRAW, TRUE, 0);

	return cnt;
}
Пример #10
0
/**
 * name:	HideItem
 * class:	CPsTree
 * desc:	is called if icolib's icons have changed
 * param:	iPageIndex	- the index of the treeitem in the array.
 * return:	nothing
 **/
void CPsTree::HideItem(const int iPageIndex)
{
	if (IsIndexValid(iPageIndex)) 
	{
		TreeView_DeleteItem(_hWndTree, _pItems[iPageIndex]->Hti());
		_pItems[iPageIndex]->Hti(0);
		_dwFlags |= PSTVF_STATE_CHANGED;
	}
}
Пример #11
0
void FreeTree(VARINFO *info, int page)
{
    while (info)
    {
        FreeTree(info->subtype, page);
        if (info->hTreeItem)
            TreeView_DeleteItem(hwndTree[page], info->hTreeItem);
        info = info->link;
    }
}
Пример #12
0
static void FreeTree(VARINFO *info, WATCHDATA *ptr)
{
    while (info)
    {
        FreeTree(info->subtype, ptr);
        if (info->hTreeItem)
            TreeView_DeleteItem(ptr->hwndWatchTree, info->hTreeItem);
        info = info->link;
    }
}
Пример #13
0
void
mxTreeView::remove (mxTreeViewItem *item)
{
    if (!d_this)
        return;

    if (!item)
        TreeView_DeleteAllItems (d_this->d_hwnd);
    else
        TreeView_DeleteItem (d_this->d_hwnd, (HTREEITEM) item);
}
Пример #14
0
void TffdshowPageBase::deletePage(ThtiPage *htiPage)
{
    ThtiPages::iterator p = std::find(htiPages.begin(), htiPages.end(), htiPage);
    if (p != htiPages.end()) {
        if ((*p)->hti) {
            TreeView_DeleteItem(htv, (*p)->hti);
        }
        delete *p;
        htiPages.erase(p);
    }
}
Пример #15
0
void DragTo(HTREEITEM dstItem, HTREEITEM srcItem)
{
    PROJECTITEM *srcData = GetItemInfo(srcItem);
    PROJECTITEM *dstData = GetItemInfo(dstItem);
    if (srcData && dstData && srcData->parent != dstData)
    {
        PROJECTITEM *p = dstData->parent;
        while(p)
            if (p == srcData)
                return;
            else
                p = p->parent;
        if (srcData->type == PJ_FOLDER || srcData->type == PJ_FILE)
        {
            if (dstData->type == PJ_FOLDER || dstData->type == PJ_PROJ)
            {
                PROJECTITEM **rmv = &srcData->parent->children;
                MarkChanged(srcData,FALSE);
                while (*rmv && *rmv != srcData)
                    rmv = &(*rmv)->next;
                if (*rmv)
                {
                    PROJECTITEM **ins = &dstData->children;
                    HTREEITEM pos = TVI_FIRST;
                    (*rmv) = (*rmv)->next;

                    TreeView_DeleteItem(prjTreeWindow, srcData->hTreeItem);
                    ResDeleteItem(srcData);
                    if (srcData->type == PJ_FILE)
                    {
                        while (*ins && (*ins)->type == PJ_FOLDER)
                        {
                            pos = (*ins)->hTreeItem;
                            ins = &(*ins)->next;
                        }
                    }
                    while (*ins && (*ins)->type == srcData->type && stricmp((*ins)->displayName, srcData->displayName) < 0)
                    {
                        pos = (*ins)->hTreeItem;
                        ins = &(*ins)->next;
                    }
                    srcData->parent = dstData;
                    srcData->next = NULL;
                    RecursiveCreateTree(dstData->hTreeItem, pos, srcData);
                    srcData->next = *ins;
                    *ins = srcData;
                    MarkChanged(srcData,FALSE);
                }
            }
        }
    }
}
Пример #16
0
void TreeView_ReleaseItem(HWND hctl, HTREEITEM hti, BOOL fDel)
{
	LPARAM		lparam = NULL;
	TreeView_GetItemParam(hctl, hti, lparam, LPARAM);
	if (lparam) {
		free((void*)lparam);
	}
	if (fDel) {
		TreeView_DeleteItem(hctl, hti);
	} else {
		TreeView_SetItemParam(hctl, hti, 0);
	}
	return;
}
Пример #17
0
bool NGMainWnd::onnet_directories(const string &path, const vector<string> &directories, const vector<dword> &types, const vector<dword> &childrens) {
	HTREEITEM hparent = NULL;

	// find the parent treenode in the path list
	for (dword i = 0; i < browsenodes.size(); i++) {
		if (browsenodes[i].path.compare(path) == 0) {
			hparent = browsenodes[i].hnode;
			break;
		}
	}
	if (hparent != NULL) {
		// delete previous children
		for (long i = (browsenodes.size() - 1); i >= 0; i--) {
			if (browsenodes[i].hparent == hparent) {
				TreeView_DeleteItem(this->hbrowsewnd, browsenodes[i].hnode);
				browsenodes.erase(browsenodes.begin() + i);
			}
		}

		// append new children
		for (dword i = 0; i < directories.size(); i++) {
			if (childrens[i] > 0) {
				this->client->request_bw_getdirectories(path + directories[i]);
			}

			// update tree items
			TVINSERTSTRUCT tvi;

			memset(&tvi, 0, sizeof(TVINSERTSTRUCT));
			tvi.hParent = hparent;
			tvi.hInsertAfter = TVI_LAST;
			tvi.itemex.mask = TVIF_CHILDREN | TVIF_IMAGE | TVIF_TEXT;
			if (childrens[i] > 0) {
				tvi.itemex.cChildren = 1;
			} else {
				tvi.itemex.cChildren = 0;
			}
			tvi.itemex.pszText = (LPSTR)directories[i].c_str();
			tvi.itemex.iImage = ICON_MAIN;
			this->browsenodes.push_back(PathNode(hparent, TreeView_InsertItem(this->hbrowsewnd, &tvi), path + directories[i] + "/", types[i]));
		}

		// if root, auto-expand
		if (path.compare("/") == 0) {
			TreeView_Expand(this->hbrowsewnd, hparent, TVE_EXPAND);
		}
	}
	return true;
}
Пример #18
0
void CFolderDlg::OnItemExpanded(NMTREEVIEW* lpnmtv)
{
	// 次にブランチを展開するときに改めて列挙するのでサブキーを削除する
	if (lpnmtv->action == TVE_COLLAPSE) {
		HTREEITEM hChild;
		HTREEITEM hNext;

		hChild = TreeView_GetChild (lpnmtv->hdr.hwndFrom, lpnmtv->itemNew.hItem);
		while (hChild) {
			hNext = TreeView_GetNextItem (lpnmtv->hdr.hwndFrom, hChild, TVGN_NEXT);
			TreeView_DeleteItem (lpnmtv->hdr.hwndFrom, hChild);
			hChild = hNext;
		}
	}
}
Пример #19
0
void plComponentDlg::IDeleteComponent(plMaxNode *component)
{
    if (!component)
        return;

    // Make sure this components interface isn't showing
    if (plComponentUtil::Instance().IsOpen())
        plComponentUtil::Instance().IComponentPreDelete(component->ConvertToComponent());
    
    // Delete the component from the scene
    theHold.Begin();
    fInterface->DeleteNode(component);
    theHold.Accept(_T("Delete Component"));

    // Delete the component from the tree
    HWND hTree = GetDlgItem(fhDlg, IDC_TREE);
    HTREEITEM hItem = TreeView_GetSelection(hTree);
    HTREEITEM hParent = TreeView_GetParent(hTree, hItem);
    TreeView_DeleteItem(hTree, hItem);

    // If that was the only component of this type, delete the type too
    if (!TreeView_GetChild(hTree, hParent))
    {
        HTREEITEM hCategory = TreeView_GetParent(hTree, hParent);
        TreeView_DeleteItem(hTree, hParent);

        // If this is the only type in this category, delete the category too!
        // Sadly, this is the most we can delete.
        if (!TreeView_GetChild(hTree, hCategory))
            TreeView_DeleteItem(hTree, hCategory);
    }

    // Update the rollups in case the selected object had this component attached
    if (plComponentUtil::Instance().IsOpen())
        plComponentUtil::Instance().IUpdateRollups();
}
Пример #20
0
void TreeView::removeItem(HTREEITEM hTreeItem)
{
	// Deallocate all the sub-entries recursively
	cleanSubEntries(hTreeItem);

	// Deallocate current entry
	TVITEM tvItem;
	tvItem.hItem = hTreeItem;
	tvItem.mask = TVIF_PARAM;
	SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem);
	if (tvItem.lParam)
		delete (generic_string *)(tvItem.lParam);

	// Remove the node
	TreeView_DeleteItem(_hSelf, hTreeItem);
}
Пример #21
0
/**
 *\fn           BOOL deleteSelectDir()
 *\brief        删除当前选中目录
 *\return       BOOL TRUE成功,其它失败
 */
BOOL CBrowseWnd::deleteSelectDir()
{
    char path[1024] = "";
    path_.GetWindowText(path, sizeof(path)-1);

    BOOL ret (0 == sftp_rm_dir(&ssh_param_, path));

    if (ret)
    {
        HTREEITEM item = TreeView_GetSelection(tree_.m_hWnd);

        TreeView_DeleteItem(tree_.m_hWnd, item);
    }

    return ret;
}
Пример #22
0
    bool RemNode(_Ty Key) {

        HTREEITEM hItem  = KeyToHandle(Key);

        if (NULL != hItem) {

            if (TRUE == TreeView_DeleteItem(m_hWnd, hItem)) {

                return _RemNode(hItem);

            }

        }

        return false;
    }
Пример #23
0
/**
 * Deletes the given item. Also removes the item from the items vector...
 */
void CTreeControl::deleteItem(CTreeItem* _item)
{
	LOG_S("Deleting item: ", _item->getText());
	TreeView_DeleteItem(hwnd, _item->handle);
size_t i=0;
CTreeItem* actItem = _item;
	while(i<items.size())
	{
		if(items[i] == _item)
		{
			items.erase(items.begin() + i);
			return; 
		}
		i++;
	}
}
Пример #24
0
void UpdateObjectTreeAndModules()
{
    traceIn(UpdateObjectTreeAndModules);

    if(TreeView_GetRoot(hwndObjectTree))
        TreeView_DeleteItem(hwndObjectTree, TVI_ROOT);

    AddToObjectTree(NULL, GetClass(Entity));

    SendMessage(hwndModuleList, LB_RESETCONTENT, 0, 0);
    StringList LevelModules;
    level->GetLoadedModules(LevelModules);
    for(DWORD i=0; i<LevelModules.Num(); i++)
        SendMessage(hwndModuleList, LB_ADDSTRING, 0, (LPARAM)(CTSTR)LevelModules[i]);

    traceOut;
}
Пример #25
0
BOOL findAndRemoveDuplicates(HWND hwnd2Tree, MCONTACT hContact, char *module)
	/* the following code to go through the whole tree is nicked from codeguru..
	http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?thread=7680 */
{
	TVITEM item;
	HTREEITEM lastItem, prelastItem;
	BOOL Result = 0;
	char text[265];
	if (!TreeView_GetCount(hwnd2Tree))
		return Result;

	item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
	item.hItem = TVI_ROOT;
	item.pszText = text;
	item.cchTextMax = 264;
	prelastItem = item.hItem;

	do {
		do {
			lastItem = item.hItem;
			if (lastItem != TVI_ROOT) {
				TreeView_GetItem(hwnd2Tree, &item);
				/* these next lines are not from code guru..... */
				if (item.lParam) {
					ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)item.lParam;
					if (hContact == mtis->hContact && !mir_strcmp(text,module)) {
						mir_free(mtis);
						TreeView_DeleteItem(hwnd2Tree, item.hItem);
						lastItem = prelastItem;
						Result = 1;
					}
					else
						prelastItem = lastItem;
				}
				/* back to coduguru's code*/
			}
		} while (item.hItem = TreeView_GetChild(hwnd2Tree, lastItem));

		while (!(item.hItem = TreeView_GetNextSibling(hwnd2Tree, lastItem)) && (lastItem = item.hItem = TreeView_GetParent(hwnd2Tree, lastItem))) {}

	} while ( item.hItem );
	/*****************************************************************************/

	return Result;
}
Пример #26
0
CMsgTree::CMsgTree(HWND hTreeView) : MsgTreePage(g_MsgTreePage), hTreeView(hTreeView), hDragItem(NULL), hPrevDropTarget(NULL), UpdateLock(0)
{
	CWndUserData(GetParent(hTreeView)).SetMsgTree(this);
	OrigParentProc = (WNDPROC)SetWindowLongPtr(GetParent(hTreeView), GWLP_WNDPROC, (LONG_PTR)ParentSubclassProc);
	OrigTreeViewProc = (WNDPROC)SetWindowLongPtr(hTreeView, GWLP_WNDPROC, (LONG_PTR)MsgTreeSubclassProc);
	MsgTreePage.SetWnd(GetParent(hTreeView));
	COptItem_TreeCtrl* TreeCtrl = (COptItem_TreeCtrl*)MsgTreePage.Find(IDV_MSGTREE);
	TreeCtrl->SetDlgItemID(GetDlgCtrlID(hTreeView));
	hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 2);
	ImageList_AddIcon(hImageList, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_NEWMESSAGE)));
	ImageList_AddIcon(hImageList, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_NEWCATEGORY)));
	ImageList_AddIcon(hImageList, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DELETE)));
	MsgTreePage.DBToMemToPage();
	if (!g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RECENTMSGSCOUNT)) // show "Recent messages" group only when RECENTMSGSCOUNT is not set to 0.
		TreeView_DeleteItem(hTreeView, TreeCtrl->RootItems[g_Messages_RecentRootID].hItem);

	WindowList_Add(hMTWindowList, hTreeView, NULL);
}
Пример #27
0
void replaceTreeItem(HWND hwnd, MCONTACT hContact, const char *module, const char *newModule)
{
	int hItem = findItemInTree(hwnd, hContact, (char *)module);
	HTREEITEM hParent;

	if (hItem == -1)
		return;

	hParent = TreeView_GetParent(hwnd, (HTREEITEM)hItem);

	{
		TVITEM item;
		item.mask = TVIF_PARAM;
		item.hItem = (HTREEITEM)hItem;

		if (TreeView_GetItem(hwnd, &item))
			mir_free((ModuleTreeInfoStruct *)item.lParam);
		TreeView_DeleteItem(hwnd, item.hItem);
	}

	if (hParent && newModule) {
		TVINSERTSTRUCT tvi = {0};
		ModuleTreeInfoStruct *lParam;

		tvi.hParent = hParent;
		tvi.hInsertAfter = TVI_SORT;
		tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
		tvi.item.pszText = (char *)newModule;

		lParam = (ModuleTreeInfoStruct *)mir_calloc(sizeof(ModuleTreeInfoStruct));
		lParam->hContact = hContact;
		lParam->type = KNOWN_MODULE;
		tvi.item.iImage = 1;
		tvi.item.iSelectedImage = 2;

		tvi.item.lParam = (LPARAM)lParam;

		TreeView_InsertItem(hwnd, &tvi);
	}
}
Пример #28
0
static
VOID
CleanupDeviceClasses(
    HWND hTreeView,
    PDEVCLASS_ENTRY pClassArray,
    ULONG ulClassCount)
{
    PDEVCLASS_ENTRY pClass;
    ULONG i;

    for (i = 0; i < ulClassCount; i++)
    {
        pClass = &pClassArray[i];

        if (pClass->bUsed == FALSE)
            (void)TreeView_DeleteItem(hTreeView,
                                      pClass->hItem);
        else
            (void)TreeView_SortChildren(hTreeView,
                                        pClass->hItem,
                                        0);
    }
}
Пример #29
0
static void ExpandPointer(VARINFO *v, int code, WATCHDATA *ptr)
{
    if (v->pointer)
    {
        if (code == TVE_EXPAND)
        {
            int val;
            int outofscope;
            outofscope = ((val = v->derefaddress) == -1 && !ReadValue(v->address, &val, 4, v)) || !val;
            if (!v->subtype && ptr->watchinfo_list[v->watchindex].dbg_info)
            {
                TreeView_DeleteItem(ptr->hwndWatchTree, v->hTreeHolder);
                ExpandPointerInfo(ptr->watchinfo_list[v->watchindex].dbg_info, v);
                if (v->subtype->structure)
                {
                    InsertSubTree(v->hTreeItem, 0, v->subtype->subtype, v->watchindex, ptr);
                }
                else
                    InsertSubTree(v->hTreeItem, 0, v->subtype, v->watchindex, ptr);
            }
            ptr->structNesting[ptr->nestingCount++] = v;
            RefreshAddresses(ptr, v->subtype, val, NULL, outofscope);
            ptr->nestingCount--;
            RefreshData(ptr->watchinfo_list[v->watchindex].dbg_info, v, TRUE);
        }
        else if (code == TVE_COLLAPSE)
        {
            if (v->subtype && !v->derefaddress)
            {
                FreeTree(v->subtype, ptr);
                FreeVarInfo(v->subtype);
                v->subtype = 0;
                v->hTreeHolder = InsertItem(v->hTreeItem, TVI_LAST, v, ptr);
            }
        }
    }
}
Пример #30
-2
void TffdshowPageDec::showShowHide(int previd, int prevVisId)
{
    if (previd == 0 && page) {
        previd = page->uniqueID();
    }
    if (prevVisId == 0) {
        prevVisId = hti2page(TreeView_GetFirstVisible(htv))->uniqueID();
    }
    for (ThtiPages::reverse_iterator rp = filterPages.rbegin(); rp != filterPages.rend(); rp++)
        if ((*rp)->hti) {
            TreeView_DeleteItem(htv, (*rp)->hti);
            (*rp)->hti = NULL;
            for (TconfPages::iterator i = (*rp)->begin(); i != (*rp)->end(); i++) {
                (*i)->hti = NULL;
            }
        }
    TVINSERTSTRUCT tvis;
    tvis.hParent = htiPresets;
    tvis.hInsertAfter = htiBeforeShowHide;
    tvis.item.mask = TVIF_PARAM | TVIF_TEXT;
    HTREEITEM htiLast0 = NULL;
    for (ThtiPages::const_iterator p = filterPages.begin(); p != filterPages.end(); p++)
        if ((*p)->getPage()->getShow()) {
            tvis.item.lParam = (LPARAM) * p;
            tvis.item.pszText = LPTSTR((*p)->front()->dialogName());
            tvis.item.iImage = tvis.item.iSelectedImage = 0;
            tvis.hParent = ((*p)->getPage()->filterPageID > 1) ? htiLast0 : htiPresets;
            HTREEITEM hti = TreeView_InsertItem(htv, &tvis);
            (*p)->hti = hti;
            for (TconfPages::iterator i = (*p)->begin(); i != (*p)->end(); i++) {
                (*i)->hti = hti;
            }
            if ((*p)->getPage()->filterPageID <= 1) {
                if (htiLast0) {
                    TreeView_Expand(htv, htiLast0, TVE_EXPAND);
                }
                htiLast0 = hti;
            }
        }
    if (htiLast0) {
        TreeView_Expand(htv, htiLast0, TVE_EXPAND);
    }
    sortOrder();
    if (previd) {
        treeSelectItem(previd, prevVisId);
    }
}