public static bool IsWindowOfType(this FigmaNode figmaNode, FigmaControlType controlType) { if (figmaNode.TryGetNativeControlType(out var value) && value == controlType) { return(true); } return(false); }
string GetAccessibilityTitle(FigmaControlType nativeControlType) { switch (nativeControlType) { case FigmaControlType.Button: case FigmaControlType.CheckBox: case FigmaControlType.Radio: case FigmaControlType.PopUpButton: case FigmaControlType.ComboBox: return(nameof(AppKit.NSView.AccessibilityTitle)); default: break; } return(nameof(AppKit.NSView.AccessibilityLabel)); }
public static bool TryGetNativeControlType(this FigmaNode node, out FigmaControlType nativeControlType) { nativeControlType = FigmaControlType.NotDefined; if (node is FigmaComponentEntity) { nativeControlType = GetNativeControlType(node.name); return(nativeControlType != FigmaControlType.NotDefined); } if (node is FigmaInstance figmaInstance && figmaInstance.Component != null) { nativeControlType = figmaInstance.Component.ToNativeControlType(); return(nativeControlType != FigmaControlType.NotDefined); } return(false); }
public static bool IsDialogParentContainer(this FigmaNode figmaNode, FigmaControlType controlType) { return(figmaNode is IFigmaNodeContainer container && container.children .OfType <FigmaInstance>() .Any(s => s.IsWindowOfType(controlType))); }