public static void ApplyUnityTextOutline(StylePropertyReader reader, ComputedStyle computedStyle) { CompileTextOutline(reader, out Color unityTextOutlineColor, out float unityTextOutlineWidth); computedStyle.inheritedData.unityTextOutlineColor = unityTextOutlineColor; computedStyle.inheritedData.unityTextOutlineWidth = unityTextOutlineWidth; }
private bool ApplyGlobalKeyword(StylePropertyReader reader, ComputedStyle parentStyle) { var handle = reader.GetValue(0).handle; if (handle.valueType == StyleValueType.Keyword) { if ((StyleValueKeyword)handle.valueIndex == StyleValueKeyword.Initial) { ApplyInitialValue(reader); return(true); } if ((StyleValueKeyword)handle.valueIndex == StyleValueKeyword.Unset) { if (parentStyle == null) { ApplyInitialValue(reader); } else { ApplyUnsetValue(reader, parentStyle); } return(true); } } return(false); }
public static BuilderScale GetScale(this StyleSheet styleSheet, StyleProperty styleProperty) { int valCount = styleProperty.values.Length; if (valCount > 0) { var val1 = new StylePropertyValue() { handle = styleProperty.values[0], sheet = styleSheet }; var val2 = valCount > 1 ? new StylePropertyValue() { handle = styleProperty.values[1], sheet = styleSheet } : default; var zval = valCount > 2 ? new StylePropertyValue() { handle = styleProperty.values[2], sheet = styleSheet } : default; return(new BuilderScale(StylePropertyReader.ReadScale(valCount, val1, val2, zval))); } else { return(new BuilderScale { value = Vector3.one }); } }
public static BuilderRotate GetRotate(this StyleSheet styleSheet, StyleProperty styleProperty) { int valCount = styleProperty.values.Length; if (valCount > 0) { var val1 = new StylePropertyValue() { handle = styleProperty.values[0], sheet = styleSheet }; var val2 = valCount > 1 ? new StylePropertyValue() { handle = styleProperty.values[1], sheet = styleSheet } : default; var val3 = valCount > 2 ? new StylePropertyValue() { handle = styleProperty.values[2], sheet = styleSheet } : default; var val4 = valCount > 3 ? new StylePropertyValue() { handle = styleProperty.values[3], sheet = styleSheet } : default; return(new BuilderRotate(StylePropertyReader.ReadRotate(valCount, val1, val2, val3, val4))); } else { return(new BuilderRotate { x = new Dimension(0f, Dimension.Unit.Degree) }); } }
public static BuilderTranslate GetTranslate(this StyleSheet styleSheet, StyleProperty styleProperty) { int valCount = styleProperty.values.Length; if (valCount > 0) { var xval = new StylePropertyValue() { handle = styleProperty.values[0], sheet = styleSheet }; var yval = valCount > 1 ? new StylePropertyValue() { handle = styleProperty.values[1], sheet = styleSheet } : default; var zval = valCount > 2 ? new StylePropertyValue() { handle = styleProperty.values[2], sheet = styleSheet } : default; return(new BuilderTranslate(StylePropertyReader.ReadTranslate(valCount, xval, yval, zval))); } else { return(new BuilderTranslate { x = new Dimension(0f, Dimension.Unit.Percent), y = new Dimension(0f, Dimension.Unit.Percent) }); } }
public static BuilderTransformOrigin GetTransformOrigin(this StyleSheet styleSheet, StyleProperty styleProperty) { int valCount = styleProperty.values.Length; if (valCount > 0) { var val1 = new StylePropertyValue() { handle = styleProperty.values[0], sheet = styleSheet }; var val2 = valCount > 1 ? new StylePropertyValue() { handle = styleProperty.values[1], sheet = styleSheet } : new StylePropertyValue(); var zval = valCount > 2 ? new StylePropertyValue() { handle = styleProperty.values[2], sheet = styleSheet } : new StylePropertyValue(); return(new BuilderTransformOrigin(StylePropertyReader.ReadTransformOrigin(valCount, val1, val2, zval))); } else { return(new BuilderTransformOrigin { x = new Dimension(0f, Dimension.Unit.Percent), y = new Dimension(0f, Dimension.Unit.Percent) }); } }
public static void ApplyFlex(StylePropertyReader reader, ComputedStyle computedStyle) { CompileFlexShorthand(reader, out float flexGrow, out float flexShrink, out Length flexBasis); computedStyle.nonInheritedData.flexGrow = flexGrow; computedStyle.nonInheritedData.flexShrink = flexShrink; computedStyle.nonInheritedData.flexBasis = flexBasis; }
public static void ApplyMargin(StylePropertyReader reader, ComputedStyle computedStyle) { CompileBoxArea(reader, out Length marginTop, out Length marginRight, out Length marginBottom, out Length marginLeft); computedStyle.nonInheritedData.marginTop = marginTop; computedStyle.nonInheritedData.marginRight = marginRight; computedStyle.nonInheritedData.marginBottom = marginBottom; computedStyle.nonInheritedData.marginLeft = marginLeft; }
public static void ApplyBorderRadius(StylePropertyReader reader, ComputedStyle computedStyle) { CompileBorderRadius(reader, out Length borderTopLeftRadius, out Length borderTopRightRadius, out Length borderBottomRightRadius, out Length borderBottomLeftRadius); computedStyle.nonInheritedData.borderTopLeftRadius = borderTopLeftRadius; computedStyle.nonInheritedData.borderTopRightRadius = borderTopRightRadius; computedStyle.nonInheritedData.borderBottomRightRadius = borderBottomRightRadius; computedStyle.nonInheritedData.borderBottomLeftRadius = borderBottomLeftRadius; }
public static void ApplyBorderWidth(StylePropertyReader reader, ComputedStyle computedStyle) { CompileBoxArea(reader, out float borderTopWidth, out float borderRightWidth, out float borderBottomWidth, out float borderLeftWidth); computedStyle.nonInheritedData.borderTopWidth = borderTopWidth; computedStyle.nonInheritedData.borderRightWidth = borderRightWidth; computedStyle.nonInheritedData.borderBottomWidth = borderBottomWidth; computedStyle.nonInheritedData.borderLeftWidth = borderLeftWidth; }
public static void ApplyPadding(StylePropertyReader reader, ComputedStyle computedStyle) { CompileBoxArea(reader, out Length paddingTop, out Length paddingRight, out Length paddingBottom, out Length paddingLeft); computedStyle.nonInheritedData.paddingTop = paddingTop; computedStyle.nonInheritedData.paddingRight = paddingRight; computedStyle.nonInheritedData.paddingBottom = paddingBottom; computedStyle.nonInheritedData.paddingLeft = paddingLeft; }
public static void ApplyBorderColor(StylePropertyReader reader, ComputedStyle computedStyle) { CompileBoxArea(reader, out Color borderTopColor, out Color borderRightColor, out Color borderBottomColor, out Color borderLeftColor); computedStyle.nonInheritedData.borderTopColor = borderTopColor; computedStyle.nonInheritedData.borderRightColor = borderRightColor; computedStyle.nonInheritedData.borderBottomColor = borderBottomColor; computedStyle.nonInheritedData.borderLeftColor = borderLeftColor; }
private void RemoveCustomStyleProperty(StylePropertyReader reader) { var name = reader.property.name; if (customProperties == null || !customProperties.ContainsKey(name)) { return; } customProperties.Remove(name); }
public void ProcessStylePropertyTestAlignVert() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "VerticalAlignment", "C1.Win.C1TrueDBGrid.AlignVertEnum.Bottom"); string expectedResult = "Bottom"; //Act string actualResult = style.Properties["AlignVert"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessStylePropertyTestWrapText() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "Wrap", "C1.Win.C1TrueDBGrid.TextWrapping.Wrap"); string expectedResult = "Wrap"; //Act string actualResult = style.Properties["WrapText"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessStylePropertyTestPaddingObject() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "Padding", "new System.Drawing.Printing.Margins(3, 2, 3, 7)"); string expectedResult = "7"; //Act string actualResult = style.Padding.Properties["Bottom"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessStylePropertyTestBorders() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "Borders.BorderType", "C1.Win.C1TrueDBGrid.BorderTypeEnum.Groove"); string expectedResult = "Groove"; //Act string actualResult = style.Borders.Properties["BorderType"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessStylePropertyTestAlignHorz() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "HorizontalAlignment", "C1.Win.C1TrueDBGrid.AlignHorzEnum.Far"); string expectedResult = "Far"; //Act string actualResult = style.Properties["AlignHorz"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessStylePropertyTestForegroundImagePos() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "ForegroundPicturePosition", "C1.Win.C1TrueDBGrid.ForeGroundPicturePositionEnum.LeftOfText"); string expectedResult = "LeftOfText"; //Act string actualResult = style.Properties["ForegroundImagePos"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessStylePropertyTestFont() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "Font", "new System.Drawing.Font(\"Arial\", 8.75f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 177)"); string expectedResult = "Arial, 8.75pt"; //Act string actualResult = style.Properties["Font"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessStylePropertyTestBackGroundPictureDrawMode() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "BackGroundPictureDrawMode", "C1.Win.C1TrueDBGrid.BackgroundPictureDrawModeEnum.Center"); string expectedResult = "Center"; //Act string actualResult = style.Properties["AlignImage"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessStylePropertyTestLocked() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "Locked", "true"); string expectedResult = "True"; //Act string actualResult = style.Properties["Locked"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ApplyUnsetValue(StylePropertyReader reader, ComputedStyle parentStyle) { switch (reader.propertyId) { case StylePropertyId.Custom: RemoveCustomStyleProperty(reader); break; default: ApplyUnsetValue(reader.propertyId, parentStyle); break; } }
public void ProcessStylePropertyTestForeColor() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "BackColor", "System.Drawing.Color.FromArgb(255, 0, 128)"); string expectedResult = "255, 0, 128"; //Act string actualResult = style.Properties["BackColor"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ProcessStylePropertyTestPaddingProperty() { //Arrange Style style = new Style("Style"); StylePropertyReader.ProcessStyleProperty(style, "Padding.Right", "6"); string expectedResult = "6"; //Act string actualResult = style.Padding.Properties["Right"]; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void ApplyInitialValue(StylePropertyReader reader) { switch (reader.propertyId) { case StylePropertyId.Custom: RemoveCustomStyleProperty(reader); break; default: ApplyInitialValue(reader.propertyId); break; } }
private void ApplyCustomStyleProperty(StylePropertyReader reader) { dpiScaling = reader.dpiScaling; if (customProperties == null) { customProperties = new Dictionary <string, StylePropertyValue>(); } var styleProperty = reader.property; // Custom property only support one value StylePropertyValue customProp = reader.GetValue(0); customProperties[styleProperty.name] = customProp; }
public bool TryGetValue(CustomStyleProperty <VectorImage> property, out VectorImage value) { if (m_CustomProperties != null && m_CustomProperties.TryGetValue(property.name, out var customProp)) { var source = new ImageSource(); if (StylePropertyReader.TryGetImageSourceFromValue(customProp, dpiScaling, out source) && source.vectorImage != null) { value = source.vectorImage; return(true); } } value = null; return(false); }
public bool TryGetValue(CustomStyleProperty <Texture2D> property, out Texture2D value) { StylePropertyValue customProp; if (m_CustomProperties != null && m_CustomProperties.TryGetValue(property.name, out customProp)) { var source = new ImageSource(); if (StylePropertyReader.TryGetImageSourceFromValue(customProp, dpiScaling, out source) && source.texture != null) { value = source.texture; return(true); } } value = null; return(false); }
private void ApplyCustomStyleProperty(StylePropertyReader reader) { if (m_CustomProperties == null) { m_CustomProperties = new Dictionary <string, StylePropertyValue>(); } var styleProperty = reader.property; StylePropertyValue customProp = default(StylePropertyValue); if (!m_CustomProperties.TryGetValue(styleProperty.name, out customProp)) { // Custom property only support one value customProp = reader.GetValue(0); } m_CustomProperties[styleProperty.name] = customProp; }