public object GetWrapper(INativeObject viewSelected, InspectorViewMode viewMode) { if (viewSelected is IViewWrapper view) { if (viewMode == InspectorViewMode.Xwt) { return(view.View); } return(GetNativePropertyPanelWrapper(view)); } if (viewSelected is IConstrainWrapper constrain) { return(constrain); } return(viewSelected?.NativeObject); }
public void ConvertToNodes(IViewWrapper customView, INodeView node, InspectorViewMode viewMode) { var current = new NodeView(customView); var nodeWrapper = new MacNodeWrapper(current); node.AddChild(nodeWrapper); if (customView.HasConstraints) { var contraintContainer = new MacConstrainContainerWrapper(customView); var constraintsContainerNodeView = new NodeView(contraintContainer); var constraintsContainerNodeWrapper = new MacNodeWrapper(constraintsContainerNodeView); nodeWrapper.AddChild(constraintsContainerNodeWrapper); foreach (var item in customView.Constraints) { var constraintNodeView = new NodeView(item); var constraintWrapper = new MacNodeWrapper(constraintNodeView); constraintsContainerNodeWrapper.AddChild(constraintWrapper); } } if (customView.Subviews == null) { return; } foreach (var item in customView.Subviews) { try { ConvertToNodes(item, nodeWrapper, viewMode); } catch (Exception ex) { Console.WriteLine(ex); } } }
public void Recursively(IViewWrapper customView, List <DetectedError> detectedErrors, InspectorViewMode viewMode) { if (detectedErrors.Count >= AccessibilityService.MaxIssues) { return; } var errorType = DetectedErrorType.None; ContrastAnalysis contrastAnalisys = null; if (customView is ITextBoxWrapper textField) { var parentColor = textField.BackgroundColor; if (parentColor == null && textField.Superview != null) { var result = BackColorSearch(textField.Superview); if (result != null) { contrastAnalisys = new ContrastAnalysis((NSColor)textField.TextColor.NativeObject, (NSColor)result.Color.NativeObject, (NSFont)textField.Font.NativeObject); contrastAnalisys.View1 = customView; contrastAnalisys.View2 = textField.Superview; if (!contrastAnalisys.IsPassed) { errorType |= DetectedErrorType.Contrast; } } } } if (IsSelectableView(customView)) { if (string.IsNullOrEmpty(customView.AccessibilityTitle)) { errorType |= DetectedErrorType.AccessibilityTitle; } //if (string.IsNullOrEmpty(customView.AccessibilityHelp)) //{ // errorType |= DetectedErrorType.AccessibilityHelp; //} if (customView.AccessibilityParent == null) { errorType |= DetectedErrorType.AccessibilityParent; } } if (errorType != DetectedErrorType.None) { var detectedError = new DetectedError() { View = customView, ErrorType = errorType }; if (contrastAnalisys != null) { detectedError.Color1 = contrastAnalisys.Color1.ToHex(); detectedError.Color2 = contrastAnalisys.Color2.ToHex(); detectedError.ContrastRatio = (float)contrastAnalisys.Contrast; detectedError.View2 = contrastAnalisys.View2; } detectedErrors.Add(detectedError); } if (customView.Subviews == null || customView.IsBlockedType()) { return; } foreach (var item in customView.Subviews) { Recursively(item, detectedErrors, viewMode); } }
public void GenerateStatusView(IViewWrapper view, IInspectDelegate inspectDelegate, InspectorViewMode viewMode) { viewSelected = view; if (viewSelected != null) { propertyEditorPanel.Select(new object[] { inspectDelegate.GetWrapper(viewSelected, viewMode) }); } else { propertyEditorPanel.Select(new object[0]); } methodListView.SetObject(view?.NativeObject, methodSearchView.StringValue); if (data != null && view != null) { var found = data.Search(view); if (found != null) { outlineView.FocusNode(found); } } }
public void GenerateTree(IWindowWrapper window, InspectorViewMode viewMode) { data = new NodeView(window.ContentView); inspectorDelegate.ConvertToNodes(window.ContentView, new MacNodeWrapper(data), viewMode); outlineView.SetData(data); }
public void Recursively(IViewWrapper contentView, List <DetectedError> DetectedErrors, InspectorViewMode viewMode) { throw new NotImplementedException(); }
public object GetWrapper(IViewWrapper viewSelected, InspectorViewMode viewMode) { throw new NotImplementedException(); }
public void ConvertToNodes(IViewWrapper view, NodeView nodeView, InspectorViewMode viewMode) { throw new NotImplementedException(); }