defaulttreemodel.cpp

来自「这是VCF框架的代码」· C++ 代码 · 共 161 行

CPP
161
字号
//DefaultTreeModel.cpp/*Copyright 2000-2004 The VCF Project.Please see License.txt in the top level directorywhere you installed the VCF.*/#include "vcf/ApplicationKit/ApplicationKit.h"#include "vcf/ApplicationKit/DefaultTreeModel.h"using namespace VCF;DefaultTreeModel::DefaultTreeModel(){}DefaultTreeModel::~DefaultTreeModel(){}void DefaultTreeModel::init(){}void DefaultTreeModel::onItemPaint( ItemEvent* event ){}void DefaultTreeModel::onItemChanged( ItemEvent* event ){}void DefaultTreeModel::onItemSelected( ItemEvent* event ){}void DefaultTreeModel::onItemAdded( ItemEvent* event ){}void DefaultTreeModel::onItemDeleted( ItemEvent* event ){}void DefaultTreeModel::insertNodeItem(TreeItem * node, TreeItem * nodeToInsertAfter){	TreeItem* parent = nodeToInsertAfter->getParent();	if ( NULL != parent ) {		parent->insertChild( nodeToInsertAfter->getIndex(), node );		TreeModelEvent event(dynamic_cast<Object*>(this), node, TreeModel::TREEITEM_ADDED );		NodeAdded.fireEvent( &event );	}	else {		//bad call throw exception	}}void DefaultTreeModel::deleteNodeItem(TreeItem * nodeToDelete){	TreeItem* parent = nodeToDelete->getParent();	TreeModelEvent event(dynamic_cast<Object*>(this), nodeToDelete, TreeModel::TREEITEM_DELETED );	NodeDeleted.fireEvent( &event );	if ( NULL != parent ){		parent->deleteChild( nodeToDelete );	}	else {		std::vector<TreeItem*>::iterator found = std::find( rootNodes_.begin(), rootNodes_.end(), nodeToDelete );		if ( found != rootNodes_.end() ) {			TreeItem* item = *found;			rootNodes_.erase( found );						delete item;			item = NULL;		}	}}void DefaultTreeModel::addNodeItem( TreeItem * node, TreeItem * nodeParent ){	node->setModel( dynamic_cast<Model*>(this) );	if ( NULL == nodeParent ){		rootNodes_.push_back( node );		TreeModelEvent event(dynamic_cast<Object*>(this), node, TreeModel::TREEITEM_ADDED );		RootNodeChanged.fireEvent( &event );	}	else {		nodeParent->addChild( node );	}	TreeModelEvent event(dynamic_cast<Object*>(this), node, TreeModel::TREEITEM_ADDED );	NodeAdded.fireEvent( &event );}/***CVS Log info*$Log$*Revision 1.3  2004/12/01 04:31:21  ddiego*merged over devmain-0-6-6 code. Marcello did a kick ass job*of fixing a nasty bug (1074768VCF application slows down modal dialogs.)*that he found. Many, many thanks for this Marcello.**Revision 1.2.2.1  2004/10/05 03:15:23  kiklop74*Additional changes in tree model**Revision 1.2  2004/08/07 02:49:07  ddiego*merged in the devmain-0-6-5 branch to stable**Revision 1.1.2.2  2004/04/29 03:43:13  marcelloptr*reformatting of source files: macros and csvlog and copyright sections**Revision 1.1.2.1  2004/04/28 00:28:16  ddiego*migration towards new directory structure**Revision 1.10  2003/05/17 20:37:48  ddiego*this is the checkin for the 0.6.1 release - represents the merge over from*the devmain-0-6-0 branch plus a few minor bug fixes**Revision 1.9.2.1  2003/03/23 03:24:00  marcelloptr*3 empty lines at the end of the files**Revision 1.9  2003/02/26 04:30:56  ddiego*merge of code in the devmain-0-5-9 branch into the current tree.*most additions are in the area of the current linux port, but the major*addition to this release is the addition of a Condition class (currently*still under development) and the change over to using the Delegate class*exclusively from the older event handler macros.**Revision 1.8.14.1  2003/01/08 00:19:59  marcelloptr*mispellings and newlines at the end of all source files**Revision 1.8  2002/05/09 03:10:45  ddiego*merged over code from development branch devmain-0-5-1a into the main CVS trunk**Revision 1.7.4.2  2002/04/27 15:52:47  ddiego*Changed a bunch of files include and made it a bit faster and added better include*guards in the common headers**Revision 1.7.4.1  2002/04/08 20:55:31  zzack*changed include style**Revision 1.7  2002/01/24 01:46:50  ddiego*added a cvs "log" comment to the top of all files in vcf/src and vcf/include*to facilitate change tracking**/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?