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