private GridLayoutNodeCellSpan GetCellSpan(int row, int column, bool ensureExists) { if (ensureExists) { if (m_cellSpans == null) { m_cellSpans = new GridLayoutNodeCellSpanList(); } var index = GetListIndex(row, column); while (index >= m_cellSpans.Count) { m_cellSpans.Add(new GridLayoutNodeCellSpan(1, 1)); } var cellSpan = m_cellSpans[index]; return(cellSpan); } else { if (m_cellSpans == null) { return(null); } var index = GetListIndex(row, column); if (index >= m_cellSpans.Count) { return(null); } var cellSpan = m_cellSpans[index]; return(cellSpan); } }
protected GridLayoutNode(GridLayoutNode prototype) : base(prototype) { if (prototype == null) { throw new ArgumentNullException(nameof(prototype)); } m_rowCount = prototype.m_rowCount; m_columnCount = prototype.m_columnCount; m_layoutSites = prototype.m_layoutSites.Clone(this); m_cellSpans = prototype.m_cellSpans?.Clone(); }
public GridLayoutNode(JToken json) : base(json) { if (json == null) { throw new ArgumentNullException(nameof(json)); } m_rowCount = json.Value <int>(JsonNames.RowCount); m_columnCount = json.Value <int>(JsonNames.ColumnCount); m_layoutSites = new LayoutSiteList(this, json[JsonNames.LayoutSites]); var jsonCellSpans = json[JsonNames.CellSpans]; m_cellSpans = jsonCellSpans != null ? new GridLayoutNodeCellSpanList(jsonCellSpans) : null; }
public GridLayoutNode(int rowCount, int columnCount) : base(PathGeometries.Rectangle) { if (rowCount <= 0) { throw new ArgumentOutOfRangeException(nameof(rowCount)); } if (columnCount <= 0) { throw new ArgumentOutOfRangeException(nameof(columnCount)); } m_rowCount = rowCount; m_columnCount = columnCount; m_layoutSites = new LayoutSiteList(this); m_cellSpans = null; ResizeLists(); }