예제 #1
0
 public void CopyFrom(YogaStyle other)
 {
     Direction      = other.Direction;
     FlexDirection  = other.FlexDirection;
     JustifyContent = other.JustifyContent;
     AlignContent   = other.AlignContent;
     AlignItems     = other.AlignItems;
     AlignSelf      = other.AlignSelf;
     PositionType   = other.PositionType;
     FlexWrap       = other.FlexWrap;
     Overflow       = other.Overflow;
     Display        = other.Display;
     Flex           = other.Flex;
     FlexGrow       = other.FlexGrow;
     FlexShrink     = other.FlexShrink;
     FlexBasis      = other.FlexBasis;
     Margin.CopyFrom(other.Margin);
     Position.CopyFrom(other.Position);
     Padding.CopyFrom(other.Padding);
     Border.CopyFrom(other.Border);
     Dimensions.CopyFrom(other.Dimensions);
     MinDimensions.CopyFrom(other.MinDimensions);
     MaxDimensions.CopyFrom(other.MaxDimensions);
     AspectRatio = other.AspectRatio;
 }
예제 #2
0
 public YogaStyle()
 {
     Direction      = YogaDirection.Inherit;
     FlexDirection  = YogaFlexDirection.Column;
     JustifyContent = YogaJustify.FlexStart;
     AlignContent   = YogaAlign.FlexStart;
     AlignItems     = YogaAlign.Stretch;
     AlignSelf      = YogaAlign.Auto;
     PositionType   = YogaPositionType.Relative;
     FlexWrap       = YogaWrap.NoWrap;
     Overflow       = YogaOverflow.Visible;
     Display        = YogaDisplay.Flex;
     Flex           = null;
     FlexGrow       = null;
     FlexShrink     = null;
     FlexBasis      = YogaValue.Auto;
     Margin         = YogaArray.From(DefaultEdgeValuesUnit);
     Position       = YogaArray.From(DefaultEdgeValuesUnit);
     Padding        = YogaArray.From(DefaultEdgeValuesUnit);
     Border         = YogaArray.From(DefaultEdgeValuesUnit);
     Dimensions     = YogaArray.From(DefaultDimensionValuesAutoUnit);
     MinDimensions  = YogaArray.From(DefaultDimensionValuesUnit);
     MaxDimensions  = YogaArray.From(DefaultDimensionValuesUnit);
     AspectRatio    = null;
 }
예제 #3
0
파일: Native.cs 프로젝트: zmjios/yoga
 public static extern void YGNodeStyleSetAlignSelf(YGNodeHandle node, YogaAlign alignSelf);
예제 #4
0
파일: Native.cs 프로젝트: zmjios/yoga
 public static extern void YGNodeStyleSetAlignItems(YGNodeHandle node, YogaAlign alignItems);
예제 #5
0
파일: Native.cs 프로젝트: zmjios/yoga
 public static extern void YGNodeStyleSetAlignContent(YGNodeHandle node, YogaAlign alignContent);
예제 #6
0
 public static void YGNodeStyleSetAlignSelf(YogaNode node, YogaAlign alignSelf) => node.Style.AlignSelf = alignSelf;
예제 #7
0
 public static void YGNodeStyleSetAlignContent(YogaNode node, YogaAlign alignContent) => node.Style.AlignContent = alignContent;
예제 #8
0
 public static void YGNodeStyleSetAlignItems(YogaNode node, YogaAlign alignItems) => node.Style.AlignItems = alignItems;
예제 #9
0
 public static void SetAlignSelf(DependencyObject obj, YogaAlign value) => obj.SetValue(AlignSelfProperty, value);
예제 #10
0
 public static extern void YGNodeStyleSetAlignSelf(IntPtr node, YogaAlign alignSelf);
예제 #11
0
 public static extern void YGNodeStyleSetAlignItems(IntPtr node, YogaAlign alignItems);
예제 #12
0
 public static extern void YGNodeStyleSetAlignContent(IntPtr node, YogaAlign alignContent);
예제 #13
0
        public static YogaBuild Node(
            YogaConfig config           = null,
            Direction direction         = Direction.Inherit,
            FlexDirection flexDirection = FlexDirection.Column,
            Justify justifyContent      = Justify.FlexStart,
            YogaAlign alignContent      = YogaAlign.FlexStart,
            YogaAlign alignItems        = YogaAlign.Stretch,
            YogaAlign alignSelf         = YogaAlign.Auto,
            float aspectRatio           = Net.YogaValue.YGUndefined,
            PositionType positionType   = PositionType.Relative,
            Wrap flexWrap           = Wrap.NoWrap,
            Overflow overflow       = Overflow.Visible,
            Display display         = Display.Flex,
            float flex              = float.NaN,
            float flexGrow          = float.NaN,
            float flexShrink        = float.NaN,
            YogaValue flexBasis     = null, // YogaValue.Auto,
            YogaValue width         = null, // YogaValue.Auto,
            YogaValue height        = null, // YogaValue.Auto,
            YogaValue minWidth      = null, // YogaValue.Undefined,
            YogaValue minHeight     = null, // YogaValue.Undefined,
            YogaValue maxWidth      = null, // YogaValue.Undefined,
            YogaValue maxHeight     = null, // YogaValue.Undefined,
            YogaValue left          = null,
            YogaValue top           = null,
            YogaValue right         = null,
            YogaValue bottom        = null,
            YogaValue start         = null,
            YogaValue end           = null,
            Edges margin            = null,
            Edges position          = null,
            Edges padding           = null,
            Edges border            = null,
            MeasureFunc measureFunc = null
            )
        {
            var node = new YogaNode(config)
            {
                Style = new YogaStyle
                {
                    Direction      = direction,
                    FlexDirection  = flexDirection,
                    JustifyContent = justifyContent,
                    AlignContent   = alignContent,
                    AlignItems     = alignItems,
                    AlignSelf      = alignSelf,
                    AspectRatio    = aspectRatio,
                    PositionType   = positionType,
                    FlexWrap       = flexWrap,
                    Overflow       = overflow,
                    Display        = display,
                    Flex           = flex,
                    FlexGrow       = flexGrow,
                    FlexShrink     = flexShrink,
                    FlexBasis      = flexBasis ?? YogaValue.Auto,
                    Width          = width ?? YogaValue.Auto,
                    Height         = height ?? YogaValue.Auto,
                    MinWidth       = minWidth ?? YogaValue.Undefined,
                    MinHeight      = minHeight ?? YogaValue.Undefined,
                    MaxWidth       = maxWidth ?? YogaValue.Undefined,
                    MaxHeight      = maxHeight ?? YogaValue.Undefined
                }
            };

            if (margin != null)
            {
                node.Style.Margin = margin;
            }
            if (position != null)
            {
                node.Style.Position = position;
            }
            if (padding != null)
            {
                node.Style.Padding = padding;
            }
            if (border != null)
            {
                node.Style.Border = border;
            }
            if (start != null)
            {
                node.Style.Position.Start = start;
            }
            if (end != null)
            {
                node.Style.Position.End = end;
            }
            if (left != null)
            {
                node.Style.Left = left;
            }
            if (top != null)
            {
                node.Style.Top = top;
            }
            if (right != null)
            {
                node.Style.Right = right;
            }
            if (bottom != null)
            {
                node.Style.Bottom = bottom;
            }

            if (measureFunc != null)
            {
                node.MeasureFunc = measureFunc;
            }

            return(new YogaBuild(node));
        }