//*****************************************************************************	
bool CCeWatchElement::SetChild(int ii, CCeWatchElement* pChild)
//*****************************************************************************	
{
	ASSERT(IsValidWatchElement(pChild)); 	
	ASSERT(ii >= 0 && ii < GetChildrenCount());
	if (pChild != NULL && ii >= 0 && ii < GetChildrenCount())
	{
		m_ChildrenArray.SetAt(ii, pChild);
		pChild->SetParent(this);
		pChild->m_pRoot = m_pRoot;
	}
	return true;
}
Exemplo n.º 2
0
void UButton::PostLoad()
{
	Super::PostLoad();

	if ( GetChildrenCount() > 0 )
	{
		//TODO UMG Pre-Release Upgrade, now buttons have slots of their own.  Convert existing slot to new slot.
		if ( UPanelSlot* PanelSlot = GetContentSlot() )
		{
			UButtonSlot* ButtonSlot = Cast<UButtonSlot>(PanelSlot);
			if ( ButtonSlot == NULL )
			{
				ButtonSlot = NewObject<UButtonSlot>(this);
				ButtonSlot->Content = GetContentSlot()->Content;
				ButtonSlot->Content->Slot = ButtonSlot;
				Slots[0] = ButtonSlot;
			}
		}
	}

	if( GetLinkerUE4Version() < VER_UE4_DEPRECATE_UMG_STYLE_ASSETS && Style_DEPRECATED != nullptr )
	{
		const FButtonStyle* StylePtr = Style_DEPRECATED->GetStyle<FButtonStyle>();
		if(StylePtr != nullptr)
		{
			WidgetStyle = *StylePtr;
		}

		Style_DEPRECATED = nullptr;
	}
}
Exemplo n.º 3
0
TSharedRef<SWidget> UNamedSlot::RebuildWidget()
{
	MyBox = SNew(SBox);

	if ( IsDesignTime() )
	{
		MyBox->SetContent(
			SNew(SBox)
			.HAlign(HAlign_Center)
			.VAlign(VAlign_Center)
			[
				SNew(STextBlock)
				.Text(FText::FromName(GetFName()))
			]
		);
	}

	// Add any existing content to the new slate box
	if ( GetChildrenCount() > 0 )
	{
		UPanelSlot* ContentSlot = GetContentSlot();
		if ( ContentSlot->Content )
		{
			MyBox->SetContent(ContentSlot->Content->TakeWidget());
		}
	}

	return MyBox.ToSharedRef();
}
Exemplo n.º 4
0
void UBorder::PostLoad()
{
	Super::PostLoad();

	if ( GetLinkerUE4Version() < VER_UE4_DEPRECATE_UMG_STYLE_ASSETS && Brush_DEPRECATED != nullptr )
	{
		Background = Brush_DEPRECATED->Brush;
		Brush_DEPRECATED = nullptr;
	}

	if ( GetChildrenCount() > 0 )
	{
		//TODO UMG Pre-Release Upgrade, now have slots of their own.  Convert existing slot to new slot.
		if ( UPanelSlot* PanelSlot = GetContentSlot() )
		{
			UBorderSlot* BorderSlot = Cast<UBorderSlot>(PanelSlot);
			if ( BorderSlot == NULL )
			{
				BorderSlot = NewObject<UBorderSlot>(this);
				BorderSlot->Content = GetContentSlot()->Content;
				BorderSlot->Content->Slot = BorderSlot;
				Slots[0] = BorderSlot;
			}
		}
	}
}
Exemplo n.º 5
0
int wxSTEditorTreeCtrl::DeleteItem(const wxTreeItemId& id_, bool delete_empty,
                                   int levels, const wxTreeItemId& topId)
{
    int n = 0;
    wxTreeItemId id = id_;

    if (!id)
        return 0;
    else if (!delete_empty)
    {
        if (id == m_notePageId) m_notePageId = wxTreeItemId();

        Delete(id);
        n++;
    }
    else
    {
        // back up the tree and delete all parents that have no other children
        wxTreeItemId parentId_last;
        wxTreeItemId parentId = GetItemParent(id);
        wxTreeItemId rootId = GetRootItem();
        if (id == m_notePageId) m_notePageId = wxTreeItemId();
        Delete(id);
        n++;

        while( parentId && (parentId != rootId) && (parentId != topId) &&
               ((n <= levels) || (levels == -1)))
        {
            unsigned int child_count = GetChildrenCount(parentId, false);

            if (child_count <= 1)
            {
                // verify that if a single child that it's not a file
                if (child_count == 1)
                {
                    wxTreeItemIdValue cookie;
                    wxTreeItemId childId = GetFirstChild(parentId, cookie);
                    wxSTETreeItemData* itemData = (wxSTETreeItemData*)GetItemData(childId);
                    if (itemData && (itemData->m_page_num != -1))
                        break;
                }

                // no other children in this node, try next parent
                parentId_last = parentId;
                parentId = GetItemParent(parentId);
                n++;
            }
            else
                break;
        }

        if (parentId_last)
        {
            if (parentId_last == m_notePageId) m_notePageId = wxTreeItemId();
            Delete(parentId_last);
        }
    }

    return n;
}
Exemplo n.º 6
0
void
SamplesTreeCtrl::onChangeSampleSpeaker( char const *speakerName, smp::Sample *sample )
{
	// Is there a speaker of this new name?
	wxTreeItemId speakerItem = getSpeaker( speakerName );
	wxTreeItemId speechItem  = getTreeItem( sample );

	if ( speakerItem.IsOk() )
	{
		// The speaker of this name already exists.
		// So I merge the item into that tree.

		wxTreeItemId currentSpeakerItem = getSpeaker( speechItem );
		if ( currentSpeakerItem.IsOk() )
			SelectItem( changeSpeaker( speechItem, currentSpeakerItem, speakerItem ) );
	}
	else
	{
		// The speaker doesn't already exist.

		speakerItem = getSpeaker( speechItem );

		// Do I have siblings?
		if ( GetChildrenCount( speakerItem ) == 1 )
			// There's nobody else. I should change the speaker name in place.
			SetItemText( speakerItem, speakerName );
		else
		{
			// I have a different name than my siblings, I should create a
			// new parent and move there.
			wxTreeItemId newSpeakerItem = AppendItem( GetRootItem(), speakerName );
			SelectItem( changeSpeaker( speechItem, speakerItem, newSpeakerItem ) );
		}
	}
}
Exemplo n.º 7
0
void	CMorphAutomat::GetAllMorphInterpsRecursive (int NodeNo, string& curr_path, vector<CAutomAnnotationInner>& Infos) const
{
    const CMorphAutomNode& N = m_pNodes[NodeNo];
    if (N.IsFinal())
    {
        CAutomAnnotationInner A;
        DWORD i = DecodeFromAlphabet(curr_path);
        size_t ItemNo;
        size_t ModelNo;
        size_t PrefixNo;
        DecodeMorphAutomatInfo(i, ModelNo, ItemNo, PrefixNo);
        A.m_ItemNo = ItemNo;
        A.m_ModelNo =  ModelNo;
        A.m_PrefixNo = PrefixNo;
        Infos.push_back(A);
    };

    size_t Count =  GetChildrenCount(NodeNo);
    size_t CurrPathSize = curr_path.size();
    curr_path.resize(CurrPathSize + 1);
    for (size_t i=0; i<Count; i++)
    {
        const CMorphAutomRelation& p = GetChildren(NodeNo)[i];
        curr_path[CurrPathSize] = p.GetRelationalChar();
        GetAllMorphInterpsRecursive(p.GetChildNo(), curr_path, Infos);
    };
    curr_path.resize(CurrPathSize);
};
Exemplo n.º 8
0
UPanelSlot* UPanelWidget::AddChild(UWidget* Content)
{
	if ( Content == nullptr )
	{
		return nullptr;
	}

	if ( !bCanHaveMultipleChildren && GetChildrenCount() > 0 )
	{
		return nullptr;
	}

	Content->RemoveFromParent();

	UPanelSlot* PanelSlot = NewObject<UPanelSlot>(this, GetSlotClass());
	PanelSlot->SetFlags(RF_Transactional);
	PanelSlot->Content = Content;
	PanelSlot->Parent = this;

	if ( Content )
	{
		Content->Slot = PanelSlot;
	}

	Slots.Add(PanelSlot);

	OnSlotAdded(PanelSlot);

	InvalidateLayoutAndVolatility();

	return PanelSlot;
}
Exemplo n.º 9
0
        wxTreeItemId HierTreeCtrl::MoveItem(wxTreeItemId& source, wxTreeItemId& destination, wxTreeItemId& parent)
        {
            wxTreeItemId newItem;
            if (parent != destination)
            {
                newItem = InsertItem(parent, destination, GetItemText(source), GetItemImage(source), -1,
                                    new HierTreeItemData(*(HierTreeItemData*)GetItemData(source)));
            }
            else
            {
                newItem = AppendItem(parent, GetItemText(source), GetItemImage(source), -1,
                                    new HierTreeItemData(*(HierTreeItemData*)GetItemData(source)));
            }

            // Move all the children from the old parent to the new one recursively
            wxTreeItemIdValue cookie;
            wxTreeItemId oldChild = GetFirstChild(source, cookie);
            while (GetChildrenCount(source, false) > 0)
            {
                MoveItem(oldChild, newItem, newItem);
                oldChild = GetFirstChild(source, cookie);
            }

            Delete(source);
            return newItem;
        }
Exemplo n.º 10
0
CItem *CItem::FindDirectoryByPath(const CString& path)
{
	CString myPath = GetPath();
	myPath.MakeLower();

	int i=0;
	while (i < myPath.GetLength() && i < path.GetLength() && myPath[i] == path[i])
		i++;

	if (i < myPath.GetLength())
		return NULL;

	if (i >= path.GetLength())
	{
		ASSERT(myPath == path);
		return this;
	}

	for (i=0; i < GetChildrenCount(); i++)
	{
		CItem *item = GetChild(i)->FindDirectoryByPath(path);
		if (item != NULL)
			return item;
	}

	return NULL;
}
Exemplo n.º 11
0
void CItem::RecurseCollectExtensionData(CExtensionData *ed)
{
	GetApp()->PeriodicalUpdateRamUsage();

	if (IsLeaf(GetType()))
	{
		if (GetType() == IT_FILE)
		{
			CString ext = GetExtension();
			SExtensionRecord r;
			if (ed->Lookup(ext, r))
			{
				r.bytes += GetSize();
				r.files++;
			}
			else
			{
				r.bytes = GetSize();
				r.files = 1;
			}
			ed->SetAt(ext, r);
		}
	}
	else
	{
		for (int i=0; i < GetChildrenCount(); i++)
		{
			GetChild(i)->RecurseCollectExtensionData(ed);
		}
	}
}
Exemplo n.º 12
0
void CTrieHolder::InitFailureFunction()
{
    assert (!m_Nodes.empty());

    yvector<size_t> BFS;
    BFS.push_back(0);

    //  going breadth-first search
    for (size_t i=0; i < BFS.size(); i++) {
        const CTrieNode& Parent = m_Nodes[BFS[i]];
        size_t ChildrenCount =  GetChildrenCount(BFS[i]);
        for (size_t j=0; j<ChildrenCount; j++) {
            const CTrieRelation& p = GetChildren(BFS[i])[j];

            //  going upside using following failure function in order to find the first node which
            //  has a way downward with symbol RelationChar
            int r =  Parent.m_FailureFunction;
            while ((r != -1) &&  (FindChild(r,p.m_RelationChar) == -1))
                r = m_Nodes[r].m_FailureFunction;

            if (r != -1) {
                //  the way is found
                m_Nodes[p.m_ChildNo].m_FailureFunction = FindChild(r,p.m_RelationChar);
            } else
                // no way is found, should start from the beginning
                m_Nodes[p.m_ChildNo].m_FailureFunction = 0;

            BFS.push_back(p.m_ChildNo);
        };
    };
};
Exemplo n.º 13
0
int CItem::FindChildIndex(const CItem *child) const
{
	for (int i=0; i < GetChildrenCount(); i++)
		if (child == m_children[i])
			return i;
	ASSERT(0);
	return 0;
}
Exemplo n.º 14
0
CItem *CItem::FindUnknownItem() const
{
	int i = FindUnknownItemIndex();
	if (i < GetChildrenCount())
		return GetChild(i);
	else
		return NULL;
}
Exemplo n.º 15
0
void CTrieHolder::UpdatePossibleOutputSymbolsbyOnState(size_t NodeNo,  yvector<bool>& PossibleOutputSymbols) const
{
    size_t Count =  GetChildrenCount(NodeNo);
    for (size_t i=0; i<Count; i++) {
        const CTrieRelation& p = GetChildren(NodeNo)[i];
        PossibleOutputSymbols[p.m_RelationChar] = true;
    };
};
Exemplo n.º 16
0
void UPanelWidget::ClearChildren()
{
	int32 Children = GetChildrenCount();
	for ( int32 ChildIndex = 0; ChildIndex < Children; ChildIndex++ )
	{
		RemoveChildAt(0);
	}
}
Exemplo n.º 17
0
void ImposterNode::Draw()
{
	if(!RenderManager::Instance()->GetOptions()->IsOptionEnabled(RenderOptions::IMPOSTERS_ENABLE) && GetChildrenCount() > 0)
	{
		DVASSERT(GetChildrenCount() == 1);
		GetChild(0)->Draw();
	}
}
Exemplo n.º 18
0
geometry UIElement::MakeVisibleGeometry(geometry clip)
{
	m_visibleGeometryValid = true;

	//gm::RectF bounds = clip.GetBounds();

	geometry clipThis = get_Clip();
	if (clipThis != nullptr)
	{
		clip &= clipThis;
	}

#ifdef _DEBUG
	gm::RectF bounds = clip.GetBounds();
#endif

	geometry geom = GetHitGeometry();
#ifdef _DEBUG
	gm::RectF bounds2 = geom.GetBounds();
#endif

	clip &= geom;

#ifdef _DEBUG
	gm::RectF bounds3 = clip.GetBounds();
#endif

	size_t nchildren = GetChildrenCount();
	for (size_t i = nchildren; i > 0; --i)
	{
		Visual* child = GetChild(i-1);

		geometry geom2 = child->MakeVisibleGeometry(clip);

		clip |= geom2;
	}

	UIElement* shadowTree = get_ShadowTree();
	if (shadowTree)
	{
		geometry geom2 = shadowTree->MakeVisibleGeometry(clip);

#ifdef _DEBUG
	gm::RectF bounds5 = geom2.GetBounds();
#endif

		clip |= geom2;
	}

#ifdef _DEBUG
	gm::RectF bounds4 = clip.GetBounds();
#endif

	set_VisibleGeometry(clip);

	return clip;
}
Exemplo n.º 19
0
int CItem::FindUnknownItemIndex() const
{
	int i;
	for (i=0; i < GetChildrenCount(); i++)
	{
		if (GetChild(i)->GetType() == IT_UNKNOWN)
			break;
	}
	return i; // maybe == GetChildrenCount() (=> not found)
}
Exemplo n.º 20
0
int CItem::FindFreeSpaceItemIndex() const
{
	int i;
	for (i=0; i < GetChildrenCount(); i++)
	{
		if (GetChild(i)->GetType() == IT_FREESPACE)
			break;
	}
	return i; // maybe == GetChildrenCount() (=> not found)
}
Exemplo n.º 21
0
CString CBoxHolder::ToMathML()
{
	int i;
	CString tab="";
	CString st;
	BOOL bObmit=(GetChildrenCount()==1 && GetBox(0)->ClassName()!="MSymbol");
	if (!bObmit)
		st=tab + "<mrow>" + crlf;
	else
		st="";
	for (i=0; i<GetChildrenCount(); i++)
		if (!bObmit)
			st+=GetBox(i)->ToMathML(1) + crlf;
		else
			st+=GetBox(i)->ToMathML(0);
	if (!bObmit)
		st+=tab + "</mrow>";
	return st;
}
Exemplo n.º 22
0
void CItem::RemoveAllChildren()
{
	GetTreeListControl()->OnRemovingAllChildren(this);

	for (int i=0; i < GetChildrenCount(); i++)
	{
		delete m_children[i];
	}
	m_children.SetSize(0);
}
Exemplo n.º 23
0
//----------------------------------------
int32_t CFieldsTreeCtrl::GetRecordCount()
{
  wxTreeItemId rootId = GetRootItem();
  if (!rootId)
  {
    return 0;
  }

  return GetChildrenCount(rootId, false);
}
Exemplo n.º 24
0
int CTrieHolder::FindChild(int NodeNo, TerminalSymbolType RelationChar) const
{
    size_t Count =  GetChildrenCount(NodeNo);
    for (size_t i=0; i<Count; i++) {
        const CTrieRelation& p = GetChildren(NodeNo)[i];
        if (p.m_RelationChar == RelationChar)
            return p.m_ChildNo;
    };
    return -1;
};
Exemplo n.º 25
0
void CItem::RefreshRecycler()
{
	ASSERT(GetType() == IT_DRIVE);
	DWORD dummy;
	CString system;
	BOOL b = GetVolumeInformation(GetPath(), NULL, 0, NULL, &dummy, &dummy, system.GetBuffer(128), 128);
	system.ReleaseBuffer();
	if (!b)
	{
		TRACE(_T("GetVolumeInformation(%s) failed.\n"), GetPath());
		return; // nix zu machen
	}

	CString recycler;
	if (system.CompareNoCase(_T("NTFS")) == 0)
	{
		recycler = _T("recycler");
	}
	else if (system.CompareNoCase(_T("FAT32")) == 0)
	{
		recycler = _T("recycled");
	}
	else
	{
		TRACE(_T("%s: unknown file system type %s\n"), GetPath(), system);
		return; // nix zu machen.
	}

	int i;
	for (i=0; i < GetChildrenCount(); i++)
	{
		if (GetChild(i)->GetName().CompareNoCase(recycler) == 0)
			break;
	}
	if (i >= GetChildrenCount())
	{
		TRACE(_T("%s: Recycler(%s) not found.\n"), GetPath(), recycler);
		return; // nicht gefunden
	}

	GetChild(i)->StartRefresh();
}
Exemplo n.º 26
0
LONGLONG CItem::GetProgressRangeMyComputer() const
{
	ASSERT(GetType() == IT_MYCOMPUTER);

	LONGLONG range = 0;
	for (int i = 0; i < GetChildrenCount(); i++)
	{
		range += GetChild(i)->GetProgressRangeDrive();
	}
	return range;
}
Exemplo n.º 27
0
LONGLONG CItem::GetProgressPosMyComputer() const
{
	ASSERT(GetType() == IT_MYCOMPUTER);

	LONGLONG pos = 0;
	for (int i = 0; i < GetChildrenCount(); i++)
	{
		pos += GetChild(i)->GetProgressPosDrive();
	}
	return pos;
}
Exemplo n.º 28
0
TSharedRef<SWidget> UBorder::RebuildWidget()
{
	MyBorder = SNew(SBorder);
	
	if ( GetChildrenCount() > 0 )
	{
		Cast<UBorderSlot>(GetContentSlot())->BuildSlot(MyBorder.ToSharedRef());
	}

	return BuildDesignTimeWidget( MyBorder.ToSharedRef() );
}
Exemplo n.º 29
0
void EditorScene::AddEditorEntity(Entity *editorEntity)
{
    if(GetChildrenCount())
    {
        InsertBeforeNode(editorEntity, GetChild(0));
    }
    else
    {
        AddNode(editorEntity);
    }
}
Exemplo n.º 30
0
TSharedRef<SWidget> USizeBox::RebuildWidget()
{
	MySizeBox = SNew(SBox);
	
	if ( GetChildrenCount() > 0 )
	{
		Cast<USizeBoxSlot>(GetContentSlot())->BuildSlot(MySizeBox.ToSharedRef());
	}

	return BuildDesignTimeWidget( MySizeBox.ToSharedRef() );
}