示例#1
0
 public static bool IsWindowOfType(this FigmaNode figmaNode, FigmaControlType controlType)
 {
     if (figmaNode.TryGetNativeControlType(out var value) && value == controlType)
     {
         return(true);
     }
     return(false);
 }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
 public static bool IsDialogParentContainer(this FigmaNode figmaNode, FigmaControlType controlType)
 {
     return(figmaNode is IFigmaNodeContainer container && container.children
            .OfType <FigmaInstance>()
            .Any(s => s.IsWindowOfType(controlType)));
 }