public void ApplyInt(StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleInt property) { property.Apply(new StyleInt((int)currentStyleValue.number, currentStyleValue.keyword) { specificity = specificity }, StylePropertyApplyMode.Copy); }
public void ApplyDisplay(StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleInt property) { if (handles[0].valueType == StyleValueType.Keyword && handles[0].valueIndex == (int)StyleValueKeyword.None) { StyleInt none = new StyleInt((int)DisplayStyle.None) { specificity = specificity }; property.Apply(none, StylePropertyApplyMode.CopyIfEqualOrGreaterSpecificity); return; } if (handles[0].valueType != StyleValueType.Enum) { Debug.LogError("Invalid value for display property " + sheet.ReadAsString(handles[0])); return; } var value = sheet.ReadStyleEnum <DisplayStyle>(handles[0], specificity); property.Apply(value, StylePropertyApplyMode.CopyIfEqualOrGreaterSpecificity); }
public void ApplyAlign(StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleInt property) { if (handles[0].valueType == StyleValueType.Keyword && handles[0].valueIndex == (int)StyleValueKeyword.Auto) { StyleInt auto = new StyleInt((int)Align.Auto) { specificity = specificity }; property.Apply(auto, StylePropertyApplyMode.CopyIfEqualOrGreaterSpecificity); return; } if (handles[0].valueType != StyleValueType.Enum) { Debug.LogError("Invalid value for align property " + sheet.ReadAsString(handles[0])); return; } var value = sheet.ReadStyleEnum <Align>(handles[0], specificity); property.Apply(value, StylePropertyApplyMode.CopyIfEqualOrGreaterSpecificity); }
public void ApplyDisplay(StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleInt property) { if (currentStyleValue.keyword == StyleKeyword.None) { property.Apply(new StyleInt((int)DisplayStyle.None) { specificity = specificity }, StylePropertyApplyMode.Copy); } else { ApplyInt(sheet, handles, specificity, ref property); } }
public void Apply(VisualElementStylesData other, StylePropertyApplyMode mode) { // Always just copy the reference to custom properties, since they can't be overriden per instance m_CustomProperties = other.m_CustomProperties; width.Apply(other.width, mode); height.Apply(other.height, mode); maxWidth.Apply(other.maxWidth, mode); maxHeight.Apply(other.maxHeight, mode); minWidth.Apply(other.minWidth, mode); minHeight.Apply(other.minHeight, mode); flexBasis.Apply(other.flexBasis, mode); flexGrow.Apply(other.flexGrow, mode); flexShrink.Apply(other.flexShrink, mode); overflow.Apply(other.overflow, mode); unityOverflowClipBox.Apply(other.unityOverflowClipBox, mode); left.Apply(other.left, mode); top.Apply(other.top, mode); right.Apply(other.right, mode); bottom.Apply(other.bottom, mode); marginLeft.Apply(other.marginLeft, mode); marginTop.Apply(other.marginTop, mode); marginRight.Apply(other.marginRight, mode); marginBottom.Apply(other.marginBottom, mode); paddingLeft.Apply(other.paddingLeft, mode); paddingTop.Apply(other.paddingTop, mode); paddingRight.Apply(other.paddingRight, mode); paddingBottom.Apply(other.paddingBottom, mode); position.Apply(other.position, mode); alignSelf.Apply(other.alignSelf, mode); unityTextAlign.Apply(other.unityTextAlign, mode); unityFontStyleAndWeight.Apply(other.unityFontStyleAndWeight, mode); fontSize.Apply(other.fontSize, mode); unityFont.Apply(other.unityFont, mode); whiteSpace.Apply(other.whiteSpace, mode); color.Apply(other.color, mode); flexDirection.Apply(other.flexDirection, mode); backgroundColor.Apply(other.backgroundColor, mode); backgroundImage.Apply(other.backgroundImage, mode); unityBackgroundScaleMode.Apply(other.unityBackgroundScaleMode, mode); unityBackgroundImageTintColor.Apply(other.unityBackgroundImageTintColor, mode); alignItems.Apply(other.alignItems, mode); alignContent.Apply(other.alignContent, mode); justifyContent.Apply(other.justifyContent, mode); flexWrap.Apply(other.flexWrap, mode); borderLeftColor.Apply(other.borderLeftColor, mode); borderTopColor.Apply(other.borderTopColor, mode); borderRightColor.Apply(other.borderRightColor, mode); borderBottomColor.Apply(other.borderBottomColor, mode); borderLeftWidth.Apply(other.borderLeftWidth, mode); borderTopWidth.Apply(other.borderTopWidth, mode); borderRightWidth.Apply(other.borderRightWidth, mode); borderBottomWidth.Apply(other.borderBottomWidth, mode); borderTopLeftRadius.Apply(other.borderTopLeftRadius, mode); borderTopRightRadius.Apply(other.borderTopRightRadius, mode); borderBottomRightRadius.Apply(other.borderBottomRightRadius, mode); borderBottomLeftRadius.Apply(other.borderBottomLeftRadius, mode); unitySliceLeft.Apply(other.unitySliceLeft, mode); unitySliceTop.Apply(other.unitySliceTop, mode); unitySliceRight.Apply(other.unitySliceRight, mode); unitySliceBottom.Apply(other.unitySliceBottom, mode); opacity.Apply(other.opacity, mode); cursor.Apply(other.cursor, mode); visibility.Apply(other.visibility, mode); display.Apply(other.display, mode); }
public void ApplyEnum <T>(StyleSheet sheet, StyleValueHandle[] handles, int specificity, ref StyleInt property) { var value = sheet.ReadStyleEnum <T>(handles[0], specificity); property.Apply(value, StylePropertyApplyMode.CopyIfEqualOrGreaterSpecificity); }