// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
namespace Microsoft.Maui.Platform;
///
/// Represents a visual state with setters and optional triggers.
/// Maps to MAUI VisualState.
///
public class SkiaVisualState
{
///
/// Gets or sets the name of this visual state.
///
public string Name { get; set; } = "";
///
/// Gets the setters that define property changes for this state.
///
public List Setters { get; } = new List();
///
/// Gets the state triggers that can automatically activate this state.
///
public List StateTriggers { get; } = new List();
///
/// Gets or sets the target type this state applies to.
///
public Type? TargetType { get; set; }
///
/// Attaches triggers to the specified view.
///
internal void AttachTriggers(SkiaView view)
{
foreach (var trigger in StateTriggers)
{
trigger.OwnerState = this;
trigger.OwnerView = view;
}
}
///
/// Detaches triggers from the view.
///
internal void DetachTriggers()
{
foreach (var trigger in StateTriggers)
{
trigger.OwnerState = null;
trigger.OwnerView = null;
}
}
}