CXTPMarkupObject* CXTPMarkupKeyboardNavigation::GetTreeNextSibling(CXTPMarkupObject* e)
{
	CXTPMarkupObject* parent = GetParent(e);

	{
		CXTPMarkupVisual* reference = MARKUP_DYNAMICCAST(CXTPMarkupVisual, parent);
		CXTPMarkupObject* obj4 = MARKUP_DYNAMICCAST(CXTPMarkupVisual, e);

		if ((reference != NULL) && obj4)
		{
			int childrenCount = reference->GetVisualChildrenCount();
			int childIndex = 0;
			while (childIndex < childrenCount)
			{
				if (reference->GetVisualChild(childIndex) == obj4)
				{
					break;
				}
				childIndex++;
			}
			childIndex++;
			while (childIndex < childrenCount)
			{
				CXTPMarkupObject* child = reference->GetVisualChild(childIndex);

				if (IsInNavigationTree(child))
				{
					return child;
				}
				childIndex++;
			}
		}
	}
	return NULL;
}
예제 #2
0
void CXTPMarkupDefinitionBase::OnDefinitionPropertyChanged(CXTPMarkupObject* d, CXTPMarkupPropertyChangedEventArgs* /*e*/)
{
	CXTPMarkupDefinitionBase* pDefinition = MARKUP_DYNAMICCAST(CXTPMarkupDefinitionBase, d);
	if (!pDefinition)
		return;

	CXTPMarkupGrid* pGrid = MARKUP_DYNAMICCAST(CXTPMarkupGrid, pDefinition->GetLogicalParent() ? pDefinition->GetLogicalParent()->GetLogicalParent() : NULL);
	if (!pGrid)
		return;

	pGrid->InvalidateMeasure();
}
예제 #3
0
void CXTPMarkupGrid::OnCellAttachedPropertyChanged(CXTPMarkupObject* d, CXTPMarkupPropertyChangedEventArgs* /*e*/)
{
	CXTPMarkupUIElement* pVisual = MARKUP_DYNAMICCAST(CXTPMarkupUIElement, d);
	if (!pVisual)
		return;

	CXTPMarkupGrid* pGrid = MARKUP_DYNAMICCAST(CXTPMarkupGrid, pVisual->GetVisualParent());
	if (!pGrid)
		return;

	pGrid->InvalidateMeasure();
}
CXTPMarkupObject* CXTPMarkupKeyboardNavigation::GetTreeFirstChild(CXTPMarkupObject* e)
{
	CXTPMarkupObject* obj2 = FocusedElement(e);
	if (obj2 != NULL)
	{
		return obj2;
	}

	CXTPMarkupUIElement* o = MARKUP_DYNAMICCAST(CXTPMarkupUIElement, e);
	if (o != NULL && o->IsVisible())
	{
		CXTPMarkupVisual* reference = o;

		if (reference != NULL)
		{
			int childrenCount = reference->GetVisualChildrenCount();
			for (int i = 0; i < childrenCount; i++)
			{
				CXTPMarkupVisual* child = reference->GetVisualChild(i);
				if (IsInNavigationTree(child))
				{
					return child;
				}

				CXTPMarkupObject* firstChild = GetTreeFirstChild(child);
				if (firstChild != NULL)
				{
					return firstChild;
				}
			}
		}
	}
	return NULL;
}
예제 #5
0
void CXTPMarkupUIElement::InvalidateMeasureOverride(CXTPMarkupDrawingContext* pDC)
{
	if (!m_bMeasureInProgress && !m_bNeverMeasured)
	{
		m_bMeasureDirty = TRUE;
		m_bArrangeDirty = TRUE;

		CSize sz = GetDesiredSize();

		Measure(pDC, m_szPreviousAvailableSize);

		if (sz != GetDesiredSize())
		{
			m_bMeasureDirty = TRUE;
			m_bArrangeDirty = TRUE;

			CXTPMarkupUIElement* pParent = MARKUP_DYNAMICCAST(CXTPMarkupUIElement, GetVisualParent());
			if (pParent)
			{
				pParent->InvalidateMeasureOverride(pDC);
			}
			else if (m_pMarkupContext)
			{
				m_pMarkupContext->OnInvalidateArrange(this);
			}
		}
		else
		{
			Arrange(m_rcFinalRect);
			InvalidateVisual();
		}
	}
}
예제 #6
0
void CXTPMarkupUIElementCollection::OnChanged()
{
	CXTPMarkupUIElement* pPanel = MARKUP_DYNAMICCAST(CXTPMarkupUIElement, GetLogicalParent());
	if (pPanel)
	{
		pPanel->InvalidateMeasure();
	}
}
BOOL CXTPMarkupKeyboardNavigation::IsInNavigationTree(CXTPMarkupObject* pVisual)
{
	CXTPMarkupUIElement* pElement = MARKUP_DYNAMICCAST(CXTPMarkupUIElement, pVisual);
	if ((pElement != NULL) && (pElement->IsVisible()))
	{
		return TRUE;
	}

	return FALSE;
}
void CXTPMarkupInputElement::OnCursorPropertyChanged(CXTPMarkupObject* d, CXTPMarkupPropertyChangedEventArgs* /*e*/)
{
	CXTPMarkupInputElement* pElement = MARKUP_DYNAMICCAST(CXTPMarkupInputElement, d);
	if (!pElement)
	{
		ASSERT(FALSE);
		return;
	}

	pElement->GetMarkupContext()->HandleSetCursor();

}
void CXTPMarkupInputElement::OnStylePropertyChanged(CXTPMarkupObject* d, CXTPMarkupPropertyChangedEventArgs* e)
{
	CXTPMarkupInputElement* pElement = MARKUP_DYNAMICCAST(CXTPMarkupInputElement, d);
	if (!pElement)
	{
		ASSERT(FALSE);
		return;
	}

	CXTPMarkupStyle* pStyle = MARKUP_STATICCAST(CXTPMarkupStyle, e->m_pNewValue);

	if (pStyle)
	{
		pStyle->Seal();
	}

	pElement->m_pStyleCache = pStyle;
}
void CXTPMarkupInputElement::OnApply()
{
	if (m_pStyleCache == NULL)
	{
		CXTPMarkupType* pType = GetType();
		if (!pType)
			return;

		CXTPMarkupStyle* pStyle = MARKUP_DYNAMICCAST(CXTPMarkupStyle, FindResource(pType));
		if (pStyle)
		{
			pStyle->Seal();
			m_pStyleCache = pStyle;
		}
	}

	if (m_pStyleCache != NULL)
	{
		FireTriggers(NULL, NULL);
	}
}