Exemplo n.º 1
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);
	}
}
Exemplo n.º 2
0
void CXTPMarkupGrid::ValidateDefinitions()
{
	MARKUP_RELEASE(m_pDefinitionsU);
	MARKUP_RELEASE(m_pDefinitionsV);

	if (m_pColumnDefinitions->GetCount() == 0)
	{
		m_pDefinitionsU = new CXTPMarkupColumnDefinitionCollection();
		m_pDefinitionsU->Add(new CXTPMarkupColumnDefinition());
	}
	else
	{
		m_pDefinitionsU = m_pColumnDefinitions;
		m_pDefinitionsU->AddRef();
	}

	if (m_pRowDefinitions->GetCount() == 0)
	{
		m_pDefinitionsV = new CXTPMarkupRowDefinitionCollection();
		m_pDefinitionsV->Add(new CXTPMarkupRowDefinition());
	}
	else
	{
		m_pDefinitionsV = m_pRowDefinitions;
		m_pDefinitionsV->AddRef();
	}
}
CXTPMarkupInputElement::~CXTPMarkupInputElement()
{
	SAFE_DELETE(m_pHandlers);

	MARKUP_RELEASE(m_pActiveTriggers);
	MARKUP_RELEASE(m_pTriggerProperties);
}
Exemplo n.º 4
0
CXTPMarkupGrid::~CXTPMarkupGrid()
{
	MARKUP_RELEASE(m_pColumnDefinitions);
	MARKUP_RELEASE(m_pRowDefinitions);

	SAFE_DELETE_AR(m_pCellCachesCollection);

	MARKUP_RELEASE(m_pDefinitionsU);
	MARKUP_RELEASE(m_pDefinitionsV);
}
BOOL CXTPMarkupKeyboardNavigation::OnWndMsg(UINT /*message*/, WPARAM /*wParam*/, LPARAM /*lParam*/, LRESULT* /*pResult*/)
{
	// NotImplmeneted
	return FALSE;

#if 0
	if (message == WM_SETFOCUS)
	{
		if (m_pLastFocused && !m_pFocused)
		{
			Focus(m_pLastFocused);
			MARKUP_RELEASE(m_pLastFocused);
		}
	}

	if (message == WM_KILLFOCUS)
	{
		if (m_pFocused)
		{
			m_pLastFocused = m_pFocused;
			MARKUP_ADDREF(m_pLastFocused);

			Focus(NULL);
		}
	}

	if (message == WM_KEYDOWN)
	{
		ProcessInput((UINT)wParam);
	}

	return FALSE;
#endif
}
void CXTPMarkupKeyboardNavigation::Focus(CXTPMarkupInputElement* /*pInputElement*/)
{
	// NotImplmeneted
	return;

#if 0
	if (!m_pMarkupContext->m_hContextWnd)
		return;

	if (m_pFocused == pInputElement)
		return;

	if (m_pFocused)
	{
		m_pFocused->SetValue(CXTPMarkupInputElement::m_pIsKeyboardFocusedProperty, NULL);

		MARKUP_RELEASE(m_pFocused);
	}

	m_pFocused = pInputElement;

	if (m_pFocused)
	{
		m_pFocused->SetValue(CXTPMarkupInputElement::m_pIsKeyboardFocusedProperty, CXTPMarkupBool::CreateTrueValue());

		MARKUP_ADDREF(m_pFocused);

		::SetFocus(m_pMarkupContext->m_hContextWnd);
	}
#endif
}
void CXTPMarkupInputElement::SetPropertyObject(CXTPMarkupBuilder* pBuilder, CXTPMarkupDependencyProperty* pProperty, CXTPMarkupObject* pValue)
{
	if (pProperty->IsEvent())
	{
		CXTPMarkupContext* pMarkupContext = GetMarkupContext();
		if (!pMarkupContext)
		{
			pBuilder->ThrowBuilderException(_T("Markup Context is NULL"));
		}

		LPCWSTR lpszDelegate = (LPCWSTR)*((CXTPMarkupString*)pValue);

		CXTPMarkupDelegate* pDelegate = pMarkupContext->LookupDelegate(lpszDelegate);
		if (!pDelegate)
		{
			pBuilder->ThrowBuilderException(CXTPMarkupBuilder::FormatString(_T("'%ls' delegate not found"), (LPCTSTR)lpszDelegate));
		}

		AddHandler((CXTPMarkupRoutedEvent*)pProperty,  pDelegate);
		MARKUP_RELEASE(pValue);
		MARKUP_ADDREF(pDelegate);

		return;
	}

	CXTPMarkupObject::SetPropertyObject(pBuilder, pProperty, pValue);

}
Exemplo n.º 8
0
void CXTPMarkupPage::SetContent(CXTPMarkupUIElement* pContent)
{
	if (m_pContent)
	{
		m_pContent->SetLogicalParent(NULL);
		MARKUP_RELEASE(m_pContent);
	}

	m_pContent = pContent;

	if (m_pContent)
	{
		m_pContent->SetLogicalParent(this);
	}
}
void CXTPMarkupDecorator::SetChild(CXTPMarkupUIElement* pChild)
{
	if (m_pChild)
	{
		m_pChild->SetLogicalParent(NULL);
		MARKUP_RELEASE(m_pChild);
	}

	m_pChild = pChild;

	if (m_pChild)
	{
		m_pChild->SetLogicalParent(this);
	}
}
Exemplo n.º 10
0
void CXTPMarkupEventHandlerMap::RemoveAll()
{
	POSITION pos = m_mapHandlers.GetStartPosition();
	while (pos)
	{
		CPtrList* pHandlers;
		CXTPMarkupRoutedEvent* pEvent;
		m_mapHandlers.GetNextAssoc(pos, pEvent, pHandlers);

		while (!pHandlers->IsEmpty())
		{
			CXTPMarkupDelegate* pDelegate = (CXTPMarkupDelegate*)pHandlers->RemoveTail();
			MARKUP_RELEASE(pDelegate);
		}
		delete pHandlers;
	}
	m_mapHandlers.RemoveAll();
}
CXTPMarkupKeyboardNavigation::~CXTPMarkupKeyboardNavigation()
{
	MARKUP_RELEASE(m_pFocused);
	MARKUP_RELEASE(m_pLastFocused);
}
Exemplo n.º 12
0
void CXTPMarkupInputElement::FireTriggers(CXTPMarkupDependencyProperty* pProperty, CXTPMarkupObject* pNewValue)
{
	BOOL bChanged = FALSE;
	int i;

	CMap<CXTPMarkupDependencyProperty*, CXTPMarkupDependencyProperty*, CXTPMarkupObject*, CXTPMarkupObject*> mapOldValues;

	if (m_pActiveTriggers)
	{
		for (i = m_pActiveTriggers->GetCount() - 1; i >= 0; i--)
		{
			CXTPMarkupTrigger* pTrigger = m_pActiveTriggers->GetItem(i);

			if (pTrigger->GetTriggerProperty() == pProperty)
			{
				if (!pTrigger->GetTriggerValue()->IsEqual(pNewValue))
				{
					CXTPMarkupSetterColection* pSetters = pTrigger->GetSetters();

					for (int j = 0; j < pSetters->GetCount(); j++)
					{
						CXTPMarkupSetter* pSetter = pSetters->GetItem(j);
						CXTPMarkupDependencyProperty* pSetterProperty = pSetter->GetSetterProperty();

						CXTPMarkupObject* pOldValue = m_pTriggerProperties->Lookup(pSetterProperty);

						CXTPMarkupObject* pTempValue;
						if (!mapOldValues.Lookup(pSetterProperty, pTempValue))
						{
							MARKUP_ADDREF(pOldValue);
							mapOldValues.SetAt(pSetterProperty, pOldValue);
						}

						m_pTriggerProperties->Set(pSetterProperty, NULL);
					}

					m_pActiveTriggers->Remove(i);
					bChanged = TRUE;
				}
			}
		}
	}

	if (m_pStyleCache)
	{
		bChanged = AddStyleTriggers(m_pStyleCache, pProperty, pNewValue) || bChanged;
	}
	else if (GetType()->GetTypeStyle())
	{
		bChanged = AddStyleTriggers(GetType()->GetTypeStyle(), pProperty, pNewValue) || bChanged;
	}


	if (bChanged)
	{
		if (!m_pTriggerProperties)
			m_pTriggerProperties = new CXTPMarkupProperties(NULL);

		for (i = 0; i < m_pActiveTriggers->GetCount(); i++)
		{
			CXTPMarkupTrigger* pTrigger = m_pActiveTriggers->GetItem(i);

			CXTPMarkupSetterColection* pSetters = pTrigger->GetSetters();

			for (int j = 0; j < pSetters->GetCount(); j++)
			{
				CXTPMarkupSetter* pSetter = pSetters->GetItem(j);

				CXTPMarkupObject* pValue = pSetter->GetSetterValue();

				CXTPMarkupDependencyProperty* pSetterProperty = pSetter->GetSetterProperty();

				CXTPMarkupObject* pOldValue = m_pTriggerProperties->Lookup(pSetterProperty);

				if (!pValue->IsEqual(pOldValue))
				{
					CXTPMarkupObject* pTempValue;
					if (!mapOldValues.Lookup(pSetterProperty, pTempValue))
					{
						MARKUP_ADDREF(pOldValue);
						mapOldValues.SetAt(pSetterProperty, pOldValue);
					}

					pValue->AddRef();
					m_pTriggerProperties->Set(pSetterProperty, pValue);
				}
			}
		}
	}

	POSITION pos = mapOldValues.GetStartPosition();
	while (pos)
	{
		CXTPMarkupDependencyProperty* pProperty;
		CXTPMarkupObject* pOldValue;
		mapOldValues.GetNextAssoc(pos, pProperty, pOldValue);

		CXTPMarkupObject* pNewValue = m_pTriggerProperties->Lookup(pProperty);

		if (!::IsEqual(pNewValue, pOldValue))
		{
			OnPropertyChanged(pProperty, pOldValue, pNewValue);

			if (pProperty->GetFlags() & CXTPMarkupPropertyMetadata::flagInherited)
			{
				RecursePropertyChanged(pProperty, pOldValue, pNewValue);
			}
		}

		MARKUP_RELEASE(pOldValue);
	}
}