Пример #1
0
        /// <summary>
        /// Group the specified uiElements.
        /// </summary>
        /// <param name="elements">User interface elements.</param>
        protected override void Group(List <LayoutElementInfo> elements)
        {
            ElementsGroup.Clear();

            if (Layout.GridConstraint == GridConstraints.Flexible)
            {
                GroupFlexible(elements);
            }
            else if (Layout.GridConstraint == GridConstraints.FixedRowCount)
            {
                GroupByRows(elements);
            }
            else if (Layout.GridConstraint == GridConstraints.FixedColumnCount)
            {
                GroupByColumns(elements);
            }

            if (!Layout.TopToBottom)
            {
                ElementsGroup.Reverse();
            }

            if (Layout.RightToLeft)
            {
                ElementsGroup.ForEach(ReverseList);
            }
        }
Пример #2
0
        /// <summary>
        /// Group elements.
        /// </summary>
        protected override void Group()
        {
            ElementsGroup.Clear();

            var row = new List <LayoutElementInfo>();

            ElementsGroup.Add(row);

            if (!Layout.FlexSettings.Wrap)
            {
                row.AddRange(Elements);
                return;
            }

            var base_size = Layout.MainAxisSize;
            var size      = base_size;
            var spacing   = Layout.IsHorizontal ? Layout.Spacing.x : Layout.Spacing.y;

            for (int i = 0; i < Elements.Count; i++)
            {
                if (row.Count == 0)
                {
                    size -= Elements[i].AxisSize;
                    row.Add(Elements[i]);
                    continue;
                }

                var element_size = Elements[i].AxisSize + spacing;
                if (size >= element_size)
                {
                    size -= element_size;
                    row.Add(Elements[i]);
                }
                else
                {
                    size = base_size - Elements[i].AxisSize;

                    row = new List <LayoutElementInfo>();
                    ElementsGroup.Add(row);

                    row.Add(Elements[i]);
                }
            }

            if (!Layout.TopToBottom)
            {
                ElementsGroup.Reverse();
            }

            if (Layout.RightToLeft)
            {
                ElementsGroup.ForEach(ReverseList);
            }
        }
Пример #3
0
        /// <summary>
        /// Group the specified elements.
        /// </summary>
        protected override void Group()
        {
            ElementsGroup.Clear();

            if (Elements.Count == 0)
            {
                return;
            }

            if (Layout.IsHorizontal)
            {
                GroupHorizontal(ElementsGroup);
            }
            else
            {
                GroupVertical(ElementsGroup);
            }

            var rows    = ElementsGroup.Count;
            var columns = EasyLayoutUtilites.MaxCount(ElementsGroup);

            if ((Layout.CompactConstraint == CompactConstraints.MaxRowCount) && (rows > Layout.ConstraintCount))
            {
                ElementsGroup.Clear();
                GroupByRows();
            }
            else if ((Layout.CompactConstraint == CompactConstraints.MaxColumnCount) && (columns > Layout.ConstraintCount))
            {
                ElementsGroup.Clear();
                GroupByColumns();
            }

            if (!Layout.TopToBottom)
            {
                ElementsGroup.Reverse();
            }

            if (Layout.RightToLeft)
            {
                ElementsGroup.ForEach(ReverseList);
            }
        }
Пример #4
0
        /// <summary>
        /// Group elements.
        /// </summary>
        /// <param name="elements">Elements.</param>
        protected override void Group(List <LayoutElementInfo> elements)
        {
            ElementsGroup.Clear();

            var blocks = GetBlockSizes(elements);

            InitBlockSizes(blocks);

            for (int i = 0; i < elements.Count; i++)
            {
                InsertToBlock(NextBlockIndex(), elements[i]);
            }

            if (!Layout.TopToBottom)
            {
                ElementsGroup.Reverse();
            }

            if (Layout.RightToLeft)
            {
                ElementsGroup.ForEach(ReverseList);
            }
        }