示例#1
0
        public static void Remove(this Flex.Item parent, Flex.Item child)
        {
            var index = parent.IndexOf(child);

            if (index < 0)
            {
                return;
            }
            parent.RemoveAt((uint)index);
        }
示例#2
0
        public static int IndexOf(this Flex.Item parent, Flex.Item child)
        {
            var index = -1;

            foreach (var it in parent)
            {
                index++;
                if (it == child)
                {
                    return(index);
                }
            }
            return(-1);
        }
示例#3
0
        public static Size GetConstraints(this Flex.Item item)
        {
            var widthConstraint  = -1d;
            var heightConstraint = -1d;
            var parent           = item.Parent;

            do
            {
                if (parent == null)
                {
                    break;
                }
                if (widthConstraint < 0 && !float.IsNaN(parent.Width))
                {
                    widthConstraint = (double)parent.Width;
                }
                if (heightConstraint < 0 && !float.IsNaN(parent.Height))
                {
                    heightConstraint = (double)parent.Height;
                }
                parent = parent.Parent;
            } while (widthConstraint < 0 || heightConstraint < 0);
            return(new Size(widthConstraint, heightConstraint));
        }
示例#4
0
 public static Rectangle GetFrame(this Flex.Item item)
 {
     return(new Rectangle(item.Frame[0], item.Frame[1], item.Frame[2], item.Frame[3]));
 }