Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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();
        }