/// <summary> /// The value of pre-cascade property has changed /// </summary> /// <param name="Stage"></param> /// <param name="Property"></param> private void Property_onChanged(EPropertyStage Stage, ICssProperty Property) { SetProperties.SetFlag(Property.CssName.Value, Property.HasValue); /*if (!Property.HasValue) SetProperties.Remove(Property.CssName); * else SetProperties.Add(Property.CssName);*/ if (Property.CssName is null) { throw new Exception($"Cannot fire onChange events for unnamed property! (Name: {Property.CssName}"); } StyleDefinition def = CssDefinitions.StyleDefinitions[Property.CssName]; if (def is null) { throw new Exception($"Cannot find a definition for Css property: \"{Property.CssName}\""); } EPropertyDirtFlags Flags = def.Flags; StackTrace Stack = null; #if DEBUG //stack = new StackTrace(STACK_FRAME_OFFSET, true); #endif Property_Changed?.Invoke(Stage, Property, Flags, Stack); }
/// <summary> /// A post-cascade property has changed assigned values /// </summary> /// <param name="Property"></param> /// <param name="Flags"></param> /// <param name="Stack"></param> private void Handle_Cascaded_Property_Change(EPropertyStage Stage, ICssProperty Property, EPropertyDirtFlags Flags, StackTrace Stack) { bool IsFlow = (Flags & EPropertyDirtFlags.Flow) != 0;// Layout bool IsBlock = (Flags & EPropertyDirtFlags.Box) != 0; bool IsVisual = (Flags & EPropertyDirtFlags.Visual) != 0; bool IsFont = (Flags & EPropertyDirtFlags.Text) != 0; // If the value that changed was a specified one and it affects the block then we need to update our block if (IsBlock && Stage >= EPropertyStage.Specified) { // Flag us dirty so we can resolve next time its called SetFlag(EPropertySystemDirtFlags.NeedsToResolveBlock); // Notify our parent by flagging them aswell // Owner.Box.Flag(EBoxInvalidationReason.Property_Changed); // Owner.Box.FlagProperty(Flags); } // Update our dirt flags appropriately if (IsFlow || IsVisual) { SetFlag(EPropertySystemDirtFlags.NeedsToResolveBlock); } if (IsFont) { SetFlag(EPropertySystemDirtFlags.NeedsToResolveFont); } //Logging.Log.Info("[Property Changed]: {0}", Prop.FieldName); onProperty_Change?.Invoke(Property, Flags, Stack); }
private void Handle_Cascaded_Transform_Change(EPropertyStage Stage, ICssProperty Property) { if (Stage < EPropertyStage.Actual)// wait for the Actual value stage { return; } throw new NotImplementedException("Transforms are not yet implemented"); }
/// <summary> /// A state-specific property changed, we need to resolve this single property /// </summary> private void Handle_Declared_Property_Change(EPropertyStage Stage, ICssProperty Property, EPropertyDirtFlags Flags, StackTrace Origin) { /* XXX: * To be honest cascading here doesnt make sense * if a declared property changes that wont always change the value of our cascaded property. * We should check if this property IS the cascaded property and if so then just update that single property! */ CascadeProperty(Property); }
void Handle_Cascaded_Blend_Change(EPropertyStage Stage, ICssProperty Property) { if (Stage < EPropertyStage.Actual)// wait for the Actual value stage { return; } if (Opacity != 1.0) {// We have a useful blend color to set Blend_Color = new Color(new System.Numerics.Vector4(1f, 1f, 1f, (float)Opacity)); } else// We DONT have a useful blend color { Blend_Color = null; } }