本文整理汇总了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;
}
示例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;
}
}