本文整理汇总了C++中TreeViewItem::ChangeParent方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeViewItem::ChangeParent方法的具体用法?C++ TreeViewItem::ChangeParent怎么用?C++ TreeViewItem::ChangeParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeViewItem
的用法示例。
在下文中一共展示了TreeViewItem::ChangeParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InsertObject
virtual void InsertObject(void *root,void *userdata,void *obj,Int32 dragtype,void *dragobject,Int32 insertmode, Bool bCopy)
{
TreeView* pTree = (TreeView*)userdata;
if (dragtype == DRAGTYPE_FILES)
{
Filename* fn = (Filename*)dragobject;
if (!fn) return;
((CTreeDialog*)pTree->m_pParent)->OpenDialog(*fn);
}
if (dragtype == pTree->m_lElementType)
{
TreeViewItem* pDragItem = (TreeViewItem*)dragobject;
TreeViewItem* pDestItem = (TreeViewItem*)obj;
if (bCopy)
{
if (!pDragItem || !pDestItem) return;
CTreeDialog* pDlg = (CTreeDialog*)pTree->m_pParent;
if (!pDlg) return;
CDialogDoc* pDoc = pDlg->GetDocument();
if (!pDoc) return;
CDialogItem* pDlgItemDrag = (CDialogItem*)pDragItem->GetData()->GetVoid(TREEVIEW_DATA);
CDialogItem* pDlgItemDrop = (CDialogItem*)pDestItem->GetData()->GetVoid(TREEVIEW_DATA);
if (!pDlgItemDrag || !pDlgItemDrop) return;
pDoc->ExportMacro(GeGetPluginPath() + String("DragDrop.dmf"), pDlgItemDrag);
CDialogItem* pNewItem = pDoc->ImportMacro(GeGetPluginPath() + String("DragDrop.dmf"), pDlgItemDrop);
GeFKill(GeGetPluginPath() + String("DragDrop.dmf"));
if (pNewItem)
{
TreeViewItem* pNewTreeItem = pNewItem->m_pTreeViewItem;
switch (insertmode)
{
case INSERT_BEFORE: pNewTreeItem->ChangeParent(pDestItem->GetParent(), pDestItem, nullptr); break;
case INSERT_UNDER: pNewTreeItem->ChangeParent(pDestItem, nullptr, nullptr); Open(root, userdata, obj, true); break;
default: pNewTreeItem->ChangeParent(pDestItem->GetParent(), nullptr, pDestItem); break;
}
Select(root, userdata, pNewTreeItem, SELECTION_NEW);
}
}
else
{
switch (insertmode)
{
case INSERT_BEFORE: pDragItem->ChangeParent(pDestItem->GetParent(), pDestItem, nullptr); break;
case INSERT_UNDER: pDragItem->ChangeParent(pDestItem, nullptr, nullptr); Open(root, userdata, obj, true); break;
default: pDragItem->ChangeParent(pDestItem->GetParent(), nullptr, pDestItem); break;
}
}
BaseContainer bc;
bc.SetInt32(TREEVIEW_MESSAGE_TYPE, TREEVIEW_STRUCTURE_CHANGE);
pTree->m_pParent->Command(pTree->m_lTreeID, bc);
pTree->m_pTree->Refresh();
}
}