예제 #1
0
void CDesertConfigDialog::checkSiblings_check(HTREEITEM &item)
{
	if(item==m_cfgTreeRootItem) return;
	HTREEITEM hparentItem = m_cfgtree.GetParentItem(item);
	std::string parentitemType = dhelper_ptr->getElementType(cfgTreeMap[hparentItem]);

	if(parentitemType=="Compound") return;

	HTREEITEM hItem = m_cfgtree.GetPrevSiblingItem(item);
	while (hItem != NULL)
	{
		uncheckItem(hItem);
		hItem = m_cfgtree.GetPrevSiblingItem(hItem);
	}

	hItem = m_cfgtree.GetNextSiblingItem(item);
	while (hItem != NULL)
	{
		uncheckItem(hItem);
		hItem = m_cfgtree.GetNextSiblingItem(hItem);
	}
}
예제 #2
0
void CDesertConfigDialog::uncheckItem(HTREEITEM &item)
{
	m_cfgtree.SetCheck(item, 0);
	if (m_cfgtree.ItemHasChildren(item))
	{
		HTREEITEM hNextItem;
		HTREEITEM hChildItem = m_cfgtree.GetChildItem(item);
		while (hChildItem != NULL)
		{
			uncheckItem(hChildItem);
			hNextItem = m_cfgtree.GetNextItem(hChildItem, TVGN_NEXT);
			hChildItem = hNextItem;
		}
	}
}
LRESULT CDesertConfigDialog::OnTreeViewCheckStateChange(WPARAM wParam, LPARAM lParam) 
{ 
	// Handle message here… 
	for(map<HTREEITEM, int>::iterator i=cfgTreeMap.begin();i!=cfgTreeMap.end();++i)
	{
		HTREEITEM node = (*i).first;
		m_cfgtree.SetItemState(node,0, TVIS_BOLD); 
	}
	
	HTREEITEM  changedItem = (HTREEITEM)lParam; 
	bool check=true;
	if(m_cfgtree.GetCheck(changedItem))
		checkItem(changedItem);
	else
	{
		uncheckItem(changedItem);
		check=false;
	}

	set<int> cfgIds;
	for(long i=0;i<cfgSize;++i)
		cfgIds.insert(i);
	noneChecked = false;
	/*if(!noneChecked) 
		cfgIds.clear();
	updateConfigList(cfgIds);
	updateSize(cfgIds.size());*/

	set<int> valid_ids = computeConfigList(m_cfgTreeRootItem, cfgIds);
	if(!noneChecked) 
		 valid_ids.clear();
	updateConfigList( valid_ids, check);
	int cnt = m_cfglist.GetItemCount();
	int checked=0;
	for(int i=0;i<cnt;++i)
	{
		if(m_cfglist.GetCheck(i))
			checked++;
	}
	updateSize( checked);

	return 0;
}