Esempio n. 1
0
 public void Set_SizeMax(int?Width, int?Height)
 {
     /*Max_Width.Set(width);
      * Max_Height.Set(height);*/
     Min_Width.Set(!Width.HasValue ? null : CssValue.From(Width.Value, ECssUnit.PX));
     Min_Height.Set(!Height.HasValue ? null : CssValue.From(Height.Value, ECssUnit.PX));
 }
Esempio n. 2
0
        public void Set_Position(int?X, int?Y)
        {
            /*Left.Set(X);
             * Top.Set(Y);*/

            Left.Set(!X.HasValue ? null : CssValue.From(X.Value, ECssUnit.PX));
            Top.Set(!Y.HasValue ? null : CssValue.From(Y.Value, ECssUnit.PX));
        }
Esempio n. 3
0
        public void Set_Size(int?Width, int?Height)
        {
            /*this.Width.Set(Width);
             * this.Height.Set(Height);*/

            this.Width.Set(!Width.HasValue ? null : CssValue.From(Width.Value, ECssUnit.PX));
            this.Height.Set(!Height.HasValue ? null : CssValue.From(Height.Value, ECssUnit.PX));
        }
Esempio n. 4
0
        /// <summary>
        /// Sets the <see cref="Assigned"/> value for this property to the given length (in pixels)
        /// </summary>
        /// <param name="value"></param>
        public void Set(int?value)
        {
            var newValue = CssValue.From(value, ECssUnit.PX, CssValue.Null);

            if (Assigned != newValue)
            {
                Assigned = newValue;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Sets the <see cref="Assigned"/> value for this property to the given color
        /// </summary>
        /// <param name="value"></param>
        public void Set(Color value)
        {
            var newValue = CssValue.From(value);

            if (Assigned != newValue)
            {
                Assigned = newValue;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Sets the <see cref="Assigned"/> value for this property to the given color
        /// </summary>
        /// <param name="value"></param>
        public void Set(CssValue Horizontal, CssValue Vertical = null)
        {
            var newValue = CssValue.From(Horizontal, Vertical ?? CssValue.Null);

            if (Assigned != newValue)
            {
                Assigned = newValue;
            }
        }
Esempio n. 7
0
        public void Set_Margin_Implicit(int?horizontal, int?vertical)
        {
            /*Margin_Top.Set(vertical);
             * Margin_Right.Set(horizontal);
             * Margin_Bottom.Set(vertical);
             * Margin_Left.Set(horizontal);*/

            Margin_Top.Set(!vertical.HasValue ? null : CssValue.From(vertical.Value, ECssUnit.PX));
            Margin_Right.Set(!horizontal.HasValue ? null : CssValue.From(horizontal.Value, ECssUnit.PX));
            Margin_Bottom.Set(!vertical.HasValue ? null : CssValue.From(vertical.Value, ECssUnit.PX));
            Margin_Left.Set(!horizontal.HasValue ? null : CssValue.From(horizontal.Value, ECssUnit.PX));
        }
Esempio n. 8
0
        public void Set_Margin(int?top, int?right, int?bottom, int?left)
        {
            /*Margin_Top.Set(top);
             * Margin_Right.Set(right);
             * Margin_Bottom.Set(bottom);
             * Margin_Left.Set(left);*/

            Margin_Top.Set(!top.HasValue ? null : CssValue.From(top.Value, ECssUnit.PX));
            Margin_Right.Set(!right.HasValue ? null : CssValue.From(right.Value, ECssUnit.PX));
            Margin_Bottom.Set(!bottom.HasValue ? null : CssValue.From(bottom.Value, ECssUnit.PX));
            Margin_Left.Set(!left.HasValue ? null : CssValue.From(left.Value, ECssUnit.PX));
        }
Esempio n. 9
0
        public void Set_Padding(int?top, int?right, int?bottom, int?left)
        {
            /*Padding_Top.Set(top);
             * Padding_Right.Set(right);
             * Padding_Bottom.Set(bottom);
             * Padding_Left.Set(left);*/

            Padding_Top.Set(!top.HasValue ? null : CssValue.From(top.Value, ECssUnit.PX));
            Padding_Right.Set(!right.HasValue ? null : CssValue.From(right.Value, ECssUnit.PX));
            Padding_Bottom.Set(!bottom.HasValue ? null : CssValue.From(bottom.Value, ECssUnit.PX));
            Padding_Left.Set(!left.HasValue ? null : CssValue.From(left.Value, ECssUnit.PX));
        }
Esempio n. 10
0
        public void Set_Padding(int?horizontal, int?vertical)
        {
            /*Padding_Top.Set(vertical);
             * Padding_Right.Set(horizontal);
             * Padding_Bottom.Set(vertical);
             * Padding_Left.Set(horizontal);*/

            Padding_Top.Set(!vertical.HasValue ? null : CssValue.From(vertical.Value, ECssUnit.PX));
            Padding_Right.Set(!horizontal.HasValue ? null : CssValue.From(horizontal.Value, ECssUnit.PX));
            Padding_Bottom.Set(!vertical.HasValue ? null : CssValue.From(vertical.Value, ECssUnit.PX));
            Padding_Left.Set(!horizontal.HasValue ? null : CssValue.From(horizontal.Value, ECssUnit.PX));
        }
Esempio n. 11
0
        internal CssValue Derive_ComputedValue(ICssProperty Property)
        {/* Docs:  https://www.w3.org/TR/css-cascade-3/#computed  */
            StyleDefinition Def = Property.Definition;

            // Resolve any relative values
            switch (Type)
            {
            case ECssValueTypes.INHERIT:    // Docs:  https://www.w3.org/TR/CSS2/cascade.html#value-def-inherit
            {
                return(Property.Find_Inherited_Value());
            }

            case ECssValueTypes.PERCENT:
            {
                if (Def.Percentage_Resolver != null)
                {
                    return(Def.Percentage_Resolver(Property, (double)value));
                }
            }
            break;

            case ECssValueTypes.DIMENSION:
            {
                double nv = Resolve(Property.Owner.ownerDocument.cssUnitResolver);
                return(CssValue.From(nv));
            }
            }

            // If we havent resolved a value yet that means this was meant to be handled by a custom handler
            var ResolutionDelegate = Def.PropertyStageResolver[(int)EPropertyStage.Computed];

            if (ResolutionDelegate is object)
            {
                return((CssValue)ResolutionDelegate.Invoke(Property));
            }


            return(this);
        }
Esempio n. 12
0
 public void Set(Ty Value)
 {
     Assigned = CssValue.From(Value);
 }