Esempio n. 1
0
//------------------------------------------------------------------------------
void FGraphActionNode::AddChildRecursively(TArray<FString>& CategoryStack, TSharedPtr<FGraphActionNode> NodeToAdd)
{
	if (CategoryStack.Num() > 0)
	{
		FString CategorySection = CategoryStack[0];
		CategoryStack.RemoveAt(0, 1);

		// make sure we don't already have a child that this can nest under
		TSharedPtr<FGraphActionNode> ExistingNode = FindMatchingParent(CategorySection, NodeToAdd);
		if (ExistingNode.IsValid())
		{
			ExistingNode->AddChildRecursively(CategoryStack, NodeToAdd);
		}
		else
		{
			TSharedPtr<FGraphActionNode> CategoryNode = NewCategoryNode(CategorySection, NodeToAdd->Grouping, NodeToAdd->SectionID);
			InsertChild(CategoryNode);
			CategoryNode->AddChildRecursively(CategoryStack, NodeToAdd);
		}
	}
	else
	{
		InsertChild(NodeToAdd);
	}
}
Esempio n. 2
0
    BOOL STreeList::CreateChildren(pugi::xml_node xmlNode)
    {
        pugi::xml_node xmlHeader = xmlNode.child(L"headerstyle");
        pugi::xml_node xmlTreectrl = xmlNode.child(L"treectrlstyle");
        if(!xmlHeader || !xmlTreectrl) 
            return FALSE;
        m_pHeader = CreateHeader();
        InsertChild(m_pHeader);
        m_pHeader->InitFromXml(xmlHeader);
        m_pHeader->GetEventSet()->subscribeEvent(EventHeaderItemChanging::EventID, Subscriber(&STreeList::OnHeaderSizeChanging,this));
        m_pHeader->GetEventSet()->subscribeEvent(EventHeaderItemSwap::EventID, Subscriber(&STreeList::OnHeaderSwap,this));

        m_pTreeCtrl = CreateMcTreeCtrl();
        InsertChild(m_pTreeCtrl);
        m_pTreeCtrl->InitFromXml(xmlTreectrl);
        m_pTreeCtrl->GetEventSet()->subscribeEvent(EventScroll::EventID,Subscriber(&STreeList::OnScrollEvent,this));

        m_pHeader->InsertItem(0,m_strTreeLabel,m_pTreeCtrl->m_nTreeWidth,ST_NULL,0);
        for(int i=1;i<m_pHeader->GetItemCount();i++)
        {
            int nWid = m_pHeader->GetItemWidth(i);
            m_pTreeCtrl->InsertColumn(i-1,nWid);
        }
        return TRUE;
    }
Esempio n. 3
0
//------------------------------------------------------------------------------
void FGraphActionNode::InsertChild(TSharedPtr<FGraphActionNode> NodeToAdd)
{
	ensure(!NodeToAdd->IsRootNode());
	//ensure(!IsSeparator());

	NodeToAdd->ParentNode = this->AsShared();

	if (NodeToAdd->SectionID != INVALID_SECTION_ID)
	{
		// don't need a section heading if the parent is under the same section
		bool const bAddSectionHeading = (NodeToAdd->SectionID != SectionID) && 
			// make sure we already haven't already added a heading for this section
			!ChildSections.Contains(NodeToAdd->SectionID) &&
			// if this node also has a category, use that over a section heading
			(!NodeToAdd->IsActionNode() || NodeToAdd->GetPrimaryAction()->Category.IsEmpty());

		if (bAddSectionHeading)
		{
			ChildSections.Add(NodeToAdd->SectionID); // to avoid recursion, add before we insert
			//InsertChild(NewSectionHeadingNode(NodeToAdd->ParentNode, NodeToAdd->Grouping, NodeToAdd->SectionID));

			TSharedPtr<FGraphActionNode> NewSection = NewSectionHeadingNode(NodeToAdd->ParentNode, NodeToAdd->Grouping, NodeToAdd->SectionID);
			InsertChild(NewSection);

			NodeToAdd->InsertOrder = NewSection->Children.Num();
			NewSection->Children.Add(NodeToAdd);
			return;
		}
	}
	// we don't use group-dividers inside of sections (we use groups to more to
	// hardcode the order), but if this isn't in a section...
	else if (!ChildGroupings.Contains(NodeToAdd->Grouping))
	{
		// don't need a divider if this is the first group
		if (ChildGroupings.Num() > 0)
		{
			int32 LowestGrouping = MAX_int32;
			for (int32 Group : ChildGroupings)
			{
				LowestGrouping = FMath::Min(LowestGrouping, Group);
			}
			// dividers come at the end of a menu group, so it would be 
			// undesirable to add it for NodeToAdd->Grouping if that group is 
			// lower than all the others (the lowest group should not have a 
			// divider associated with it)
			int32 DividerGrouping = FMath::Max(LowestGrouping, NodeToAdd->Grouping);

			ChildGroupings.Add(NodeToAdd->Grouping); // to avoid recursion, add before we insert
			InsertChild(NewGroupDividerNode(NodeToAdd->ParentNode, DividerGrouping));
		}
		else
		{
			ChildGroupings.Add(NodeToAdd->Grouping);
		}
	}

	NodeToAdd->InsertOrder = Children.Num();
	Children.Add(NodeToAdd);
}
CVec4PropertyDescription::CVec4PropertyDescription(CSerializer* pSerializer)
    : super(NULL)
{
    SetType(eRPT_Vec4F);
    SetMaxCount(VEC_COUNT);
    CFloatPropertyDescription* pFloatProperty = down_cast<CFloatPropertyDescription*>(CComponentProxyManager::GetInstance()->CreateProperty(eRPT_Float, NULL));
    pFloatProperty->SetSpinStep(0.1f);
    SetTemplateProperty(pFloatProperty);
    TString InitValue = _T("0,0,0,0");
    if (pSerializer != NULL)
    {
        InitValue.clear();
        for (uint32_t i = 0; i < VEC_COUNT; ++i)
        {
            float fValue = 0;
            (*pSerializer) >> fValue;
            InitValue.append(wxString::Format(_T("%f"),fValue));
            if (i != VEC_COUNT - 1)
            {
                InitValue.append(_T(","));
            }
            CPropertyDescriptionBase* pChild = InsertChild(NULL);
            pChild->InitializeValue(fValue);
        }
        ResetChildName();
    }
Esempio n. 5
0
sint32 c3_PopupWindow::AddTitle( MBCHAR *titleBlock )
{
	if (m_title)
	{
		// No action: already created
	}
	else
	{
		AUI_ERRCODE errcode = AUI_ERRCODE_OK;
		m_title = new c3_Static(&errcode, aui_UniqueId(), "c3_PopupTitle");
		TestControl(m_title);
		char *ldlBlock = "c3_PopupTitle.c3_PopupTitleText";
		m_titleText = 
			new c3_Static
		        (&errcode, 
		         aui_UniqueId(), 
		         (titleBlock) ? titleBlock : ldlBlock
		        );
		TestControl(m_titleText);

		m_title->AddSubControl(m_titleText);
		m_title->Move((m_width - m_title->Width()) / 2, 0);

		InsertChild(m_title, 0);
		m_title->SetParentWindow(this);
		m_title->SetBlindness(true);
	}

	return 1;
}
Esempio n. 6
0
    BOOL SComboBase::CreateChildren( pugi::xml_node xmlNode )
    {
        SASSERT(m_pSkinBtn);
		m_xmlDropdownStyle.append_copy(xmlNode.child(KStyle_Dropdown));
        //创建edit对象
        if(!m_bDropdown)
        {            
            m_pEdit=new SComboEdit(this);
            SApplication::getSingleton().SetSwndDefAttr(m_pEdit);

            InsertChild(m_pEdit);
            pugi::xml_node xmlEditStyle=xmlNode.child(KStyle_Edit);
            m_pEdit->GetEventSet()->setMutedState(true);
            if(xmlEditStyle)
                m_pEdit->InitFromXml(xmlEditStyle);
            else
                m_pEdit->SSendMessage(WM_CREATE);
            m_pEdit->GetEventSet()->setMutedState(false);
			
            m_pEdit->SetID(IDC_CB_EDIT);
            m_pEdit->SSendMessage(EM_SETEVENTMASK,0 ,ENM_CHANGE );

        }
        return CreateListBox(xmlNode);
    }
Esempio n. 7
0
/*
================
idEditWindow::InitScroller

This is the same as in idListWindow
================
*/
void idEditWindow::InitScroller( bool horizontal )
{
	const char *thumbImage = "guis/assets/scrollbar_thumb.tga";
	const char *barImage = "guis/assets/scrollbarv.tga";
	const char *scrollerName = "_scrollerWinV";

	if (horizontal) {
		barImage = "guis/assets/scrollbarh.tga";
		scrollerName = "_scrollerWinH";
	}

	const idMaterial *mat = declManager->FindMaterial( barImage );
	mat->SetSort( SS_GUI );
	sizeBias = mat->GetImageWidth();

	idRectangle scrollRect;
	if (horizontal) {
		sizeBias = mat->GetImageHeight();
		scrollRect.x = 0;
		scrollRect.y = (clientRect.h - sizeBias);
		scrollRect.w = clientRect.w;
		scrollRect.h = sizeBias;
	} else {
		scrollRect.x = (clientRect.w - sizeBias);
		scrollRect.y = 0;
		scrollRect.w = sizeBias;
		scrollRect.h = clientRect.h;
	}

	scroller->InitWithDefaults(scrollerName, scrollRect, foreColor, matColor, mat->GetName(), thumbImage, !horizontal, true);
	InsertChild(scroller, NULL);
	scroller->SetBuddy(this);
}
Esempio n. 8
0
 void main()
 {
   int i;
   PTree T,p;
   TElemType e,e1;
   InitTree(T);
   printf("构造空树后,树空否? %d(1:是 0:否) 树根为%c 树的深度为%d\n",TreeEmpty(T),Root(T),TreeDepth(T));
   CreateTree(T);
   printf("构造树T后,树空否? %d(1:是 0:否) 树根为%c 树的深度为%d\n",TreeEmpty(T),Root(T),TreeDepth(T));
   printf("层序遍历树T:\n");
   TraverseTree(T,vi);
   printf("请输入待修改的结点的值 新值: ");
   scanf("%c%*c%c%*c",&e,&e1);
   Assign(T,e,e1);
   printf("层序遍历修改后的树T:\n");
   TraverseTree(T,vi);
   printf("%c的双亲是%c,长子是%c,下一个兄弟是%c\n",e1,Parent(T,e1),LeftChild(T,e1),RightSibling(T,e1));
   printf("建立树p:\n");
   InitTree(p);
   CreateTree(p);
   printf("层序遍历树p:\n");
   TraverseTree(p,vi);
   printf("将树p插到树T中,请输入T中p的双亲结点 子树序号: ");
   scanf("%c%d%*c",&e,&i);
   InsertChild(T,e,i,p);
   Print(T);
   printf("删除树T中结点e的第i棵子树,请输入e i: ");
   scanf("%c%d",&e,&i);
   DeleteChild(T,e,i);
   Print(T);
 }
Esempio n. 9
0
CDuiPanel* CDuiItemBox::InsertItem(LPCWSTR pszXml,int iItem/*=-1*/,BOOL bEnsureVisible/*=FALSE*/)
{
    CDuiStringA strXml=DUI_CW2A(pszXml,CP_UTF8);;

    pugi::xml_document xmlDoc;
    if(!xmlDoc.load_buffer((LPCSTR)strXml,strXml.GetLength(),pugi::parse_default,pugi::encoding_utf8)) return NULL;

    CDuiWindow *pChild=m_pFirstChild,*pPrevChild=ICWND_FIRST;
    for(int iChild=0; iChild<iItem || iItem==-1; iChild++)
    {
        if(!pChild) break;
        pPrevChild=pChild;
        pChild=pChild->GetDuiWindow(GDUI_NEXTSIBLING);
    }

    CDuiPanel *pPanel=new CDuiPanel;
    InsertChild(pPanel, pPrevChild);

    pPanel->LoadChildren(xmlDoc);
    pPanel->SetVisible(TRUE);
    pPanel->SetFixSize(m_nItemWid,m_nItemHei);

    UpdateScroll();
    ReLayout();

    if(bEnsureVisible) EnsureVisible(pPanel);

    NotifyInvalidate();
    return pPanel;
}
Esempio n. 10
0
void pawsTreeNode::MoveChild(pawsTreeNode* node, pawsTreeNode* nextSibling)
{
    RemoveChild(node);
    InsertChild(node, nextSibling);

    if(tree != NULL) tree->NodeChanged();
}
Esempio n. 11
0
TimestampAttr *TimestampAligner::GetTimestampAtTime(double time)
{
    int i;
    int idx = -1; // the index if we reach the end.
    // We need to adjust the position since timestamp 0 to 1.0 are before 0 musical time
    time = time - 1.0;
    TimestampAttr *timestampAttr = NULL;
    // First try to see if we already have something at the time position
    for (i = 0; i < GetChildCount(); i++) {
        timestampAttr = dynamic_cast<TimestampAttr *>(m_children.at(i));
        assert(timestampAttr);

        double alignmentTime = timestampAttr->GetActualDurPos();
        if (vrv::AreEqual(alignmentTime, time)) {
            return timestampAttr;
        }
        // nothing found, do not go any further but keep the index
        if (alignmentTime > time) {
            idx = i;
            break;
        }
    }
    // nothing found
    timestampAttr = new TimestampAttr();
    timestampAttr->SetDrawingPos(time);
    timestampAttr->SetParent(this);
    if (idx == -1) {
        m_children.push_back(timestampAttr);
    }
    else {
        InsertChild(timestampAttr, idx);
    }
    return timestampAttr;
}
Esempio n. 12
0
NS_IMETHODIMP nsViewManager::InsertChild(nsIView *aParent, nsIView *aChild, PRInt32 aZIndex)
{
  // no-one really calls this with anything other than aZIndex == 0 on a fresh view
  // XXX this method should simply be eliminated and its callers redirected to the real method
  SetViewZIndex(aChild, false, aZIndex, false);
  return InsertChild(aParent, aChild, nsnull, true);
}
Esempio n. 13
0
void
nsViewManager::InsertChild(nsView *aParent, nsView *aChild, int32_t aZIndex)
{
    // no-one really calls this with anything other than aZIndex == 0 on a fresh view
    // XXX this method should simply be eliminated and its callers redirected to the real method
    SetViewZIndex(aChild, false, aZIndex, false);
    InsertChild(aParent, aChild, nullptr, true);
}
Esempio n. 14
0
bool pawsTreeNode::Load(iDocumentNode* node)
{
    csRef<iDocumentNodeIterator> xmlChildren, xmlAttrList;
    csRef<iDocumentNode> xmlChild, xmlAttr;
    csString factory;
    pawsWidget* childAsWidget;
    pawsTreeNode* childNode;

    Clear();

    name = node->GetAttributeValue("name");
    xmlChildren = node->GetNodes("widget");
    while(xmlChildren->HasNext())
    {
        xmlChild = xmlChildren->Next();

        factory = xmlChild->GetAttributeValue("factory");
        childAsWidget = PawsManager::GetSingleton().CreateWidget(factory);
        if(!childAsWidget)
        {
            Error2("Could not create node from factory: %s", factory.GetData());
            return false;
        }
        childNode = dynamic_cast<pawsTreeNode*>(childAsWidget);
        if(childNode == NULL)
        {
            Error1("Created node is not pawsTreeNode");
            return false;
        }
        InsertChild(childNode);

        if(!childNode->Load(xmlChild))
        {
            Error1("Node failed to load");
            return false;
        }
    }


    attrList.DeleteAll();

    xmlAttrList = node->GetNodes("attr");
    while(xmlAttrList->HasNext())
    {
        xmlAttr = xmlAttrList->Next();
        SetAttr(xmlAttr->GetAttributeValue("name"), xmlAttr->GetAttributeValue("value"));
    }

    if(tree != NULL)
        tree->NodeChanged();

    csString collapsed = node->GetAttributeValue("collapsed");
    if(collapsed == "yes")
        CollapseAll();

    return true;
}
Esempio n. 15
0
//------------------------------------------------------------------------------
void FGraphActionNode::AddChildRecursively(TArray<FString>& CategoryStack, TSharedPtr<FGraphActionNode> NodeToAdd)
{
	if (NodeToAdd->SectionID != INVALID_SECTION_ID)
	{
		TSharedPtr<FGraphActionNode> FoundSectionNode;
		for ( TSharedPtr<FGraphActionNode> const& ChildNode : Children )
		{
			if ( NodeToAdd->SectionID == ChildNode->SectionID && ChildNode->IsSectionHeadingNode() )
			{
				FoundSectionNode = ChildNode;
				break;
			}
		}

		if ( FoundSectionNode.IsValid() )
		{
			FoundSectionNode->AddChildRecursively(CategoryStack, NodeToAdd);
			return;
		}
	}

	if ( CategoryStack.Num() > 0 )
	{
		FString CategorySection = CategoryStack[0];
		CategoryStack.RemoveAt(0, 1);

		// make sure we don't already have a child that this can nest under
		TSharedPtr<FGraphActionNode> ExistingNode = FindMatchingParent(CategorySection, NodeToAdd);
		if ( ExistingNode.IsValid() )
		{
			ExistingNode->AddChildRecursively(CategoryStack, NodeToAdd);
		}
		else
		{
			TSharedPtr<FGraphActionNode> CategoryNode = NewCategoryNode(CategorySection, NodeToAdd->Grouping, NodeToAdd->SectionID);
			InsertChild(CategoryNode);
			CategoryNode->AddChildRecursively(CategoryStack, NodeToAdd);
		}
	}
	else
	{
		InsertChild(NodeToAdd);
	}
}
Esempio n. 16
0
Status InsertChild(CSTree &T,TElemType p,int i,CSTree &C)
{
	CSTree q;
	CSTree temp;
	int isok;
	if(T==NULL || p==Nil || i<1)
		return FALSE;
	else
	{
		q=T;
		temp=NULL;
		while(q)
		{
			if(q->e==p)
			{
				temp=q;
				break;
			}
			else if(q->firstchild)
			{
				isok=InsertChild(q->firstchild,p,i,C);
				if(isok)
					return isok;
			}
			q=q->rightsibling;
		}
		if(temp==NULL || temp->firstchild==NULL)
			return FALSE;
		else
		{
			q=C;
			while(q->rightsibling)
				q=q->rightsibling;
			if(i==1)
			{
				q->rightsibling=temp->firstchild;
				temp->firstchild=C;
				return OK;
			}
			else
			{
				temp=temp->firstchild;
				i--;
				while(--i && temp)
					temp=temp->rightsibling;
				if(temp)
				{
					q->rightsibling=temp->rightsibling;
					temp->rightsibling=C;
					return OK;
				}
			}
		}
		return FALSE;
	}
}
Esempio n. 17
0
void MeasureAligner::AddAlignment( Alignment *alignment, int idx )
{
	alignment->SetParent( this );
    if ( idx == -1 ) {
        m_children.push_back( alignment );
    }
    else {
        InsertChild( alignment, idx );
    }
}
Esempio n. 18
0
void MusLayerRdg::AddElement( MusLayerElement *element, int idx )
{
	element->SetParent( this );
    if ( idx == -1 ) {
        m_children.push_back( element );
    }
    else {
        InsertChild( element, idx );
    }
}
void test_InsertChild(void) {
	BINARY_TREE_TYPE tree = get_test_tree(
			"1, 2, 3, , 5, 6, , , , 51, 52, 61, 62, , ");
	if (tree == NULL)
		return;

	BINARY_TREE_NODE *node;
	Status status = ERROR;
	Position position;

	node = get_node(tree, 2);
	status = InsertChild(tree, node, Left, 4);
	CU_ASSERT_EQUAL(status, OK);
	position.level = 3;
	position.order = 1;
	CU_ASSERT_EQUAL(Value(tree, position), 4);

	node = get_node(tree, 2);
	status = InsertChild(tree, node, Right, 5);
	CU_ASSERT_EQUAL(status, ERROR);
}
Esempio n. 20
0
void CDuiDropDownList::CreateListBox(pugi::xml_document *pXmlDocTmpl)
{
    m_pListBox=new CDuiListBox;
    InsertChild(m_pListBox);
    m_pListBox->SetCmdID(IDC_DROPDOWN_LIST);

    m_pListBox->Load(pXmlDocTmpl->first_child());
    m_pListBox->SetAttribute("pos", "0,0,-0,-0", TRUE);
    m_pListBox->SetAttribute("hottrack","1",TRUE);

    m_pListBox->SetOwner(m_pOwner->GetWindow());	//chain notify message to combobox
    m_pListBox->SetDuiFocus();
}
Esempio n. 21
0
 void main()
 {
   Status i;
   int j;
   position p;
   TElemType e;
   SqBiTree T,s;
   InitBiTree(T);
   CreateBiTree(T);
   printf("建立二叉树后,树空否?%d(1:是 0:否) 树的深度=%d\n",BiTreeEmpty(T),BiTreeDepth(T));
   i=Root(T,&e);
   if(i)
     printf("二叉树的根为:%d\n",e);
   else
     printf("树空,无根\n");
   printf("层序遍历二叉树:\n");
   LevelOrderTraverse(T,visit);
   printf("中序遍历二叉树:\n");
   InOrderTraverse(T,visit);
   printf("后序遍历二叉树:\n");
   PostOrderTraverse(T,visit);
   printf("请输入待修改结点的层号 本层序号: ");
   scanf("%d%d",&p.level,&p.order);
   e=Value(T,p);
   printf("待修改结点的原值为%d请输入新值: ",e);
   scanf("%d",&e);
   Assign(T,p,e);
   printf("先序遍历二叉树:\n");
   PreOrderTraverse(T,visit);
   printf("结点%d的双亲为%d,左右孩子分别为",e,Parent(T,e));
   printf("%d,%d,左右兄弟分别为",LeftChild(T,e),RightChild(T,e));
   printf("%d,%d\n",LeftSibling(T,e),RightSibling(T,e));
   InitBiTree(s);
   printf("建立右子树为空的树s:\n");
   CreateBiTree(s);
   printf("树s插到树T中,请输入树T中树s的双亲结点 s为左(0)或右(1)子树: ");
   scanf("%d%d",&e,&j);
   InsertChild(T,e,j,s);
   Print(T);
   printf("删除子树,请输入待删除子树根结点的层号 本层序号 左(0)或右(1)子树: ");
   scanf("%d%d%d",&p.level,&p.order,&j);
   DeleteChild(T,p,j);
   Print(T);
   ClearBiTree(T);
   printf("清除二叉树后,树空否?%d(1:是 0:否) 树的深度=%d\n",BiTreeEmpty(T),BiTreeDepth(T));
   i=Root(T,&e);
   if(i)
     printf("二叉树的根为:%d\n",e);
   else
     printf("树空,无根\n");
 }
Esempio n. 22
0
//------------------------------------------------------------------------------
TSharedPtr<FGraphActionNode> FGraphActionNode::AddSection(int32 Grouping, int32 InSectionID)
{
	if ( !ChildSections.Contains(InSectionID) )
	{
		ChildSections.Add(InSectionID);

		TSharedPtr<FGraphActionNode> Section = NewSectionHeadingNode(SharedThis(this), Grouping, InSectionID);
		InsertChild(Section);

		return Section;
	}

	return nullptr;
}
Esempio n. 23
0
cTestScene::cTestScene(LPD3DXSPRITE sprite) :
	framework::cWindow(sprite, 0, "testScene")
{
	Create("The-Waters-Edge.jpg");

	framework::cButton *btn1 = new framework::cButton(sprite, 1);
	btn1->Create("button1.png");
	InsertChild(btn1);

	framework::cButton *btn2 = new framework::cButton(sprite, 2);
	btn2->Create("button2.png");
	btn2->SetScale(Vector3(2,2,0));
	btn2->SetPos(Vector3(200,0,0));
	InsertChild(btn2);

	framework::cButton *btn3 = new framework::cButton(sprite, 3);
	btn3->Create("button1.png");
	btn3->SetPos(Vector3(200,0,0));
	InsertChild(btn3);


	EventConnect(this, framework::EVENT::BUTTON_CLICK, 1, (framework::EventFunction)&cTestScene::Button1Click);
}
bool DocumentFormulaNode::DoInsertLine(NodeEvent& nodeEvent)
{
	SharedCaretState c = any_cast<SharedCaretState>(nodeEvent["caretState"]);
	FormulaNode* node = c->GetNode();
	int pos = GetFirstLevelChildPos(node);
	RootFormulaNode* rootNode = new RootFormulaNode(this);
	EmptyFormulaNode* n = new EmptyFormulaNode(rootNode);
	rootNode->AddChild(n);
	InsertChild(rootNode, pos + 1);
	
	nodeEvent["undoAction"] = CommandAction(rootNode, 0, &FormulaNode::UndoInsertLine);
	c->SetToNode(rootNode, 0);

	return true;
}
Esempio n. 25
0
 virtual BOOL CreateChildren(pugi::xml_node xmlNode)
 {
     pugi::xml_node xmlItem = xmlNode.first_child();
     while(xmlItem)
     {
         SWindow *pMenuItem = CreateMenuItem(xmlItem.name());
         if(pMenuItem)
         {
             InsertChild(pMenuItem);
             pMenuItem->InitFromXml(xmlItem);
             pMenuItem->SetAttribute(L"pos",L"0,[0",TRUE);
         }
         xmlItem = xmlItem.next_sibling();
     }
     return TRUE;
 }
Esempio n. 26
0
BOOL RichEditObj::CreateChildren(pugi::xml_node xmlNode)
{
    for (pugi::xml_node xmlChild=xmlNode.first_child(); xmlChild; xmlChild=xmlChild.next_sibling())
    {
        if(xmlChild.type() != pugi::node_element) continue;

        RichEditObj * pChild = RichEditObjFactory::GetInstance().CreateObjectByName(xmlChild.name());
        if(pChild)
        {
            InsertChild(pChild);
            pChild->InitFromXml(xmlChild);
        }
    }

    return TRUE;
}
Esempio n. 27
0
 BOOL SSplitWnd::CreateChildren( pugi::xml_node xmlNode )
 {
     if(!xmlNode) return FALSE;
     pugi::xml_node xmlPane=xmlNode.child(SSplitPane::GetClassName());
     while(xmlPane)
     {
         SSplitPane *pPane = new SSplitPane();
         InsertChild(pPane);
         if(pPane->InitFromXml(xmlPane))
         {
             InsertItem(pPane);
         }
         xmlPane=xmlPane.next_sibling(SSplitPane::GetClassName());
     }
     return TRUE;
 }
Esempio n. 28
0
void CDuiDropDownListEx::CreateListBox(pugi::xml_document *pXmlDocTmpl)
{
    m_pListBox=new CDuiListBoxEx;
    InsertChild(m_pListBox);
    m_pListBox->SetCmdID(IDC_DROPDOWN_LIST);

	pugi::xml_node xmlTemplate=pXmlDocTmpl->first_child();
	m_nTextID=xmlTemplate.attribute("id_text").as_int(0);
	m_nIconID=xmlTemplate.attribute("id_icon").as_int(0);

    m_pListBox->Load(xmlTemplate);
    m_pListBox->SetAttribute("pos", "0,0,-0,-0", TRUE);
    m_pListBox->SetAttribute("hottrack","1",TRUE);

    m_pListBox->SetOwner(m_pOwner->GetWindow());	//chain notify message to combobox
    m_pListBox->SetDuiFocus();
}
Esempio n. 29
0
BOOL SSplitWnd::CreateChildren( pugi::xml_node xmlNode )
{
    if(!xmlNode) return FALSE;
    pugi::xml_node xmlPane=xmlNode.child(L"pane");
    while(xmlPane)
    {
        SSplitPane *pPane=new SSplitPane();
        InsertChild(pPane);
        if(pPane->InitFromXml(xmlPane))
        {
            pPane->AddRef();
            m_arrPane.Add(pPane);
        }
        xmlPane=xmlPane.next_sibling(L"pane");
    }
    return TRUE;
}
Esempio n. 30
0
bool CItemParamsNode::ConvertFromXMLWithFiltering(const XmlNodeRef &root, const char * keepWithThisAttrValue)
{
	bool filteringRequired = false;
	int nattributes = root->getNumAttributes();
	m_attributes.reserve(nattributes);
	for (int a=0; a<nattributes; a++)
	{
		const char *name=0;
		const char *value=0;
		if (root->getAttributeByIndex(a, &name, &value))
		{
			float f;
			int i;
			Vec3 v;
			if (!stricmp(value, "true"))
				SetAttribute(name, 1);
			else if (!stricmp(value, "false"))
				SetAttribute(name, 0);
			else if (IsInteger(value, &i))
				SetAttribute(name, i);
			else if (IsFloat(value, &f))
				SetAttribute(name, f);
			else if (IsVec3(value, &v))
				SetAttribute(name, v);
			else
				SetAttribute(name, value);
		}
	}

	int nchildren = root->getChildCount();
	m_children.reserve(nchildren);
	for (int c=0; c<nchildren; c++)
	{
		XmlNodeRef child = root->getChild(c);
		EXMLFilterType filterType = ShouldConvertNodeFromXML(child, keepWithThisAttrValue);
		filteringRequired = (filterType != eXMLFT_none) || filteringRequired ? true : false;

		if(filterType != eXMLFT_remove)
		{
			filteringRequired = (InsertChild(child->getTag())->ConvertFromXMLWithFiltering(child, keepWithThisAttrValue) || filteringRequired);
		}		
	}

	return filteringRequired;
}