Exemplo n.º 1
0
tstring ElementNode::getTextValue() const
{
	if (getChildCount() == 0)
		return TXT("");

	if (getChildCount() != 1)
		throw Core::BadLogicException(TXT("Can't retrieve text value when more than 1 child node exists"));

	NodePtr child = getChild(0);

	if (child->type() != TEXT_NODE)
		throw Core::BadLogicException(TXT("Can't retrieve text value when child not a text node"));

	return Core::dynamic_ptr_cast<TextNode>(child)->text();
}
Exemplo n.º 2
0
const ISerializableNode* CPropertyNode::getChild(int32_t childIndex) const
{
    BEHAVIAC_ASSERT(childIndex < getChildCount());
    ChildrenContainer::const_iterator iter = m_children.begin();
    std::advance(iter, childIndex);
    return &*iter;
}
Exemplo n.º 3
0
//----------------------------------------------------------------------------//
Rectf ScrolledContainer::getChildExtentsArea(void) const
{
    Rectf extents(0, 0, 0, 0);

    const size_t childCount = getChildCount();
    if (childCount == 0)
        return extents;

    for (size_t i = 0; i < childCount; ++i)
    {
        const Window* const wnd = getChildAtIdx(i);
        const Rectf area(
            CoordConverter::asAbsolute(wnd->getPosition(), d_pixelSize),
            wnd->getPixelSize());

        if (area.d_min.d_x < extents.d_min.d_x)
            extents.d_min.d_x = area.d_min.d_x;

        if (area.d_min.d_y < extents.d_min.d_y)
            extents.d_min.d_y = area.d_min.d_y;

        if (area.d_max.d_x > extents.d_max.d_x)
            extents.d_max.d_x = area.d_max.d_x;

        if (area.d_max.d_y > extents.d_max.d_y)
            extents.d_max.d_y = area.d_max.d_y;
    }

    return extents;
}
Exemplo n.º 4
0
//virtual
BOOL LLUICtrl::postBuild()
{
	//
	// Find all of the children that want to be in front and move them to the front
	//

	if (getChildCount() > 0)
	{
		std::vector<LLUICtrl*> childrenToMoveToFront;

		for (LLView::child_list_const_iter_t child_it = beginChild(); child_it != endChild(); ++child_it)
		{
			LLUICtrl* uictrl = dynamic_cast<LLUICtrl*>(*child_it);

			if (uictrl && uictrl->mRequestsFront)
			{
				childrenToMoveToFront.push_back(uictrl);
			}
		}

		for (std::vector<LLUICtrl*>::iterator it = childrenToMoveToFront.begin(); it != childrenToMoveToFront.end(); ++it)
		{
			sendChildToFront(*it);
		}
	}

	return LLView::postBuild();
}
void GuiComponent::renderChildren(const Eigen::Affine3f& transform) const
{
	for(unsigned int i = 0; i < getChildCount(); i++)
	{
		getChild(i)->render(transform);
	}
}
Exemplo n.º 6
0
//----------------------------------------------------------------------------//
Rect ScrolledContainer::getChildExtentsArea(void) const
{
    Rect extents(0, 0, 0, 0);

    const size_t childCount = getChildCount();
    if (childCount == 0)
        return extents;

    for (size_t i = 0; i < childCount; ++i)
    {
        const Window* const wnd = getChildAtIdx(i);
        const Rect area(wnd->getArea().asAbsolute(d_pixelSize));

        if (area.d_left < extents.d_left)
            extents.d_left = area.d_left;

        if (area.d_top < extents.d_top)
            extents.d_top = area.d_top;

        if (area.d_right > extents.d_right)
            extents.d_right = area.d_right;

        if (area.d_bottom > extents.d_bottom)
            extents.d_bottom = area.d_bottom;
    }

    return extents;
}
Exemplo n.º 7
0
void MarginCombo::addChild(std::size_t const& idx, Handler<Element> const& h, Context const& ctx)
{
	if(getChildCount() > 0){
		CINAMO_EXCEPTION(Exception, "[BUG] Margin Combo can hold only one element.");
	}
	this->Super::addChild(idx,h,ctx);
}
Exemplo n.º 8
0
void GuiComponent::deinit()
{
	for(unsigned int i = 0; i < getChildCount(); i++)
	{
		getChild(i)->deinit();
	}
}
Exemplo n.º 9
0
OctreeElement* OctreeElement::getChildAtIndex(int childIndex) const {
#ifdef SIMPLE_CHILD_ARRAY
    return _simpleChildArray[childIndex];
#endif // SIMPLE_CHILD_ARRAY

#ifdef SIMPLE_EXTERNAL_CHILDREN
    int childCount = getChildCount();

    switch (childCount) {
        case 0: {
            return NULL;
        } break;

        case 1: {
            // if our single child is the one being requested, return it, otherwise
            // return null
            int firstIndex = getNthBit(_childBitmask, 1);
            if (firstIndex == childIndex) {
                return _children.single;
            } else {
                return NULL;
            }
        } break;

        default : {
            return _children.external[childIndex];
        } break;
    }
#endif // def SIMPLE_EXTERNAL_CHILDREN
}
Exemplo n.º 10
0
void GuiComponent::onRender()
{
	for(unsigned int i = 0; i < getChildCount(); i++)
	{
		getChild(i)->render();
	}
}
Exemplo n.º 11
0
ITreeNode*	CTDefaultTreeNode::getChildAt(int childIndex)
{
	if( childIndex < 0 || childIndex >= getChildCount() )
		return NULL;

	return m_children[ childIndex ];
}
Exemplo n.º 12
0
void GuiComponent::update(int deltaTime)
{
	for(unsigned int i = 0; i < getChildCount(); i++)
	{
		getChild(i)->update(deltaTime);
	}
}
//----------------------------------------------------------------------------//
Rectf ScrolledContainer::getChildExtentsArea(void) const
{
    Rectf extents(0, 0, 0, 0);

    const size_t childCount = getChildCount();
    if (childCount == 0)
        return extents;

    for (size_t i = 0; i < childCount; ++i)
    {
        const Window* const wnd = getChildAtIdx(i);
        Rectf area(
            CoordConverter::asAbsolute(wnd->getPosition(), d_pixelSize),
            wnd->getPixelSize());

        if (wnd->getHorizontalAlignment() == HA_CENTRE)
            area.setPosition(area.getPosition() - Vector2<float>(area.getWidth() * 0.5f - d_pixelSize.d_width * 0.5f, 0.0f));
        if (wnd->getVerticalAlignment() == VA_CENTRE)
            area.setPosition(area.getPosition() - Vector2<float>(0.0f, area.getHeight() * 0.5f - d_pixelSize.d_height * 0.5f));

        if (area.d_min.d_x < extents.d_min.d_x)
            extents.d_min.d_x = area.d_min.d_x;

        if (area.d_min.d_y < extents.d_min.d_y)
            extents.d_min.d_y = area.d_min.d_y;

        if (area.d_max.d_x > extents.d_max.d_x)
            extents.d_max.d_x = area.d_max.d_x;

        if (area.d_max.d_y > extents.d_max.d_y)
            extents.d_max.d_y = area.d_max.d_y;
    }

    return extents;
}
Exemplo n.º 14
0
void HypNode::markEnable(int on, int descend) {
  int j;
  int wanted, value;
  HypLink *l;
  HypNode *n;
  setEnabled(on);
  for (j = 0; j < getChildCount(); j++) {
    l = getChildLink(j);
    n = l->getChild();
    wanted = l->getDesired();
    value = 0;
    if (n != (HypNode *)0 && on && getEnabled() && n->getEnabled() && wanted)
      value = 1;
    l->setEnabled(value);
  }
  l = getParentLink();
  if (l) {
    n = l->getParent();
    wanted = l->getDesired();
    value = 0;
    if (n != (HypNode *)0 && on && getEnabled() && n->getEnabled() && wanted)
      value = 1;
    l->setEnabled(value);
  }
  for (j = 0; j < getOutgoingCount(); j++) {
    l = getOutgoing(j);
    n = l->getChild();
    wanted = l->getDesired();
    value = 0;
    if (n != (HypNode *)0 && on && getEnabled() && n->getEnabled() && wanted)
      value = 1;
    l->setEnabled(value);
  }
  for (j = 0; j < getIncomingCount(); j++) {
    l = getIncoming(j);
    n = l->getParent();
    wanted = l->getDesired();
    value = 0;
    if (n != (HypNode *)0 && on && getEnabled() && n->getEnabled() && wanted)
      value = 1;
    l->setEnabled(value);
  }
  if (descend) 
    for (j = 0; j < getChildCount(); j++) {
      children[j]->markEnable(on, descend);
    }
}
Exemplo n.º 15
0
SceneNode* VisibilityNode::clone() const
{
	VisibilityNode* node = new VisibilityNode(visible);

	for (std::size_t i = 0; i < getChildCount(); ++i)
		node->addChild(getChild(i)->clone());

	return node;
}
Exemplo n.º 16
0
bool GuiComponent::input(InputConfig* config, Input input)
{
	for(unsigned int i = 0; i < getChildCount(); i++)
	{
		if(getChild(i)->input(config, input))
			return true;
	}

	return false;
}
Exemplo n.º 17
0
GuiComponent::~GuiComponent()
{
	mWindow->removeGui(this);

	if(mParent)
		mParent->removeChild(this);

	for(unsigned int i = 0; i < getChildCount(); i++)
		getChild(i)->setParent(NULL);
}
Exemplo n.º 18
0
void CullingNode::intersectRay(const Ray& ray, Vector<IntersectionResult>& intersections, bool onlyWorldGeometry)
{
    for (auto i = 0U; i < getChildCount(); i++)
        getChild(i)->setIsWorldGeometry(isWorldGeometry());

    // Swallow the ray intersection if it doesn't intersect the world extents
    if (!getWorldExtents().intersect(ray))
        return;

    ComplexEntity::intersectRay(ray, intersections, onlyWorldGeometry);
}
	void Entity::removeChild(Entity* child)
	{
		for (int i = 0; i < getChildCount(); ++i)
		{
			Entity* e = getChild(i);
			if (e == child)
			{
				m_childs.data().erase(m_childs.data().begin() + i);
			}
		}
	}
Exemplo n.º 20
0
//获取子节点的状态
int Element::checkChildState()
{
    int r = -1;
    for (int i = 0; i < getChildCount(); i++)
    {
        if (getChild(i)->getState() != Normal)
        {
            r = i;
        }
    }
    return r;
}
Exemplo n.º 21
0
void ThemeComponent::deleteComponents()
{
	for(unsigned int i = 0; i < getChildCount(); i++)
	{
		delete getChild(i);
	}

	clearChildren();

	//deletes fonts if any were created
	setDefaults();
}
Exemplo n.º 22
0
	void FalagardSuperTooltip::setPageElementsName(const String& strName)
	{
		//Split string 
		std::vector< String > vElementNameVector = split_string(strName, (utf8*)";", getChildCount());

		//Hide all sub window
		int nChildSize = (int)getChildCount();
		for(int i=0; i<nChildSize; i++)
		{
			d_children[i]->hide();
		}

		//Clear old elements
		d_VectorElements.clear();
		int nSize = (int)vElementNameVector.size();
		for(int i=0; i<nSize; i++)
		{
			//Only accept child window
			if(!isChild(vElementNameVector[i])) continue;

			//Get Child window
			Window* pChild = getChild(vElementNameVector[i]);
			pChild->show();

			Elements newElement;
			newElement.pWindow = pChild;
			//Dynamic size window (Resize Text)
			if(pChild->testClassName("FalagardSuperTooltip/ResizeText"))
			{
				newElement.bDynamicSize = true;
			}
			//Static size window
			else
			{
				newElement.bDynamicSize = false;
			}

			d_VectorElements.push_back(newElement);
		}
	}
Exemplo n.º 23
0
int FXmlBtn::Read_XML( AST_TXML_Tag *root, DRMessageManager& dmm, long dmm_page )
{
	int ret = 0;
	FBtnVM vm(coord_calculation, dmm, dmm_page);
	SetToMathML( root, vm );

	QString& _tag = to_mathml.type;
	QString& _body = to_mathml.value;

	struct HMathMLAttr mml_attr( _tag, _body );
	HMathOpAttr *opinfo = ::mml_is_token_op_tag( _tag ) ? ::getOperatorEntryByMML( _body ) : 0;
	if( opinfo ) mml_attr.setMODefault( *opinfo );
	proplist.setMathMLAttr( mml_attr );
	AddButtonData( root, vm );

	switch( getNodeType() )
	{
	case NODE_MATHML:
		if( (ret = AddNodeType_NODE_MATHML( root, vm )) )
			return ret;
		break;
	case NODE_PLANETEXT:
		if( (ret = AddGraphicsData( root, vm )) ||
			(ret = CompileCalculationScheme( root, vm )) )
			return ret;
		break;
	case NODE_FORMULA:
		if( (ret = AddChildData( root, vm )) || 
			(ret = AddGraphicsData( root, vm )) ||
			(ret = CompileCalculationScheme( root, vm )) )
			return ret;
		break;
	default:
		break;
	}
	if( getNodeType() != NODE_MATHML && to_mathml.mathml_template_string.length() )
	{
		QVector<QString> args;
		for( long i = 0; i < getChildCount(); i++ )
		{
			args.push_back( QString() );
		}
		if( HKMatchTemplate().Treate( to_mathml.mathml_template_string, args ) == -1 )
		{
			QString warn2 = _T("number of empty slots in the button differs from slots number in the MathML conversion template");
			vm.dmm.AddLine( vm.dmm_page, warn2, root->getLine() );
			ret = -1;
		}
	}

	return ret;
}
Exemplo n.º 24
0
void printlist(TreeNode *node){
	TreeNode **list,*nodeptr;
	int ccount,i;
	ccount = getChildCount(node);
	list = getChildNodes(node);
	if(list == NULL)
		return;
	nodeptr = *list;
	for(i=0;i<ccount; i++){
		printf(" Data in Node = %d\n",nodeptr->data);
		nodeptr++;
	}
}
//----------------------------------------------------------------------------//
size_t LayoutContainer::getIdxOfChild(Window* wnd) const
{
    for (size_t i = 0; i < getChildCount(); ++i)
    {
        if (getChildAtIdx(i) == wnd)
        {
            return i;
        }
    }

    assert(0);
    return 0;
}
Exemplo n.º 26
0
//----------------------------------------------------------------------------//
void Element::notifyScreenAreaChanged(bool recursive /* = true */)
{
    d_unclippedOuterRect.invalidateCache();
    d_unclippedInnerRect.invalidateCache();

    // inform children that their screen area must be updated
    if (recursive)
    {
        const size_t child_count = getChildCount();
        for (size_t i = 0; i < child_count; ++i)
            d_children[i]->notifyScreenAreaChanged();
    }
}
Exemplo n.º 27
0
void Element::insertAt(int n, Element* newElement)
{
	if(newElement!=0 && ((n<=getChildCount()) && n>=0))
	{
		ElementNode* temp = elementHead;
		for(int i=0;i<n-1;++i)
		{
			temp = temp->next;
		}
		ElementNode* temp2 = temp->next;
		temp->next = new ElementNode(newElement,temp2);
		elementHead = temp;
	}
}
Exemplo n.º 28
0
	DNode* DNode::getChild( uint32 index )
	{
		assert(index < getChildCount());
		ChildSet::iterator	i = mChildren.begin();
		for (uint32 j = 0; j < index; ++j)
		{
			i++;
		}
		if (i != mChildren.end())
		{
			return (*i);
		}
		return NULL;
	}
Exemplo n.º 29
0
main(){
 TreeNode * root,*temp1,*temp2;
 root = createRootNode();
 printf(" root node = %x", root);
  temp1 = addNode(root);
  temp1->data = 1;
  temp2=addNode(root);
  temp2->data=2;
  temp2=addNode(root);
  temp2->data=3;
  temp2=addNode(root);
  temp2->data=4;
  temp2=addNode(root);
  temp2->data=5;
  printf(" no of child nodes for root %d\n",getChildCount(root));
  temp2=addNode(temp1);
  temp2->data=100;
  temp2=addNode(temp1);
  temp2->data=200;
  printf(" no of child nodes for temp1 %d\n",getChildCount(temp1));
  printlist(root);
  printlist(temp1);
}
Exemplo n.º 30
0
void HypNode::setEnabledIncoming(int on, int descend) {
  //  if (!bEnabled) return;
  for (int j = 0; j < getIncomingCount(); j++) {
    HypLink *l = getIncoming(j);
    HypNode *n = l->getParent();
    l->setDesired(on);
    // if other end is disabled don't turn it on
    if ( (on && getEnabled() && n->getEnabled()) || !on)
      l->setEnabled(on);
  }
  if (descend) 
    for (int i = 0; i < getChildCount(); i++)
      children[i]->setEnabledIncoming(on, descend);
}