Пример #1
0
Data::OsgNode::OsgNode( qlonglong id, QString name, Data::Type* type, Data::Graph* graph, float scaling, osg::Vec3f position )
	:DbNode( id,name,type,graph,scaling )
{
	this->mTargetPosition = position;
	this->currentPosition = position * Util::ApplicationConfig::get()->getValue( "Viewer.Display.NodeDistanceScale" ).toFloat();

	this->setBall( NULL );
	this->setParentBall( NULL );


	insertChild( INDEX_LABEL, createLabel( this->type->getScale(), labelText ) , false );
	insertChild( INDEX_SQUARE, createNodeSquare( this->scale, OsgNode::createStateSet( this->type ) ) , false );
	insertChild( INDEX_SPHERE, createNodeSphere( this->scale, OsgNode::createStateSet( this->type ) ), false );
	setValue( graph->getNodeVisual(), true );

	this->square = createNode( this->scale * 4, OsgNode::createStateSet( this->type ) );
	this->focusedSquare = createNode( this->scale * 16, OsgNode::createStateSet( this->type ) );
//    this->label = createLabel( this->type->getScale(), labelText );
	this->force = osg::Vec3f();
	this->velocity = osg::Vec3f( 0,0,0 );
	this->selected = false;

	this->usingInterpolation = true;

	//nastavenie farebneho typu
	float r = type->getSettings()->value( "color.R" ).toFloat();
	float g = type->getSettings()->value( "color.G" ).toFloat();
	float b = type->getSettings()->value( "color.B" ).toFloat();
	float a = type->getSettings()->value( "color.A" ).toFloat();

	this->colorOfNode=osg::Vec4( r, g, b, a );
	this->setColor( colorOfNode );

	setScale( type->getSettings()->value( "scale" ).toFloat() );
}
void insertWidget(WIDGET *widget, WIDGET *father){
	WIDGET_DESC *father_desc;
	if(father)
		insertChild(&widgetList[father->id], &widgetList[widget->id]);
	else if((father_desc = findContainerWidget(widget)))
		insertChild(father_desc, &widgetList[widget->id]);
}
Пример #3
0
//-----------------------------------------------------------------
int GABot::loadTeamFromFile( QString Filename, int TeamNumber )
{
	int Err=0;

	TeamData data;
	if (TeamNumber == 0) {
		TeamA = data.readTeamData(Filename);
		if (TeamA) {
			Err = 1;
			insertChild(TeamA);
			connect( TeamA, SIGNAL(botMove(Coordinate,Coordinate)),
			         this,  SLOT(slotBotMoveA(Coordinate,Coordinate)));
			connect( TeamA, SIGNAL(botDirection(Coordinate,Direction)),
			         this,  SLOT(slotBotDirectionA(Coordinate,Direction)));
		}
	} else if (TeamNumber == 1) {
		TeamB = data.readTeamData(Filename);
		if (TeamB) {
			Err = 1;
			insertChild(TeamB);
			connect( TeamB, SIGNAL(botMove(Coordinate,Coordinate)),
			         this,  SLOT(slotBotMoveB(Coordinate,Coordinate)));
			connect( TeamB, SIGNAL(botDirection(Coordinate,Direction)),
			         this,  SLOT(slotBotDirectionB(Coordinate,Direction)));
		}
	}

	if (TeamA && TeamB) {
		prepareGame();
		emit(gameReady(TRUE));
	}

	return Err;

}
Пример #4
0
int test_outChild(void) {
    int success = 1;
    pcb_t *p1, *p2, *p3, *p4, *p5;

    initProc();
    p1 = allocPcb();
    p2 = allocPcb();
    p3 = allocPcb();
    p4 = allocPcb();
    p5 = allocPcb();

    success &= outChild(NULL) == NULL;
    success &= outChild(p1) == NULL;

    insertChild(p1, p2);
    insertChild(p1, p3);
    insertChild(p3, p4);
    insertChild(p1, p5);

    success &= outChild(p3) == p3;
    success &= emptyChild(p3);
    success &= getPSib(p5) == p2;
    success &= getPSib(p2) == NULL;

    success &= outChild(p5) == p5;
    success &= getPChild(p1) == p2;
    success &= getPSib(p2) == NULL;

    return success;
}
Пример #5
0
Data::Node::Node( qlonglong id, QString name, Data::Type* type, float scaling, Data::Graph* graph, osg::Vec3f position )
	: OsgNode( id, name, type, graph, scaling, position )
{
	//konstruktor
	this->mIsFocused = false;
	this->edges = new QMap<qlonglong, osg::ref_ptr<Data::Edge> >;
	this->cluster = NULL;
	// Duransky start - Pociatocne nastavenie roznych cisiel vertigo rovin pre uzly
	this->numberOfVertigoPlane = id;
	// Duransky end - Pociatocne nastavenie roznych cisiel vertigo rovin pre uzly

	settings = new QMap<QString, QString>();
	//APA

	settings->insert( "Velkost","4242" );
	settings->insert( "Farba","ruzova" );
	//APA

	int pos = 0;
	int cnt = 0;

	labelText = this->name;

	while ( ( pos = labelText.indexOf( QString( " " ), pos + 1 ) ) != -1 ) {
		if ( ++cnt % 3 == 0 ) {
			labelText = labelText.replace( pos, 1, "\n" );
		}
	}

	insertChild( INDEX_LABEL, createLabel( this->type->getScale(), labelText ) , false );
	insertChild( INDEX_SQUARE, createNodeSquare( this->scale, Node::createStateSet( this->type ) ) , false );
	insertChild( INDEX_SPHERE, createNodeSphere( this->scale, Node::createStateSet( this->type ) ), false );
	setValue( graph->getNodeVisual(), true );

	this->force = osg::Vec3f();
	this->velocity = osg::Vec3f( 0,0,0 );
	this->fixed = false;
	this->positionCanBeRestricted = true;
	this->removableByUser = true;
	this->selected = false;
	this->usingInterpolation = true;

	//nastavenie farebneho typu
	float r = type->getSettings()->value( "color.R" ).toFloat();
	float g = type->getSettings()->value( "color.G" ).toFloat();
	float b = type->getSettings()->value( "color.B" ).toFloat();
	float a = type->getSettings()->value( "color.A" ).toFloat();

	this->color=osg::Vec4( r, g, b, a );
	this->setDrawableColor( 0, color );

	// merging Britvik: this was here
	//setDefaultColor();

	//volovar_zac
	layerID = 0;  //node is not on layer of radial layout
	radialLayout = NULL;  //node does not belong to radial layout
	//volovar_kon
}
void StatusRootAction::childInserted( int i, Kopete::Status::StatusItem* child )
{
	Status::StatusItem* before = d->group->child( i + 1 );
	if ( before )
		insertChild( d->childMap.value( before, 0 ), child );
	else
		insertChild( 0, child );
}
Пример #7
0
SceneItem::SceneItem(
    EntityEditorContext&    editor_context,
    Scene&                  scene)
  : BaseGroupItem(editor_context, g_class_uid, "Scene", scene)
{
    set_allow_deletion(false);
    set_allow_edition(false);

    QFont font;
    font.setBold(true);
    setFont(0, font);

    int child_index = 0;
    insertChild(
        child_index++,
        m_camera_collection_item =
            new MultiModelCollectionItem<Camera, Scene, SceneItem>(
                editor_context,
                new_guid(),
                EntityTraits<Camera>::get_human_readable_collection_type_name(),
                scene,
                this));
    m_camera_collection_item->add_items(scene.cameras());

    insertChild(
        child_index++,
        m_environment_item =
            new EnvironmentItem(
                editor_context,
                scene.get_environment(),
                scene,
                this));
    m_environment_item->set_allow_deletion(false);
    m_environment_item->set_fixed_position(true);
    editor_context.m_item_registry.insert(*scene.get_environment(), m_environment_item);

    insertChild(
        child_index++,
        m_environment_edf_collection_item =
            new MultiModelCollectionItem<EnvironmentEDF, Scene, SceneItem>(
                editor_context,
                new_guid(),
                EntityTraits<EnvironmentEDF>::get_human_readable_collection_type_name(),
                scene,
                this));
    m_environment_edf_collection_item->add_items(scene.environment_edfs());

    insertChild(
        child_index++,
        m_environment_shader_collection_item =
            new MultiModelCollectionItem<EnvironmentShader, Scene, SceneItem>(
                editor_context,
                new_guid(),
                EntityTraits<EnvironmentShader>::get_human_readable_collection_type_name(),
                scene,
                this));
    m_environment_shader_collection_item->add_items(scene.environment_shaders());
}
Пример #8
0
void MetaEditor::selectElement()
{
    QStringList codes;
    {
         AddMetadata addelement(GetElementMap(), this);
         if (addelement.exec() == QDialog::Accepted) {
            codes = addelement.GetSelectedEntries();
         }
    }
    foreach(QString code, codes) {
        if (code == "dc:language") {
            QStringList langcodes;
            AddMetadata addvalue(Language::instance()->GetLangMap(), this);
            if (addvalue.exec() == QDialog::Accepted) {
                 langcodes = addvalue.GetSelectedEntries();
            }
            QString lang = "en";
            if (!langcodes.isEmpty()) {
                lang = langcodes.at(0);
            }
            insertRow(code, lang);
        } else if (code == "dc:identifier-isbn") {
            QString content = "urn:isbn:[No data]";
            code = "dc:identifier";
            insertRow(code, content);
        } else if (code == "dc:identifier-issn") {
            QString content = "urn:issn:[No data]";
            code = "dc:identifier";
            insertRow(code, content);
        } else if (code == "dc:identifier-doi") {
            QString content = "urn:doi:[No data]";
            code = "dc:identifier";
            insertRow(code, content);
        } else if (code == "dc:identifier-uuid") {
            QString content = "urn:uuid:[No data]";
            code = "dc:identifier";
            insertRow(code, content);
        } else if ((code == "dc:date") || (code == "dcterms:issued") || (code == "dcterms:created")) {
            QString content = QDate::currentDate().toString(Qt::ISODate);
            insertRow(code, content);
        } else if (code == "dc:type") {
            QString content = "[dictionary,index]";
            insertRow(code, content);
        } else if (code == "dc:creator-aut") {
            code = "dc:creator";
            insertRow(code);
            insertChild(QString("role"),QString("aut"));
            insertChild(QString("scheme"),QString("marc:relators"));
        } else {
            insertRow(code);
        }
    }
}
Пример #9
0
SceneItem::SceneItem(
    Scene&          scene,
    ProjectBuilder& project_builder,
    ParamArray&     settings)
  : BaseGroupItem(g_class_uid, "Scene", scene, project_builder, settings)
{
    set_allow_deletion(false);
    set_allow_edition(false);

    insertChild(
        0,
        m_camera_item =
            new CameraItem(
                scene.get_camera(),
                scene,
                project_builder));
    m_camera_item->set_allow_deletion(false);
    m_camera_item->set_fixed_position(true);

    insertChild(
        1,
        m_environment_item =
            new EnvironmentItem(
                scene.get_environment(),
                scene,
                project_builder));
    m_environment_item->set_allow_deletion(false);
    m_environment_item->set_fixed_position(true);

    insertChild(
        2,
        m_environment_edf_collection_item =
            new MultiModelCollectionItem<EnvironmentEDF, Scene, SceneItem>(
                new_guid(),
                EntityTraits<EnvironmentEDF>::get_human_readable_collection_type_name(),
                scene,
                this,
                project_builder));
    m_environment_edf_collection_item->add_items(scene.environment_edfs());

    insertChild(
        3,
        m_environment_shader_collection_item =
            new MultiModelCollectionItem<EnvironmentShader, Scene, SceneItem>(
                new_guid(),
                EntityTraits<EnvironmentShader>::get_human_readable_collection_type_name(),
                scene,
                this,
                project_builder));
    m_environment_shader_collection_item->add_items(scene.environment_shaders());
}
Пример #10
0
void ClusterTree::sameDepth(const ClusterTree * other) {
    if(other->isLeaf() || data.size() == 0)
        return;

    if(isLeaf()) {
        insertChild(0, new ClusterTree(*this));
        insertChild(1, slice(data.offset() + data.size(), 0));
    }

    for(int i = 0; i < other->nrChild(); i++) {
        for(int j = 0; j < nrChild(); j++) {
            getChild(j)->sameDepth(other->getChild(i));
        }
    }
}
Пример #11
0
ZFindDlg::ZFindDlg(ZMultiLineEdit * e, QWidget *parent, const char *name)
	:QDialog(parent, name, true, 0)
{
	edit_p = e;

	lineEdit = new ZLineEdit(this);
	lineEdit->setFixedWidth(SCREEN_WIDTH);
	insertChild(lineEdit);
	
	softKey = new ZSoftKey(NULL, this, this);
	
	softKey->setGeometry( ZGlobal::getCstR() );
	
	softKey->setGeometry( 0, lineEdit->height(), SCREEN_WIDTH, softKey->height());
	setGeometry(0,SCREEN_HEIGHT-(lineEdit->height()+softKey->height()), SCREEN_WIDTH, (lineEdit->height()+softKey->height())); 

	softKey->setText ( ZSoftKey::LEFT, lng->getString("FIND"), ( ZSoftKey::TEXT_PRIORITY ) 0 );
	softKey->setText ( ZSoftKey::RIGHT, lng->getString("CANCEL"), ( ZSoftKey::TEXT_PRIORITY ) 0 );
	softKey->setClickedSlot ( ZSoftKey::LEFT, this, SLOT ( nextFind() ) );
	softKey->setClickedSlot ( ZSoftKey::RIGHT, this, SLOT ( accept() ) );
	
	connect(lineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( newFind( const QString & ) ) );
	
	//
	oldText = "";
	oldP = 0;
}
Пример #12
0
void wyNode::addChild(wyNode* child, int z, int tag) {
    // check child
    if(child == NULL) {
        LOGW("Can't add a NULL child");
        return;
    }

    // check parent
    if(child->getParent() != NULL) {
        LOGW("The child(%s, %d) is already attached to another parent(%s, %d), skip addChild",
             child->getClassName(), child, child->getParent()->getClassName(), child->getParent());
        return;
    }

    // if child list is locked, means something is happening
    if(m_children->locked || m_childrenChanging)
        return;
    m_childrenChanging = true;

    // insert and execute onEnter if running
    insertChild(child, z);
    wyObjectRetain(child);
    child->m_tag = tag;

    // callback, child has a chance to do something
    child->onAttachToParent(this);

    // enter if running
    if(m_running) {
        child->onEnter();
    }

    m_childrenChanging = false;
}
// override addChild:
void ParticleBatchNode::addChild(Node * aChild, int zOrder, int tag)
{
    CCASSERT( aChild != nullptr, "Argument must be non-nullptr");
    CCASSERT( dynamic_cast<ParticleSystem*>(aChild) != nullptr, "CCParticleBatchNode only supports QuadParticleSystems as children");
    ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
    CCASSERT( child->getTexture()->getName() == _textureAtlas->getTexture()->getName(), "CCParticleSystem is not using the same texture id");
    // If this is the 1st children, then copy blending function
    if (_children.empty())
    {
        setBlendFunc(child->getBlendFunc());
    }

    CCASSERT( _blendFunc.src  == child->getBlendFunc().src && _blendFunc.dst  == child->getBlendFunc().dst, "Can't add a ParticleSystem that uses a different blending function");

    //no lazy sorting, so don't call super addChild, call helper instead
    auto pos = addChildHelper(child,zOrder,tag);

    //get new atlasIndex
    int atlasIndex = 0;

    if (pos != 0)
    {
        ParticleSystem* p = static_cast<ParticleSystem*>(_children.at(pos-1));
        atlasIndex = p->getAtlasIndex() + p->getTotalParticles();
    }
    else
    {
        atlasIndex = 0;
    }

    insertChild(child, atlasIndex);

    // update quad info
    child->setBatchNode(this);
}
CitySelectDlg::CitySelectDlg(QString str1,QString str2,QString str3):ZPopup()
{
    setTitle(str1);
    listBox = new ZListBox("%I%M",this);
    
    // insert menu items with images from SysRegistry
    ZConfig config ( getAppDir() + "cities.ini", false );
    QStringList grouplist;
    config.getGroupsKeyList ( grouplist );
    QString cityCode = "";
    
    for ( QStringList::Iterator it = grouplist.begin(); it != grouplist.end(); ++it ) 
    {
        cityCode = config.readEntry(*it, "Code", "");
        City *city = new City(listBox);
        qDebug(*it);
        qDebug(cityCode);
        city->setName(*it);
        city->setCode(cityCode);
        
        listBox->insertItem(city);
        city->appendSubItem(1,ctr(city->getName()));
        
    }
    
    insertChild(listBox);
    setSoftkeyText(str2,str3);
    connect(this,SIGNAL(leftSoftkeyClicked()),this,SLOT(slotSelected()));
    connect(listBox,SIGNAL(returnPressed(ZSettingItem *)),this,SLOT(slotItemClicked(ZSettingItem *)));
    
}
void YogaLayoutableShadowNode::appendChild(SharedYogaLayoutableShadowNode child) {
  ensureUnsealed();

  auto nonConstYogaNode = std::const_pointer_cast<YGNode>(yogaNode_);
  auto nonConstChildYogaNode = std::const_pointer_cast<YGNode>(child->yogaNode_);
  nonConstYogaNode->insertChild(nonConstChildYogaNode.get(), nonConstYogaNode->getChildrenCount());
}
Пример #16
0
void analyzeTerm(tree t, char *string, int tree_number){
	int p = findParenthesis(string);
	bool upper = upperCase(string[0]);
	tree child;
	int i;
	
	//capitalized function name
	if(p != -1 && upper)
		analyzePredicate(t, string, tree_number);
	
	//constant name or lowercase variable name
	else{
		//insert on the array if it is a variable
		if(isVariable(string)){
			//variables of second clause starts with ends with 2c
			if(tree_number == 1)
				strcat(string, "2c");
			
			i = findVar(string);
			
			//add to the variables array
			if(i == -1){
				strcpy(variables[n_vars].string, string);
				variables[n_vars].t = NULL;
				n_vars++;
			}
		}
		
		//insert on the tree
		insertChild(t, string, strlen(string), false);
	}
}
Пример #17
0
void PMXMLParser::parseChildObjects( QDomElement& e, PMObject* parent )
{
   QDomNode c = e.firstChild( );
   while( !c.isNull( ) )
   {
      if( c.isElement( ) )
      {
         QDomElement ce = c.toElement( );
         PMPrototypeManager* m = m_pPart->prototypeManager( );
         PMObject* obj = m->newObject( m->className( ce.tagName( ) ) );
         if( obj )
         {
            PMXMLHelper hlp( ce, m_pPart, this,
                             m_majorDocumentFormat, m_minorDocumentFormat );
            obj->readAttributes( hlp );
            if( insertChild( obj, parent ) )
            {
               parseChildObjects( ce, obj );

               if( obj->isA( "Declare" ) )
                  checkID( ( PMDeclare* ) obj );
            }
            else
               delete obj;
         }
         else if( ce.tagName( ) != "extra_data" )
            printError( i18n( "Unknown object %1" ).arg( ce.tagName( ) ) );
      }
      c = c.nextSibling( );
   }
}
void ParticleBatchNode::addChildByTagOrName(ParticleSystem* child, int zOrder, int tag, const std::string &name, bool setTag)
{
    // If this is the 1st children, then copy blending function
    if (_children.empty())
    {
        setBlendFunc(child->getBlendFunc());
    }
    
    CCASSERT( _blendFunc.src  == child->getBlendFunc().src && _blendFunc.dst  == child->getBlendFunc().dst, "Can't add a ParticleSystem that uses a different blending function");
    
    //no lazy sorting, so don't call super addChild, call helper instead
    int pos = 0;
    if (setTag)
        pos = addChildHelper(child, zOrder, tag, "", true);
    else
        pos = addChildHelper(child, zOrder, 0, name, false);
    
    //get new atlasIndex
    int atlasIndex = 0;
    
    if (pos != 0)
    {
        ParticleSystem* p = static_cast<ParticleSystem*>(_children.at(pos-1));
        atlasIndex = p->getAtlasIndex() + p->getTotalParticles();
    }
    else
    {
        atlasIndex = 0;
    }
    
    insertChild(child, atlasIndex);
    
    // update quad info
    child->setBatchNode(this);
}
Пример #19
0
void Directory::update( void )
{
	if( !isExpanded() )
	{
		setIcon( 0, *s_folderPixmap );
		return;
	}

	setIcon( 0, *s_folderOpenedPixmap );
	if( !childCount() )
	{
		for( QStringList::iterator it = m_directories.begin();
					it != m_directories.end(); ++it )
		{
			int top_index = childCount();
			if( addItems( fullName( *it ) ) &&
				( *it ).contains(
					ConfigManager::inst()->dataDir() ) )
			{
				QTreeWidgetItem * sep = new QTreeWidgetItem;
				sep->setText( 0,
					FileBrowserTreeWidget::tr(
						"--- Factory files ---" ) );
				sep->setIcon( 0, embed::getIconPixmap(
							"factory_files" ) );
				insertChild( top_index, sep );
			}
		}
	}
}
Пример #20
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    setupUi(this);

    QStringList headers;
    headers << tr("Title") << tr("Description");

    QFile file(":/default.txt");
    file.open(QIODevice::ReadOnly);
    TreeModel *model = new TreeModel(headers, file.readAll());
    file.close();

    view->setModel(model);
    for (int column = 0; column < model->columnCount(); ++column)
        view->resizeColumnToContents(column);

    connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    connect(view->selectionModel(),
            SIGNAL(selectionChanged(const QItemSelection &,
                                    const QItemSelection &)),
            this, SLOT(updateActions()));

    connect(actionsMenu, SIGNAL(aboutToShow()), this, SLOT(updateActions()));
    connect(insertRowAction, SIGNAL(triggered()), this, SLOT(insertRow()));
    connect(insertColumnAction, SIGNAL(triggered()), this, SLOT(insertColumn()));
    connect(removeRowAction, SIGNAL(triggered()), this, SLOT(removeRow()));
    connect(removeColumnAction, SIGNAL(triggered()), this, SLOT(removeColumn()));
    connect(insertChildAction, SIGNAL(triggered()), this, SLOT(insertChild()));

    updateActions();
}
Пример #21
0
void QgsLegendLayer::changeSymbologySettings( const QgsMapLayer* theMapLayer,
    const SymbologyList& newSymbologyItems )
{
  if ( !theMapLayer )
  {
    return;
  }

  QgsLegendSymbologyItem* theSymbologyItem = 0;

  //remove the symbology items under the legend layer
  for ( int i = childCount(); i >= 0; --i )
  {
    theSymbologyItem = dynamic_cast<QgsLegendSymbologyItem *>( child( i ) );
    if ( theSymbologyItem )
    {
      delete takeChild( i );
    }
  }

  //add the new symbology items
  int childposition = 0; //position to insert the items
  for ( SymbologyList::const_iterator it = newSymbologyItems.begin(); it != newSymbologyItems.end(); ++it )
  {
    QgsLegendSymbologyItem* theItem = new QgsLegendSymbologyItem( it->second.width(), it->second.height() );
    theItem->setText( 0, it->first );
    theItem->setIcon( 0, QIcon( it->second ) );
    insertChild( childposition, theItem );

    ++childposition;
  }

}
Пример #22
0
TEST(KmerNodeTest, Children) {
  auto n1 = make_shared<KmerNode>("ACGT", 43);
  auto n2 = make_shared<KmerNode>("TGCA", 26);
  int d = n1->distance(n2->getName());
  n1->insertChild(d, n2);
  auto n2r = n1->getChild(d);
  EXPECT_EQ(n2r->getName(), n2->getName());
}
Пример #23
0
void UContainerTag::addExec()
{
    UArgHook* item=new UArgHook;
    item->setIcon(0,QIcon(":/images/algorithm/command.png"));
    item->setTagName("execute");
    item->setIndependent(true);
    insertChild(0,item);
}
Пример #24
0
void UContainerTag::addContinue()
{
    UStaticTag* item=new UStaticTag("break");
    item->setIcon(QIcon(":/images/algorithm/continue.png"));
    item->setText("continue");
    item->setIndependent(true);
    insertChild(0,item);
}
Пример #25
0
void UContainerTag::addReturn()
{
    UArgHook* item=new UArgHook;
    item->setIcon(0,QIcon(":/images/algorithm/return.png"));
    item->setTagName("return");
    item->setIndependent(true);
    insertChild(0,item);
}
void SearchResultTreeItem::insertChild(int index, const SearchResultItem &item)
{
    SearchResultTreeItem *child = new SearchResultTreeItem(item, this);
    if (isUserCheckable()) {
        child->setIsUserCheckable(true);
        child->setCheckState(Qt::Checked);
    }
    insertChild(index, child);
}
Пример #27
0
void DivNode::insertChildAfter(NodePtr pNewNode, NodePtr pOldChild)
{
    if (!pOldChild) {
        throw Exception(AVG_ERR_NO_NODE,
                getID()+"::insertChildBefore called without a node.");
    }
    unsigned i = indexOf(pOldChild);
    insertChild(pNewNode, i+1);
}
Пример #28
0
	void CCSpriteBatchNode::insertChild(CCSprite *pobSprite, unsigned int uIndex)
	{
		pobSprite->useBatchNode(this);
		pobSprite->setAtlasIndex(uIndex);
		pobSprite->setDirty(true);

		if (m_pobTextureAtlas->getTotalQuads() == m_pobTextureAtlas->getCapacity())
		{
			increaseAtlasCapacity();
		}

		ccV3F_C4B_T2F_Quad quad = pobSprite->getQuad();
		m_pobTextureAtlas->insertQuad(&quad, uIndex);

		m_pobDescendants->insertObjectAtIndex(pobSprite, uIndex);

		// update indices
		unsigned int i = 0;
		if (m_pobDescendants && m_pobDescendants->count() > 0)
		{
			NSMutableArray<CCSprite*>::NSMutableArrayIterator iter;
			for (iter = m_pobDescendants->begin(); iter != m_pobDescendants->end(); ++iter)
			{
				if (! *iter)
				{
					break;
				}

				if (i > uIndex)
				{
					(*iter)->setAtlasIndex((*iter)->getAtlasIndex() + 1);
				}

				++i;
			}
		}	

		// add children recursively
		NSMutableArray<CCNode*> *pChildren = pobSprite->getChildren();
		if (pChildren && pChildren->count() > 0)
		{
			NSMutableArray<CCNode*>::NSMutableArrayIterator iterNode;
			CCSprite *pSprite;
			for (iterNode = pChildren->begin(); iterNode != pChildren->end(); ++iterNode)
			{
				pSprite = (CCSprite*)(*iterNode);

				if (! pSprite)
				{
					break;
				}

				unsigned int uIndex = atlasIndexForChild(pSprite, pSprite->getZOrder());
				insertChild(pSprite, uIndex);
			}
		}
	}
Пример #29
0
GLC_StructOccurence* GLC_StructOccurence::insertChild(int index, GLC_StructInstance* pInstance)
{
	GLC_StructOccurence* pOccurence;
	pOccurence= new GLC_StructOccurence(pInstance, m_pWorldHandle);

	insertChild(index, pOccurence);

	return pOccurence;
}
Пример #30
0
void CCNode::reorderChild(CCNode *child, int zOrder)
{
	CCAssert( child != NULL, "Child must be non-nil");

	child->retain();
	m_pChildren->removeObject(child);

	insertChild(child, zOrder);
	child->release();
}