public static StyleValue Create(StylePropertyID id, StyleKeyword keyword)
 {
     return(new StyleValue()
     {
         id = id, keyword = keyword
     });
 }
Beispiel #2
0
        public static VisualElement SetHeight(this VisualElement self, StyleKeyword keyword)
        {
            StyleLength height = new StyleLength(keyword);

            self.style.height = height;

            return(self);
        }
Beispiel #3
0
        public static VisualElement SetWidth(this VisualElement self, StyleKeyword keyword)
        {
            StyleLength width = new StyleLength(keyword);

            self.style.width = width;

            return(self);
        }
Beispiel #4
0
        private bool ApplyGlobalKeyword(StylePropertyId id, StyleKeyword keyword, ref ComputedStyle parentStyle)
        {
            if (keyword == StyleKeyword.Initial)
            {
                ApplyInitialValue(id);
                return(true);
            }

            return(false);
        }
Beispiel #5
0
 internal bool Apply <U>(U other, StylePropertyApplyMode mode) where U : IStyleValue <Length>
 {
     if (StyleValueExtensions.CanApply(specificity, other.specificity, mode))
     {
         value       = other.value;
         keyword     = other.keyword;
         specificity = other.specificity;
         return(true);
     }
     return(false);
 }
Beispiel #6
0
        internal static Translate ToTranslate(this StyleKeyword keyword)
        {
            switch (keyword)
            {
            case StyleKeyword.None:
                return(Translate.None());

            default:
                Debug.LogAssertion($"Unexpected StyleKeyword '{keyword.ToString()}'");
                return(new Translate());
            }
        }
Beispiel #7
0
        internal StyleLength(Length v, StyleKeyword keyword)
        {
            m_Keyword = keyword;
            m_Value   = v;

            if (v.IsAuto())
            {
                m_Keyword = StyleKeyword.Auto;
            }
            else if (v.IsNone())
            {
                m_Keyword = StyleKeyword.None;
            }
        }
        internal static Length ToLength(this StyleKeyword keyword)
        {
            switch (keyword)
            {
            case StyleKeyword.Auto:
                return(Length.Auto());

            case StyleKeyword.None:
                return(Length.None());

            default:
                Debug.LogAssertion($"Unexpected StyleKeyword '{keyword.ToString()}'");
                return(new Length());
            }
        }
        public static StyleValueKeyword ConvertStyleKeyword(StyleKeyword keyword)
        {
            switch (keyword)
            {
            case StyleKeyword.Auto:
                return(StyleValueKeyword.Auto);

            case StyleKeyword.None:
                return(StyleValueKeyword.None);

            case StyleKeyword.Initial:
                return(StyleValueKeyword.Initial);
            }

            return(StyleValueKeyword.Auto);
        }
 internal StyleLength(Length v, StyleKeyword keyword)
 {
     this.m_Keyword = keyword;
     this.m_Value   = v;
 }
Beispiel #11
0
 public StyleColor(StyleKeyword keyword)
     : this(Color.clear, keyword)
 {
 }
Beispiel #12
0
 internal StyleBackground(Background v, StyleKeyword keyword)
 {
     m_Keyword = keyword;
     m_Value   = v;
 }
Beispiel #13
0
 public StyleInt(StyleKeyword keyword)
     : this(default(int), keyword)
 {
 }
Beispiel #14
0
 /// <summary>
 /// Creates from either a <see cref="Cursor"/> or <see cref="StyleKeyword"/>.
 /// </summary>
 public StyleCursor(StyleKeyword keyword)
     : this(default(Cursor), keyword)
 {
 }
Beispiel #15
0
 public StyleFont(StyleKeyword keyword)
     : this(null, keyword)
 {
 }
Beispiel #16
0
 /// <summary>
 /// Creates from either an enum or a <see cref="StyleKeyword"/>.
 /// </summary>
 public StyleEnum(StyleKeyword keyword)
     : this(default(T), keyword)
 {
 }
Beispiel #17
0
 /// <summary>
 /// Creates from either a float or a <see cref="StyleKeyword"/>.
 /// </summary>
 public StyleFloat(StyleKeyword keyword)
     : this(default(float), keyword)
 {
 }
 public StyleLength(StyleKeyword keyword)
 {
     this = new StyleLength(default(Length), keyword);
 }
Beispiel #19
0
 internal StyleInt(int v, StyleKeyword keyword)
 {
     this.m_Keyword = keyword;
     this.m_Value   = v;
 }
Beispiel #20
0
 public StyleInt(StyleKeyword keyword)
 {
     this = new StyleInt(0, keyword);
 }
Beispiel #21
0
 internal StyleFloat(float v, StyleKeyword keyword)
 {
     m_Keyword = keyword;
     m_Value   = v;
 }
Beispiel #22
0
 internal StyleFloat(float v, StyleKeyword keyword)
 {
     m_Specificity = StyleValueExtensions.UndefinedSpecificity;
     m_Keyword     = keyword;
     m_Value       = v;
 }
Beispiel #23
0
 internal StyleEnum(T v, StyleKeyword keyword)
 {
     m_Keyword = keyword;
     m_Value   = v;
 }
 public StyleFloat(StyleKeyword keyword)
 {
     this = new StyleFloat(0f, keyword);
 }
Beispiel #25
0
 internal StyleCursor(Cursor v, StyleKeyword keyword)
 {
     m_Keyword = keyword;
     m_Value   = v;
 }
 internal StyleFloat(float v, StyleKeyword keyword)
 {
     this.m_Keyword = keyword;
     this.m_Value   = v;
 }
Beispiel #27
0
 internal StyleFont(GCHandle gcHandle, StyleKeyword keyword)
     : this(gcHandle.IsAllocated ? gcHandle.Target as Font : null, keyword)
 {
 }
Beispiel #28
0
 public StyleLength(StyleKeyword keyword)
     : this(default(Length), keyword)
 {
 }
Beispiel #29
0
 internal StyleInt(int v, StyleKeyword keyword)
 {
     m_Keyword = keyword;
     m_Value   = v;
 }
Beispiel #30
0
 internal StyleLength(Length v, StyleKeyword keyword)
 {
     m_Specificity = StyleValueExtensions.UndefinedSpecificity;
     m_Keyword     = keyword;
     m_Value       = v;
 }