Ejemplo n.º 1
0
 int
 SpaceNode::getNoOfOpenChildren(const NodeAllocator& na) const {
   if (!hasOpenChildren())
     return 0;
   int noOfOpenChildren = 0;
   for (int i=getNumberOfChildren(); i--;)
     noOfOpenChildren += (getChild(na,i)->isOpen());
   return noOfOpenChildren;
 }
Ejemplo n.º 2
0
  void
  SpaceNode::closeChild(const NodeAllocator& na,
                        bool hadFailures, bool hadSolutions) {
    setHasFailedChildren(hasFailedChildren() || hadFailures);
    setHasSolvedChildren(hasSolvedChildren() || hadSolutions);

    bool allClosed = true;
    for (int i=getNumberOfChildren(); i--;) {
      if (getChild(na,i)->isOpen()) {
        allClosed = false;
        break;
      }
    }

    if (allClosed) {
      setHasOpenChildren(false);
      for (unsigned int i=0; i<getNumberOfChildren(); i++)
        setHasSolvedChildren(hasSolvedChildren() ||
          getChild(na,i)->hasSolvedChildren());
      SpaceNode* p = getParent(na);
      if (p != nullptr) {
        p->closeChild(na, hasFailedChildren(), hasSolvedChildren());
      }
    } else {

      if (hadSolutions) {
        setHasSolvedChildren(true);
        SpaceNode* p = getParent(na);
        while (p != nullptr && !p->hasSolvedChildren()) {
          p->setHasSolvedChildren(true);
          p = p->getParent(na);
        }
      }
      if (hadFailures) {
        SpaceNode* p = getParent(na);
        while (p != nullptr && !p->hasFailedChildren()) {
          p->setHasFailedChildren(true);
          p = p->getParent(na);
        }
      }
    }

  }
Ejemplo n.º 3
0
void Texture::actionSequences()
{
    doAction();

    for(int i = 0; i < getNumberOfChildren(); i++)
    {
        getChild(i)->actionSequences();
    }

    glBindTexture(GL_TEXTURE_2D, NULL); //pour pas affecter les noeuds qui ne sont pas des enfants de la texture
}
Ejemplo n.º 4
0
	void Container::validateTree() const
	{
		// only validate down the tree if our
		// valid flag is set to false.
		if(!isValid())
		{
			// check if we have a layoutmanager and children
			// if so, do a layout call.
			if(layout != 0 && getNumberOfChildren() != 0)
				layout->layoutContainer(this);

			ComponentList::const_iterator iterator;

			// call validate on the Containers children, so the validateTree
			// call propogates down the tree.
			for(iterator = componentList.begin(); iterator != componentList.end(); ++iterator)
			{
				if(!(*iterator)->isValid() && !(*iterator)->isRootContainer())
				{
					(*iterator)->validate();
				}
			}
		}
	}
Ejemplo n.º 5
0
void ScrollView::addChild(View *child) {
    if(getNumberOfChildren() == 0) {
        children.push_back(child);
    }
}