BOOL COXLayoutManager::SetMinMax(UINT nChildWnd, CSize sizeMin, CSize sizeMax /* CSize(0,0) */)
{
	ASSERT(nChildWnd);

	int nIndex = GetChildIndex(nChildWnd);
	if (nIndex == -1)
	{
		nIndex = AddChild(nChildWnd, FALSE);
		if (nIndex == -1)
			return FALSE;
	}

	COXWndConstraint* pWC = m_wcTable[nIndex];
	if (sizeMin.cx <=0 && sizeMin.cy <=0 && sizeMax.cx <=0 && sizeMax.cy <=0)
	{
		if (pWC->bHasMinMax)
		{
			pWC->bHasMinMax = FALSE;
			m_nMinMaxCount--;
		}
	}
	else
	{
		if (!pWC->bHasMinMax)
		{
			pWC->bHasMinMax = TRUE;
			m_nMinMaxCount++;
		}
	}
	pWC->sizeMin = sizeMin;
	pWC->sizeMax = sizeMax;

	ResetContainerMinMax();
	return TRUE;
}
Пример #2
0
std::wstring CXmlUtil::GetField(const XMLDOMElementPtr& ele,
                                const wchar_t* filename,
                                const wchar_t* defaultText)
{
    NL(defaultText);
    std::wstring strValue (defaultText);
    LocalHResult hr;

    XMLDOMNodePtr pRet = NULL;
    GetChildIndex(ele, filename, 0, pRet);
    if (pRet != NULL)
    {
        BSTR bstr = NULL;
        hr = pRet->get_text(&bstr);
        if (bstr != NULL)
        {
            strValue = bstr;
            ::SysFreeString(bstr);
        }

        VARIANT_BOOL bHasChild;
        if (strValue.empty()
            && SUCCEEDED(hr = pRet->hasChildNodes(&bHasChild)) && bHasChild)
        {
            strValue = GetFieldCDATA(ele, filename, defaultText);
        }
    }

    return strValue;
}
Пример #3
0
void CParentNode::ExchangeChild( CNode *pChildNode, CNode *pNewNode )
{
	long pos = GetChildIndex( pChildNode );
	if( pos == -1 ) return;
	CNode *pNode = 0;
	ExchangeChild( pos, pNewNode, pNode );
}
BOOL COXLayoutManager::RemoveChild(UINT nChildWnd)
{
	ASSERT(nChildWnd);

	int nIndex = GetChildIndex(nChildWnd);
	if (nIndex == -1)
		return FALSE;

	// look for dependents of nChildWnd
	for (int i = 0; i < m_wcTable.GetSize(); i++)
	{
		COXWndConstraint* pWC = m_wcTable[i];
		for (int j = 0; j < 4; j++)
		{
			COXSideConstraint* pSC = &pWC->sc[j];
			if (pSC->nBaseWnd == nChildWnd)
			{
				TRACE2("COXLayoutManager::RemoveChild(): failed to remove child %d, window %d depends on it.\r\n", nChildWnd, pWC->nID);
				return FALSE;
			}
		}
	}

	COXWndConstraint* pWC = m_wcTable[nIndex];
	if (pWC->bHasMinMax)
		m_nMinMaxCount--;
	delete pWC;
	m_wcTable.RemoveAt(nIndex);
	ResetContainerMinMax();
	return TRUE;
}
Пример #5
0
void wxsListbook::OnAddChildQPP(wxsItem* Child,wxsAdvQPP* QPP)
{
    wxsListbookExtra* LBExtra = (wxsListbookExtra*)GetChildExtra(GetChildIndex(Child));
    if ( LBExtra )
    {
        QPP->Register(new wxsListbookParentQP(QPP,LBExtra),_("Listbook"));
    }
}
Пример #6
0
void wxsChoicebook::OnAddChildQPP(wxsItem* Child,wxsAdvQPP* QPP)
{
    wxsChoicebookExtra* Extra = (wxsChoicebookExtra*)GetChildExtra(GetChildIndex(Child));
    if ( Extra )
    {
        QPP->Register(new wxsChoicebookParentQP(QPP,Extra),_("Choicebook"));
    }
}
Пример #7
0
std::wstring CXmlUtil::GetFieldCDATA(const XMLDOMElementPtr& ele,
                                     const wchar_t* filename,
                                     const wchar_t* defaultText)
{
    XMLDOMNodePtr pRet = NULL;
    GetChildIndex(ele, filename, 0, pRet);
    return GetTextCDATA(pRet, defaultText);
}
Пример #8
0
void VNode::RemoveChild(VNode* pchild) //将pchild的父子关系去掉
{

	int index=GetChildIndex(pchild);
	if(index==-1)
		return;
	m_vChildList.erase(m_vChildList.begin()+index);//从子节点列表中移除
	pchild->m_parentnode=NULL;//置空父节点
}
Пример #9
0
HRESULT CXTPTaskPanelGroup::GetAccessibleDefaultAction(VARIANT varChild, BSTR* pszDefaultAction)
{
	if (GetChildIndex(&varChild) != CHILDID_SELF)
		return E_INVALIDARG;

	*pszDefaultAction = SysAllocString(L"Expand");

	return S_OK;
}
Пример #10
0
INT32 GenericTreeModel::GetChildCount(INT32 index)
{
	INT32 count = 0;
	for (INT32 child = GetChildIndex(index); child != -1; child = GetSiblingIndex(child))
	{
		count++;
	}
	return count;
}
Пример #11
0
void HKWidgetListbox::OnItemDown(HKWidget &widget, const HKWidgetEventInfo &ev)
{
	// a down stroke should immediately stop any innertial scrolling
	velocity = 0.f;
	scrollOffset = MFFloor(scrollOffset);

	if(!(flags & HoverSelect))
		SetSelection(GetChildIndex(&widget));
}
void UWidgetSwitcher::SetActiveWidget(UWidget* Widget)
{
	ActiveWidgetIndex = GetChildIndex(Widget);
	if ( MyWidgetSwitcher.IsValid() )
	{
		// Ensure the index is clamped to a valid range.
		int32 SafeIndex = FMath::Clamp(ActiveWidgetIndex, 0, FMath::Max(0, Slots.Num() - 1));
		MyWidgetSwitcher->SetActiveWidgetIndex(SafeIndex);
	}
}
Пример #13
0
bool wxsChoicebook::OnMouseClick(wxWindow* Preview,int PosX,int PosY)
{
    UpdateCurrentSelection();
    if ( GetChildCount()<2 ) return false;
    int NewIndex = GetChildIndex(m_CurrentSelection)+1;
    if ( NewIndex >= GetChildCount() ) NewIndex = 0;
    m_CurrentSelection = GetChild(NewIndex);
    GetResourceData()->SelectItem(m_CurrentSelection,true);
    return true;
}
Пример #14
0
bool CXmlUtil::GetChild(XMLDOMElementPtr& outEle,
                        const XMLDOMElementPtr& parent,
                        const wchar_t* pszChildName,
                        long nIndex)
{
    XMLDOMNodePtr pRet = NULL;
    GetChildIndex(parent, pszChildName, nIndex, pRet);
    outEle = pRet;
    return outEle != NULL;
}
Пример #15
0
bool UPanelWidget::RemoveChild(UWidget* Content)
{
	int32 ChildIndex = GetChildIndex(Content);
	if ( ChildIndex != -1 )
	{
		return RemoveChildAt(ChildIndex);
	}

	return false;
}
Пример #16
0
bool UPanelWidget::ReplaceChild(UWidget* CurrentChild, UWidget* NewChild)
{
	int32 Index = GetChildIndex(CurrentChild);
	if ( Index != -1 )
	{
		return ReplaceChildAt(Index, NewChild);
	}

	return false;
}
Пример #17
0
INT32 GenericTreeModel::GetNextLeafIndex(INT32 index)
{
	if (GetSubtreeSize(index) == 0)
	{
		// this is a leaf itself. Go up
		while (GetSiblingIndex(index) == -1 && index != -1)
			index = GetParentIndex(index);
		if (index == -1)
			return -1;
		
		index = GetSiblingIndex(index);
	}

	// Go down to the leaf
	while (GetChildIndex(index) != -1)
		index = GetChildIndex(index);

	return index;
}
Пример #18
0
int32 UBTCompositeNode::GetChildIndex(struct FBehaviorTreeSearchData& SearchData, const class UBTNode* ChildNode) const
{
	if (ChildNode->GetParentNode() != this)
	{
		FBTCompositeMemory* NodeMemory = GetNodeMemory<FBTCompositeMemory>(SearchData);
		return NodeMemory->CurrentChild;		
	}

	return GetChildIndex(ChildNode);
}
Пример #19
0
INT32 GenericTreeModel::GetLastChildIndex(INT32 index)
{
	INT32 child = GetChildIndex(index);

	for (INT32 next_child = GetSiblingIndex(child); next_child != -1; next_child = GetSiblingIndex(child))
	{
		child = next_child;
	}

	return child;
}
Пример #20
0
HRESULT CXTPTaskPanelGroup::AccessibleDoDefaultAction(VARIANT varChild)
{
	SAFE_MANAGE_STATE(m_pModuleState);

	if (GetChildIndex(&varChild) != CHILDID_SELF)
		return E_INVALIDARG;

	SetExpanded(!IsExpanded());

	return S_OK;
}
Пример #21
0
   void DeltaDrawablePrivate::RemoveChild(DeltaDrawable* child)
   {
      if (!child) return;

      unsigned int pos = GetChildIndex(child);
      if (pos < mChildList.size())
      {
         child->SetParent(NULL);
         child->AddedToScene(NULL);
         mChildList.erase(mChildList.begin() + pos);
      }
   }
Пример #22
0
MusSystem *MusPage::GetPrevious( MusSystem *system  )
{
    if ( !system || m_children.empty())
        return NULL;
        
	int i = GetChildIndex( system );

	if ((i == -1 ) || ( i <= 0 ))
        return NULL;
	
    return (MusSystem*)m_children[i - 1];
}
BOOL COXLayoutManager::GetMinMax(UINT nChildWnd, CSize& sizeMin, CSize& sizeMax)
{
	ASSERT(nChildWnd);

	int nIndex = GetChildIndex(nChildWnd);
	if (nIndex == -1)
		return FALSE;

	COXWndConstraint* pWC = m_wcTable[nIndex];
	sizeMin = pWC->sizeMin;
	sizeMax = pWC->sizeMax;
	return TRUE;
}
BOOL COXLayoutManager::SetConstraint(UINT nChildWnd, int nSide, int nType,
									 int nOffset /* = 0 */, UINT nBaseWnd /* = 0 */)
{
	ASSERT(nChildWnd);
	ASSERT(nType == OX_LMT_SAME || nType == OX_LMT_OPPOSITE || nType == OX_LMT_POSITION);

	// we add nBaseWnd first to linearlize window dependency better (faster when calculating)
	if (nBaseWnd && GetChildIndex(nBaseWnd) == -1)
		AddChild(nBaseWnd, FALSE);

	int nIndex = GetChildIndex(nChildWnd);
	if (nIndex == -1)
	{
		nIndex = AddChild(nChildWnd, FALSE);
		if (nIndex == -1)
			return FALSE;
	}

	for (int i = 0; i < 4; i++)
	{
		int nSingleSide = OX_INDEX_TO_LMS[i];
		if (nSide & nSingleSide)
		{
			COXSideConstraint* pSC = &m_wcTable[nIndex]->sc[i];

			BOOL bFlipSide=
				((nSingleSide & OX_LMS_MAJOR) && (nType == OX_LMT_OPPOSITE)) || 
				((nSingleSide & OX_LMS_MINOR) && (nType == OX_LMT_SAME));

			int nDefOffsetPos = (nType == OX_LMT_POSITION ? m_nBase : OX_LMOFFSET_ANY);
			pSC->nBaseWnd = nBaseWnd;
			pSC->nOffset1 = bFlipSide ? nDefOffsetPos : nOffset;
			pSC->nOffset2 = bFlipSide ? nOffset : nDefOffsetPos;
		}
	}

	ResetContainerMinMax();
	return TRUE;
}
Пример #25
0
HRESULT CXTPTaskPanelGroup::GetAccessibleState(VARIANT varChild, VARIANT* pvarState)
{
	if (GetChildIndex(&varChild) != CHILDID_SELF)
		return E_INVALIDARG;

	CXTPTaskPanelItem::GetAccessibleState(varChild, pvarState);

	if (IsExpanded())
		pvarState->lVal |= STATE_SYSTEM_EXPANDED;
	else
		pvarState->lVal |= STATE_SYSTEM_COLLAPSED;

	return S_OK;
}
void UBTDecorator_ConditionalLoop::OnNodeDeactivation(struct FBehaviorTreeSearchData& SearchData, EBTNodeResult::Type NodeResult)
{
	if (NodeResult != EBTNodeResult::Aborted && SearchData.OwnerComp)
	{
		const bool bEvalResult = EvaluateOnBlackboard(SearchData.OwnerComp->GetBlackboardComponent());
		UE_VLOG(SearchData.OwnerComp->GetOwner(), LogBehaviorTree, Verbose, TEXT("Loop condition: %s -> %s"),
			bEvalResult ? TEXT("true") : TEXT("false"), (bEvalResult != IsInversed()) ? TEXT("run again!") : TEXT("break"));

		if (bEvalResult != IsInversed())
		{
			GetParentNode()->SetChildOverride(SearchData, GetChildIndex());
		}
	}
}
void UWidgetSwitcher::OnDescendantSelected(UWidget* DescendantWidget)
{
	// Temporarily sets the active child to the selected child to make
	// dragging and dropping easier in the editor.
	UWidget* SelectedChild = UWidget::FindChildContainingDescendant(this, DescendantWidget);
	if ( SelectedChild )
	{
		int32 OverrideIndex = GetChildIndex(SelectedChild);
		if ( OverrideIndex != -1 && MyWidgetSwitcher.IsValid() )
		{
			MyWidgetSwitcher->SetActiveWidgetIndex(OverrideIndex);
		}
	}
}
Пример #28
0
void GenericTreeModel::Remove(INT32 index, BOOL all_children, BOOL delete_item)
{
	INT32 subtreesize = all_children ? GetSubtreeSize(index) : 0;

	BOOL broadcast = SetChangeType(TREE_CHANGED);

	GenericTreeModelItem* parent = GetGenericParentItem(index);

	if (broadcast)
	{
		BroadcastSubtreeRemoving(parent ? parent->GetIndex() : -1, index, subtreesize);
	}

	if (!all_children)
	{
		INT32 child = GetChildIndex(index);

		while (child != -1)
		{
			INT32 sibling = GetSiblingIndex(child);

			GetGenericItemByIndex(child)->SetGenericParentItem(parent);

			child = sibling;
		}
	}

	INT32 count = subtreesize + 1;

	Removing(index, count);
	UpdateSubtreeSizes(parent, -count);
	OpTreeModelItem* data;
	for(UINT32 i = index, count_item = index + count; i < count_item; i++)
		m_id_to_item.Remove(m_items.Get(i)->GetID(), &data);

	if (delete_item)
	{
		m_items.Delete(index, count);
	}
	else
	{
		m_items.Remove(index, count);
	}

	if (broadcast)
	{
		BroadcastSubtreeRemoved(parent ? parent->GetIndex() : -1, index, subtreesize);
	}
}
BOOL COXLayoutManager::RemoveConstraint(UINT nChildWnd, int nSide)
	{
	ASSERT(nChildWnd);

	int nIndex = GetChildIndex(nChildWnd);
	if (nIndex == -1)
		return FALSE;

	for (int i = 0; i < 4; i++)
		{
		if (nSide & OX_INDEX_TO_LMS[i])
			m_wcTable[nIndex]->sc[i].Empty();
		}
	ResetContainerMinMax();
	return TRUE;
	}
BOOL COXLayoutManager::GetConstraint(UINT nChildWnd, int nSide, int& nType,
									 int& nOffset, UINT& nBaseWnd)
	{
	ASSERT(nChildWnd);
	ASSERT(nSide == OX_LMS_TOP  || nSide == OX_LMS_BOTTOM ||
		   nSide == OX_LMS_LEFT || nSide == OX_LMS_RIGHT);

	int nIndex = GetChildIndex(nChildWnd);
	if (nIndex == -1)
		return FALSE;

	COXSideConstraint* pSC = &m_wcTable[nIndex]->sc[OX_LMS_TO_INDEX[nSide]];
	nBaseWnd = pSC->nBaseWnd;
	if (pSC->nOffset1 == OX_LMOFFSET_ANY)
	{
		if (pSC->nOffset2 == OX_LMOFFSET_ANY)
		{
			nType = 0;
			nOffset = OX_LMOFFSET_ANY;
		}
		else
		{
			nType = (nSide & OX_LMS_MINOR) ? OX_LMT_SAME : OX_LMT_OPPOSITE;
			nOffset = pSC->nOffset2;
		}
	}
	else
	{
		if (pSC->nOffset2 == OX_LMOFFSET_ANY)
		{
			nType = (nSide & OX_LMS_MAJOR) ? OX_LMT_SAME : OX_LMT_OPPOSITE;
			nOffset = pSC->nOffset1;
		}
		else
		{
			nType = OX_LMT_POSITION;
			ASSERT (pSC->nOffset2);
			nOffset = (int)(pSC->nOffset1 * m_nBase / pSC->nOffset2);
		}
	}

	return TRUE;
}