本文整理汇总了C++中SimSet::removeObject方法的典型用法代码示例。如果您正苦于以下问题:C++ SimSet::removeObject方法的具体用法?C++ SimSet::removeObject怎么用?C++ SimSet::removeObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimSet
的用法示例。
在下文中一共展示了SimSet::removeObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleItemRemoveFromFolder
bool SimTreeView::handleItemRemoveFromFolder( HTREEITEM hFolder, HTREEITEM hItem )
{
lockManager();
SimSet *parent = (SimSet*)getObject( hFolder );
SimObject *obj = getObject(hItem);
parent->removeObject( obj );
state.set(STV_MODIFIED);
unlockManager();
return ( true ); // true indicates we want item removed from TreeList
}
示例2: onCommand
void SimTreeView::onCommand( int id, HWND hwndCtl, UINT codeNotify )
{
hwndCtl, codeNotify;
SimObject *obj;
SimSet *prnt;
lockManager();
switch( id )
{
case IDM_EXIT:
destroyWindow();
break;
case IDM_CUT:
if ( (obj = getSelectedObject()) != NULL )
{
// persist selected object
obj->fileStore( "temp\\clip.tmp" );
// remove it from parent
obj->deleteObject();
delItem( getSelection() );
state.set(STV_MODIFIED);
}
break;
case IDM_COPY:
if ( (obj = getSelectedObject()) != NULL )
obj->fileStore( "temp\\clip.tmp" );
break;
case IDM_PASTE:
{
// unpersist object to get a duplicate
Persistent::Base::Error err;
obj = (SimObject*)Persistent::Base::fileLoad( "temp\\clip.tmp", &err );
if ( err != Ok )
return;
// add to simTree
HTREEITEM hParent = getSelection();
if ( !isItemFolder(hParent) )
hParent = getParent( hParent );
prnt = (SimSet*)getObject( hParent );
prnt->getManager()->addObject( obj );
prnt->addObject(obj);
HTREEITEM hItem = addSet( obj, hParent );
selectItem( hItem );
state.set(STV_MODIFIED);
}
break;
case IDM_DELETE:
obj = getSelectedObject();
if ( obj )
{
obj->deleteObject();
delItem( getSelection() );
state.set(STV_MODIFIED);
}
break;
case IDM_REMOVE:
obj = getSelectedObject();
if ( obj )
{
prnt = getSelectedParent();
prnt->removeObject(obj);
delItem( getSelection() );
state.set(STV_MODIFIED);
}
break;
case IDM_DUPLICATE:
{
obj = getSelectedObject();
// persist object to get a duplicate
if ( obj->fileStore( "temp\\clip.tmp" ) != Ok )
{
unlockManager();
return;
}
Persistent::Base::Error err;
obj = (SimObject*)Persistent::Base::fileLoad( "temp\\clip.tmp", &err );
if ( err != Ok )
{
unlockManager();
return;
}
// perhaps delete clip.tmp to clean up directory
HTREEITEM hParent = getSelection();
if ( !isItemFolder(hParent) )
hParent = getParent( hParent );
prnt = (SimSet*)getObject( hParent );
prnt->getManager()->addObject( obj );
//.........这里部分代码省略.........