// Returns 'true' if the value is represents infinity (positive or negative). static bool IsInfinity(double value, IRFloatingKind kind) { return IsPositiveInfinity(value, kind) || IsNegativeInfinity(value, kind); }
CSize CXTPMarkupGrid::MeasureOverride(CXTPMarkupDrawingContext* pDC, CSize constraint) { CSize size(0, 0); if (m_pColumnDefinitions->GetCount() == 0 && m_pRowDefinitions->GetCount() == 0) { int nCount = m_pChildren->GetCount(); for (int i = 0; i < nCount; i++) { CXTPMarkupUIElement* pElement = m_pChildren->GetItem(i); if (pElement == NULL) continue; pElement->Measure(pDC, constraint); size.cx = max(size.cx, pElement->GetDesiredSize().cx); size.cy = max(size.cy, pElement->GetDesiredSize().cy); } return size; } BOOL bTreatStarAsAuto = IsPositiveInfinity(constraint.cx); BOOL bFlag2 = IsPositiveInfinity(constraint.cy); ValidateDefinitions(); ValidateDefinitionsLayout(m_pDefinitionsU, bTreatStarAsAuto); ValidateDefinitionsLayout(m_pDefinitionsV, bFlag2); ValidateCells(); MeasureCellsGroup(pDC, m_nCellGroup[0], constraint, FALSE, FALSE); if (!m_bHasGroup2CellsInAutoRows) { if (m_bHasStarCellsV) { ResolveStar(m_pDefinitionsV, constraint.cy); } MeasureCellsGroup(pDC, m_nCellGroup[1], constraint, FALSE, FALSE); if (m_bHasStarCellsU) { ResolveStar(m_pDefinitionsU, constraint.cx); } MeasureCellsGroup(pDC, m_nCellGroup[2], constraint, FALSE, FALSE); } else if (m_nCellGroup[1] > GetChildren()->GetCount()) { if (m_bHasStarCellsU) { ResolveStar(m_pDefinitionsU, constraint.cx); } MeasureCellsGroup(pDC, m_nCellGroup[2], constraint, FALSE, FALSE); if (m_bHasStarCellsV) { ResolveStar(m_pDefinitionsV, constraint.cy); } } else { MeasureCellsGroup(pDC, m_nCellGroup[1], constraint, FALSE, TRUE); if (m_bHasStarCellsU) { ResolveStar(m_pDefinitionsU, constraint.cx); } MeasureCellsGroup(pDC, m_nCellGroup[2], constraint, FALSE, FALSE); if (m_bHasStarCellsV) { ResolveStar(m_pDefinitionsV, constraint.cy); } MeasureCellsGroup(pDC, m_nCellGroup[1], constraint, TRUE, FALSE); } MeasureCellsGroup(pDC, m_nCellGroup[3], constraint, FALSE, FALSE); size = CSize(CalculateDesiredSize(m_pDefinitionsU), CalculateDesiredSize(m_pDefinitionsV)); return size; }
static bool IsPositiveInfinity(FloatConstant* value) { return IsPositiveInfinity(value->Value(), value->GetType()->GetSubtype()); }