CXTPMarkupObject* CXTPMarkupKeyboardNavigation::GetParent(CXTPMarkupObject* e)
{
	if (!e)
		return NULL;

	if (e->IsKindOf(MARKUP_TYPE(CXTPMarkupVisual)))
	{
		CXTPMarkupVisual* reference = ((CXTPMarkupVisual*)e)->GetVisualParent();
		while (reference != NULL)
		{
			if (IsInNavigationTree(reference))
			{
				return reference;
			}

			reference = reference->GetVisualParent();
		}
	}
	else if (e->IsKindOf(MARKUP_TYPE(CXTPMarkupFrameworkContentElement)))
	{
		return (CXTPMarkupObject*)(((CXTPMarkupFrameworkContentElement*)e)->GetParent());
	}

	return NULL;
}
Ejemplo n.º 2
0
void CXTPMarkupGrid::SetPropertyObject(CXTPMarkupBuilder* pBuilder, CXTPMarkupDependencyProperty* pProperty, CXTPMarkupObject* pValue)
{
	if (pProperty == m_pColumnDefinitionsProperty)
	{
		if (!pValue || !pValue->IsKindOf(MARKUP_TYPE(CXTPMarkupColumnDefinitionCollection)))
		{
			pBuilder->ThrowBuilderException(_T("CXTPMarkupColumnDefinitionCollection class expected"));
		}

		MARKUP_RELEASE(m_pColumnDefinitions);
		m_pColumnDefinitions = (CXTPMarkupColumnDefinitionCollection*)pValue;
		m_pColumnDefinitions->SetLogicalParent(this);
	}
	else if (pProperty == m_pRowDefinitionsProperty)
	{
		if (!pValue || !pValue->IsKindOf(MARKUP_TYPE(CXTPMarkupRowDefinitionCollection)))
		{
			pBuilder->ThrowBuilderException(_T("CXTPMarkupRowDefinitionCollection class expected"));
		}

		MARKUP_RELEASE(m_pRowDefinitions);
		m_pRowDefinitions = (CXTPMarkupRowDefinitionCollection*)pValue;
		m_pRowDefinitions->SetLogicalParent(this);

	}
	else
	{
		CXTPMarkupPanel::SetPropertyObject(pBuilder, pProperty, pValue);
	}
}
void CXTPMarkupKeyboardNavigation::RegisterMarkupClass()
{
	m_pIsTabStopProperty = CXTPMarkupDependencyProperty::RegisterAttached(L"IsTabStop", MARKUP_TYPE(CXTPMarkupBool), MARKUP_TYPE(CXTPMarkupKeyboardNavigation),
		new CXTPMarkupPropertyMetadata(CXTPMarkupBool::CreateTrueValue()));

	m_pTabNavigationProperty = CXTPMarkupDependencyProperty::RegisterAttached(L"TabNavigation", MARKUP_TYPE(CXTPMarkupEnum), MARKUP_TYPE(CXTPMarkupKeyboardNavigation),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupKeyboardNavigation::ConvertKeyboardNavigationMode));

	m_pTabIndexProperty = CXTPMarkupDependencyProperty::RegisterAttached(L"TabIndex", MARKUP_TYPE(CXTPMarkupInt), MARKUP_TYPE(CXTPMarkupKeyboardNavigation),
		new CXTPMarkupPropertyMetadata(new CXTPMarkupInt(INT_MAX)));
}
Ejemplo n.º 4
0
void CXTPMarkupRowDefinition::RegisterMarkupClass()
{
	m_pHeightProperty = CXTPMarkupDependencyProperty::Register(L"Height", MARKUP_TYPE(CXTPMarkupGridLength), MARKUP_TYPE(CXTPMarkupRowDefinition),
		new CXTPMarkupPropertyMetadata(new CXTPMarkupGridLength(1, CXTPMarkupGridLength::unitTypeStar), &CXTPMarkupDefinitionBase::OnDefinitionPropertyChanged));

	m_pMinHeightProperty = CXTPMarkupDependencyProperty::Register(L"MinHeight", MARKUP_TYPE(CXTPMarkupInt), MARKUP_TYPE(CXTPMarkupRowDefinition),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupDefinitionBase::OnDefinitionPropertyChanged));

	m_pMaxHeightProperty = CXTPMarkupDependencyProperty::Register(L"MaxHeight", MARKUP_TYPE(CXTPMarkupInt), MARKUP_TYPE(CXTPMarkupRowDefinition),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupDefinitionBase::OnDefinitionPropertyChanged));
}
Ejemplo n.º 5
0
void CXTPMarkupUIElement::RegisterMarkupClass()
{
	m_pClipToBoundsProperty = CXTPMarkupDependencyProperty::Register(L"ClipToBounds", MARKUP_TYPE(CXTPMarkupBool), MARKUP_TYPE(CXTPMarkupUIElement));

	m_pVisibilityProperty = CXTPMarkupDependencyProperty::Register(L"Visibility", MARKUP_TYPE(CXTPMarkupEnum), MARKUP_TYPE(CXTPMarkupUIElement),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupBuilder::ConvertVisibility, CXTPMarkupPropertyMetadata::flagAffectsMeasure));

	m_pFocusableProperty = CXTPMarkupDependencyProperty::Register(L"Focusable", MARKUP_TYPE(CXTPMarkupBool), MARKUP_TYPE(CXTPMarkupUIElement),
		new CXTPMarkupPropertyMetadata(CXTPMarkupBool::CreateFalseValue()));

	m_pIsEnabledProperty = CXTPMarkupDependencyProperty::Register(L"IsEnabled", MARKUP_TYPE(CXTPMarkupBool), MARKUP_TYPE(CXTPMarkupUIElement),
		new CXTPMarkupPropertyMetadata(CXTPMarkupBool::CreateTrueValue()));
}
BOOL CXTPMarkupKeyboardNavigation::IsTabStop(CXTPMarkupObject* e)
{
	if (e->IsKindOf(MARKUP_TYPE(CXTPMarkupFrameworkElement)))
	{
		CXTPMarkupFrameworkElement* pElement = (CXTPMarkupFrameworkElement*)e;
		return pElement->IsFocusable() && GetBoolValue(pElement, m_pIsTabStopProperty) && pElement->IsEnabled() && pElement->IsVisible();
	}
	else if (e->IsKindOf(MARKUP_TYPE(CXTPMarkupFrameworkContentElement)))
	{
		return FALSE;
	}

	return FALSE;
}
Ejemplo n.º 7
0
void CXTPMarkupGrid::RegisterMarkupClass()
{
	m_pColumnDefinitionsProperty = CXTPMarkupDependencyProperty::Register(L"ColumnDefinitions", MARKUP_TYPE(CXTPMarkupColumnDefinitionCollection), MARKUP_TYPE(CXTPMarkupGrid));

	m_pRowDefinitionsProperty = CXTPMarkupDependencyProperty::Register(L"RowDefinitions", MARKUP_TYPE(CXTPMarkupRowDefinitionCollection), MARKUP_TYPE(CXTPMarkupGrid));

	m_pColumnProperty = CXTPMarkupDependencyProperty::RegisterAttached(L"Column", MARKUP_TYPE(CXTPMarkupInt), MARKUP_TYPE(CXTPMarkupGrid),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupGrid::OnCellAttachedPropertyChanged));

	m_pRowProperty = CXTPMarkupDependencyProperty::RegisterAttached(L"Row", MARKUP_TYPE(CXTPMarkupInt), MARKUP_TYPE(CXTPMarkupGrid),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupGrid::OnCellAttachedPropertyChanged));

	m_pColumnSpanProperty = CXTPMarkupDependencyProperty::RegisterAttached(L"ColumnSpan", MARKUP_TYPE(CXTPMarkupInt), MARKUP_TYPE(CXTPMarkupGrid),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupGrid::OnCellAttachedPropertyChanged));

	m_pRowSpanProperty = CXTPMarkupDependencyProperty::RegisterAttached(L"RowSpan", MARKUP_TYPE(CXTPMarkupInt), MARKUP_TYPE(CXTPMarkupGrid),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupGrid::OnCellAttachedPropertyChanged));
}
Ejemplo n.º 8
0
CXTPMarkupVisual* CXTPMarkupVisual::GetVisualParent() const
{
	CXTPMarkupObject* pUIElement = m_pLogicalParent;

	while (pUIElement && !pUIElement->IsKindOf(MARKUP_TYPE(CXTPMarkupVisual)))
	{
		pUIElement = pUIElement->GetLogicalParent();
	}

	return (CXTPMarkupVisual*)pUIElement;
}
BOOL CXTPMarkupThickness::IsEqual(const CXTPMarkupObject *pObject) const
{
	if (!pObject)
		return FALSE;

	if (pObject->GetType() != MARKUP_TYPE(CXTPMarkupThickness))
		return FALSE;

	const CXTPMarkupThickness *pOther = reinterpret_cast<const CXTPMarkupThickness*>(pObject);

	return (*this == *pOther);
}
Ejemplo n.º 10
0
CPoint CXTPMarkupMouseEventArgs::GetPosition(CXTPMarkupInputElement* relativeTo)
{
	CPoint pt = m_point;

	CXTPMarkupObject* pVisual = relativeTo;

	while (pVisual != 0)
	{
		if (pVisual->IsKindOf(MARKUP_TYPE(CXTPMarkupVisual)))
		{
			pt -= ((CXTPMarkupVisual*)pVisual)->GetVisualOffset();
		}
		pVisual = pVisual->GetLogicalParent();
	}
	return pt;
}
Ejemplo n.º 11
0
void CXTPMarkupInputElement::ApplyTree(CXTPMarkupObject* pChild)
{
	int nCount = pChild->GetLogicalChildrenCount();

	for (int i = 0; i < nCount; i++)
	{
		CXTPMarkupObject* p = pChild->GetLogicalChild(i);

		ApplyTree(p);
	}

	if (pChild->IsKindOf(MARKUP_TYPE(CXTPMarkupInputElement)))
	{
		((CXTPMarkupInputElement*)pChild)->OnApply();
	}
}
void CXTPMarkupDecorator::SetContentObject(CXTPMarkupBuilder* pBuilder, CXTPMarkupObject* pContent)
{
	if (!pContent->IsKindOf(MARKUP_TYPE(CXTPMarkupUIElement)))
	{
		pBuilder->ThrowBuilderException(CXTPMarkupBuilder::FormatString(_T("'%ls' object cannot be added to '%ls'. Object cannot be converted to type 'CXTPMarkupUIElement'"),
			(LPCTSTR)pContent->GetType()->m_lpszClassName, (LPCTSTR)GetType()->m_lpszClassName));
	}

	if (m_pChild != NULL)
	{
		pBuilder->ThrowBuilderException(CXTPMarkupBuilder::FormatString(_T("'%ls' already has a child and cannot add ")
			_T("'%ls'. '%ls' can accept only one child."),
			(LPCTSTR)GetType()->m_lpszClassName, (LPCTSTR)pContent->GetType()->m_lpszClassName, (LPCTSTR)GetType()->m_lpszClassName));
	}

	SetChild((CXTPMarkupUIElement*)pContent);
}
Ejemplo n.º 13
0
void CXTPMarkupInputElement::RaiseEvent(CXTPMarkupRoutedEventArgs* pEventArgs)
{
	if (pEventArgs->GetEvent() == NULL)
	{
		ASSERT(FALSE);
		return;
	}

	if (pEventArgs->GetEvent()->GetFlags() & CXTPMarkupRoutedEvent::routingBubble)
	{
		CXTPMarkupObject* pParent = this;
		while (pParent)
		{
			if (pParent->IsKindOf(MARKUP_TYPE(CXTPMarkupInputElement)))
			{
				CXTPMarkupEventHandlerMap* pHandlers = ((CXTPMarkupInputElement*)pParent)->m_pHandlers;
				if (pHandlers) pHandlers->Raise(pParent, pEventArgs);

				if (pEventArgs->IsHandled())
					return;
			}

			pParent = pParent->GetLogicalParent();
		}

		CXTPMarkupContext* pMarkupContext = GetMarkupContext();
		if (pMarkupContext)
		{
			pMarkupContext->RaiseEvent(this, pEventArgs);
		}
	}
	else
	{
		if (m_pHandlers) m_pHandlers->Raise(this, pEventArgs);
	}
}
void CXTPMarkupKeyboardNavigation::Navigate(CXTPMarkupInputElement* pCurrentElement, XTPMarkupFocusNavigationDirection direction)
{
	CXTPMarkupObject* pNextInDirection = NULL;
	switch (direction)
	{
	case xtpMarkupFocusNavigationDirectionNext:
		m_pNavigationProperty = m_pTabNavigationProperty;
		pNextInDirection = GetNextTab(pCurrentElement, GetGroupParent(pCurrentElement, TRUE), FALSE);
		break;

   /*case xtpMarkupFocusNavigationDirectionPrevious:
		m_pNavigationProperty = m_pTabNavigationProperty;
		pNextInDirection = GetPrevTab(pCurrentElement, NULL, FALSE);
		break;*/
	}

	if (pNextInDirection != NULL)
	{
		if (pNextInDirection->IsKindOf(MARKUP_TYPE(CXTPMarkupInputElement)))
		{
			((CXTPMarkupInputElement*)pNextInDirection)->Focus();
		}
	}
}
Ejemplo n.º 15
0
void CXTPMarkupPanel::RegisterMarkupClass()
{
	m_pBackgroundProperty = CXTPMarkupDependencyProperty::Register(L"Background", MARKUP_TYPE(CXTPMarkupBrush), MARKUP_TYPE(CXTPMarkupPanel),
		new CXTPMarkupPropertyMetadata(NULL, CXTPMarkupPropertyMetadata::flagAffectsRender));
}
Ejemplo n.º 16
0
void CXTPMarkupInputElement::RegisterMarkupClass()
{
	CXTPMarkupStyle::RegisterType();

	m_pCursorProperty = CXTPMarkupDependencyProperty::Register(L"Cursor", MARKUP_TYPE(CXTPMarkupInt), MARKUP_TYPE(CXTPMarkupInputElement),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupBuilder::ConvertCursor, &CXTPMarkupInputElement::OnCursorPropertyChanged));

	m_pIsMouseOverProperty = CXTPMarkupDependencyProperty::Register(L"IsMouseOver", MARKUP_TYPE(CXTPMarkupBool), MARKUP_TYPE(CXTPMarkupInputElement),
		new CXTPMarkupPropertyMetadata(CXTPMarkupBool::CreateFalseValue()));

	m_pResourcesProperty = CXTPMarkupStyle::m_pResourcesProperty->AddOwner(MARKUP_TYPE(CXTPMarkupInputElement));

	m_pStyleProperty = CXTPMarkupDependencyProperty::Register(L"Style", MARKUP_TYPE(CXTPMarkupStyle), MARKUP_TYPE(CXTPMarkupInputElement),
		new CXTPMarkupPropertyMetadata(NULL, &CXTPMarkupInputElement::OnStylePropertyChanged));

	m_pIsKeyboardFocusedProperty = CXTPMarkupDependencyProperty::Register(L"IsKeyboardFocused", MARKUP_TYPE(CXTPMarkupBool), MARKUP_TYPE(CXTPMarkupInputElement),
		new CXTPMarkupPropertyMetadata(CXTPMarkupBool::CreateFalseValue(), CXTPMarkupPropertyMetadata::flagAffectsRender));

	m_pIsFocusableProperty = CXTPMarkupDependencyProperty::Register(L"IsFocusable", MARKUP_TYPE(CXTPMarkupBool), MARKUP_TYPE(CXTPMarkupInputElement),
		new CXTPMarkupPropertyMetadata(CXTPMarkupBool::CreateFalseValue()));

	m_pToolTipProperty = CXTPMarkupDependencyProperty::Register(L"ToolTip", MARKUP_TYPE(CXTPMarkupObject), MARKUP_TYPE(CXTPMarkupInputElement));

	m_pMouseLeaveEvent = CXTPMarkupRoutedEvent::RegisterRoutedEvent(L"MouseLeave",
		CXTPMarkupRoutedEvent::routingDirect, MARKUP_TYPE(CXTPMarkupInputElement));
	m_pMouseEnterEvent = CXTPMarkupRoutedEvent::RegisterRoutedEvent(L"MouseEnter",
		CXTPMarkupRoutedEvent::routingDirect, MARKUP_TYPE(CXTPMarkupInputElement));
	m_pMouseLeftButtonUpEvent = CXTPMarkupRoutedEvent::RegisterRoutedEvent(L"MouseLeftButtonUp",
		CXTPMarkupRoutedEvent::routingDirect, MARKUP_TYPE(CXTPMarkupInputElement));
	m_pMouseLeftButtonDownEvent = CXTPMarkupRoutedEvent::RegisterRoutedEvent(L"MouseLeftButtonDown",
		CXTPMarkupRoutedEvent::routingDirect, MARKUP_TYPE(CXTPMarkupInputElement));
	m_pMouseRightButtonUpEvent = CXTPMarkupRoutedEvent::RegisterRoutedEvent(L"MouseRightButtonUp",
		CXTPMarkupRoutedEvent::routingDirect, MARKUP_TYPE(CXTPMarkupInputElement));
	m_pMouseRightButtonDownEvent = CXTPMarkupRoutedEvent::RegisterRoutedEvent(L"MouseRightButtonDown",
		CXTPMarkupRoutedEvent::routingDirect, MARKUP_TYPE(CXTPMarkupInputElement));
	m_pMouseMoveEvent = CXTPMarkupRoutedEvent::RegisterRoutedEvent(L"MouseMove",
		CXTPMarkupRoutedEvent::routingDirect, MARKUP_TYPE(CXTPMarkupInputElement));
	m_pLostMouseCaptureEvent= CXTPMarkupRoutedEvent::RegisterRoutedEvent(L"LostMouseCapture",
		CXTPMarkupRoutedEvent::routingDirect, MARKUP_TYPE(CXTPMarkupInputElement));
}
Ejemplo n.º 17
0
CXTPMarkupRoutedEvent* CXTPMarkupRoutedEvent::RegisterRoutedEvent(LPCWSTR lpszName, RoutingStrategy routingStrategy, CXTPMarkupType* pOwnerType)
{
	CXTPMarkupRoutedEvent* pEvent = (CXTPMarkupRoutedEvent*)RegisterCommon(new CXTPMarkupRoutedEvent(), lpszName, MARKUP_TYPE(CXTPMarkupString), pOwnerType, FALSE);

	if (routingStrategy != routingDirect)
	{
		pEvent->m_pMetadata = new CXTPMarkupPropertyMetadata(NULL, routingStrategy);
	}

	return pEvent;
}
Ejemplo n.º 18
0
CXTPMarkupUIElementCollection::CXTPMarkupUIElementCollection()
{
	m_pElementType = MARKUP_TYPE(CXTPMarkupUIElement);
}
Ejemplo n.º 19
0
CXTPMarkupColumnDefinitionCollection::CXTPMarkupColumnDefinitionCollection()
{
	m_pElementType = MARKUP_TYPE(CXTPMarkupColumnDefinition);
}