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


C++ COptionTreeItem::SetSibling方法代码示例

本文整理汇总了C++中COptionTreeItem::SetSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ COptionTreeItem::SetSibling方法的具体用法?C++ COptionTreeItem::SetSibling怎么用?C++ COptionTreeItem::SetSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COptionTreeItem的用法示例。


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

示例1:

COptionTreeItem * COptionTree::InsertItem(COptionTreeItem *otiItem, COptionTreeItem *otiParent)
{
	// Declare variables
	COptionTreeItem* otiNext;
	
	// Make sure item is not NULL
	if (otiItem == NULL)
	{
		return NULL;
	}

	// If parent is NULL, becomes root
	if (otiParent == NULL)
	{
		otiParent = &m_otiRoot;
	}

	// Set child
	if (otiParent->GetChild() == NULL)
	{
		otiParent->SetChild(otiItem);
	}
	else
	{
		// -- Add to end of the sibling list	
		otiNext = otiParent->GetChild();
		while (otiNext->GetSibling() != NULL)
		{
			otiNext = otiNext->GetSibling();
		}
		otiNext->SetSibling(otiItem);
	}

	// Auto generate a default ID
	m_uLastUID++;
	otiItem->SetCtrlID(m_uLastUID);

	// Set item information
	otiItem->SetParent(otiParent);
	otiItem->SetOptionsOwner(this);

	// Send notification to user
	SendNotify(OT_NOTIFY_INSERTITEM, otiItem);

	//// Updated items
	//UpdatedItems();

	//// Force redraw
	//Invalidate();

	//// Update window
	//UpdateWindow();

	return otiItem;
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:55,代码来源:OptionTree.cpp

示例2: Delete

void COptionTree::Delete(COptionTreeItem *otiItem)
{
	// Declare variables
	COptionTreeItem* otiIter;
	COptionTreeItem* otiNext;

	// Clear visible list
	ClearVisibleList();

	// Send notify to user
	SendNotify(OT_NOTIFY_DELETEITEM, otiItem);

	// Passing in a NULL deletes frm root
	if (otiItem == NULL)
	{
		otiItem = &m_otiRoot;
	}

	// Delete children
	otiIter = otiItem->GetChild();
	while (otiIter != NULL)
	{
		// -- Get sibling
		otiNext = otiIter->GetSibling();
		
		// -- Delete
		DeleteItem(otiIter);

		// -- Get next
		otiIter = otiNext;
	}

	// Unlink from tree
	if (otiItem->GetParent() != NULL)
	{
		if (otiItem->GetParent()->GetChild() == otiItem)
		{
			otiItem->GetParent()->SetChild(otiItem->GetSibling());
		}
		else
		{
			otiIter = otiItem->GetParent()->GetChild();

			while (otiIter->GetSibling() && otiIter->GetSibling() != otiItem)
			{
				otiIter = otiIter->GetSibling();
			}

			if (otiIter->GetSibling())
			{
				otiIter->SetSibling(otiItem->GetSibling());
			}
		}
	}

	// Delete item
	if (otiItem != &m_otiRoot)
	{
		if (otiItem == GetFocusedItem())
		{
			SetFocusedItem(NULL);
		}

		otiItem->CleanDestroyWindow();

		delete otiItem;
	}
}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:68,代码来源:OptionTree.cpp


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