public DynamicBox(IHostResourceProvider hostResources, string fillName = null, string borderName = null) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } BorderWidth = 0; BoxType = NSBoxType.NSBoxCustom; TranslatesAutoresizingMaskIntoConstraints = false; this.WantsLayer = true; this.fillColor = fillName; if (fillName == null) { this.Layer.BackgroundColor = NSColor.Clear.CGColor; } this.borderColor = borderName; if (borderName == null) { this.Layer.BorderColor = NSColor.Clear.CGColor; } HostResourceProvider = hostResources; }
private ChannelGroup CreateEditor(IHostResourceProvider hostResources, ChannelEditor editor) { var ce = new ChannelGroup { Label = new UnfocusableTextField { StringValue = $"{editor.Name}:", Alignment = NSTextAlignment.Right, ToolTip = editor.ToolTip }, Editor = new ComponentSpinEditor(hostResources, editor) { BackgroundColor = NSColor.Clear, TranslatesAutoresizingMaskIntoConstraints = true }, Gradient = new UnanimatedGradientLayer { StartPoint = new CGPoint(0, 0), EndPoint = new CGPoint(1, 0), BorderWidth = .5f, } }; ce.Editor.ValueChanged += UpdateComponent; ce.Editor.EditingEnded += UpdateComponent; AddSubview(ce.Label); AddSubview(ce.Editor); Layer.AddSublayer(ce.Gradient); return(ce); }
public TypeEditorControl(IHostResourceProvider hostResources) : base(hostResources) { this.typeLabel = new UnfocusableTextField { TranslatesAutoresizingMaskIntoConstraints = false }; AddSubview(this.typeLabel); this.selectType = new FocusableButton { Title = Properties.Resources.Select, BezelStyle = NSBezelStyle.Rounded }; this.selectType.Activated += OnSelectPressed; AddSubview(this.selectType); this.buttonConstraint = NSLayoutConstraint.Create(this.selectType, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this.typeLabel, NSLayoutAttribute.Trailing, 1f, 12); AddConstraints(new[] { NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1f, 0f), NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f), NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, 0), this.buttonConstraint, NSLayoutConstraint.Create(this.selectType, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1, 0).WithPriority(NSLayoutPriority.DefaultLow), NSLayoutConstraint.Create(this.selectType, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f), NSLayoutConstraint.Create(this.selectType, NSLayoutAttribute.Width, NSLayoutRelation.GreaterThanOrEqual, 1f, 70f), }); }
public BooleanEditorControl(IHostResourceProvider hostResource) : base(hostResource) { BooleanEditor = new FocusableBooleanButton(); BooleanEditor.Title = string.Empty; // update the value on 'enter' BooleanEditor.Activated += (sender, e) => { switch (BooleanEditor.State) { case NSCellStateValue.Off: ViewModel.Value = false; break; case NSCellStateValue.On: ViewModel.Value = true; break; } }; AddSubview(BooleanEditor); this.AddConstraints(new[] { NSLayoutConstraint.Create(BooleanEditor, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f), NSLayoutConstraint.Create(BooleanEditor, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, 0f), }); }
public CustomExpressionView(IHostResourceProvider hostResources, PropertyViewModel viewModel) : base(hostResources, viewModel, Properties.Resources.CustomExpression, "pe-custom-expression-32") { Frame = new CGRect(CGPoint.Empty, new CGSize(250, 80)); var customExpressionField = new NSTextField { StringValue = string.Empty, TranslatesAutoresizingMaskIntoConstraints = false, }; this.vmType = viewModel.GetType(); this.customExpressionPropertyInfo = vmType.GetProperty(CustomExpressionPropertyString); var value = this.customExpressionPropertyInfo.GetValue(viewModel); if (value != null) { customExpressionField.StringValue = (string)value; } customExpressionField.Activated += (sender, e) => { this.customExpressionPropertyInfo.SetValue(viewModel, customExpressionField.StringValue); }; AddSubview(customExpressionField); this.AddConstraints(new[] { NSLayoutConstraint.Create(customExpressionField, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this, NSLayoutAttribute.Top, 1f, 37f), NSLayoutConstraint.Create(customExpressionField, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1f, 38f), NSLayoutConstraint.Create(customExpressionField, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, -57f), NSLayoutConstraint.Create(customExpressionField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, 18), }); }
public RatioEditorControl(IHostResourceProvider hostResources) : base(hostResources) { base.TranslatesAutoresizingMaskIntoConstraints = false; this.ratioEditor = new RatioEditor <T> (hostResources) { AllowNegativeValues = false, AllowRatios = true, BackgroundColor = NSColor.Clear, StringValue = string.Empty, TranslatesAutoresizingMaskIntoConstraints = false, }; // update the value on keypress this.ratioEditor.ValueChanged += (sender, e) => { if (e is RatioEditor <T> .RatioEventArgs ratioEventArgs) { ViewModel.ValueChanged(this.ratioEditor.StringValue, ratioEventArgs.CaretPosition, ratioEventArgs.SelectionLength, ratioEventArgs.IncrementValue); } }; AddSubview(this.ratioEditor); this.AddConstraints(new[] { NSLayoutConstraint.Create(this.ratioEditor, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0), NSLayoutConstraint.Create(this.ratioEditor, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, 0), NSLayoutConstraint.Create(this.ratioEditor, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, -6), }); }
public CollectionInlineEditorControl(IHostResourceProvider hostResources) : base(hostResources) { this.label = new UnfocusableTextField { TranslatesAutoresizingMaskIntoConstraints = false, StringValue = Properties.Resources.CollectionValue, }; AddSubview(this.label); this.openCollection = new FocusableButton { Title = Properties.Resources.CollectionEditButton, BezelStyle = NSBezelStyle.Rounded, AccessibilityEnabled = true, AccessibilityHelp = Properties.Resources.AccessibilityCollectionHelp }; this.openCollection.Activated += (o, e) => { CollectionEditorWindow.EditCollection(EffectiveAppearance, HostResources, ViewModel); }; AddSubview(this.openCollection); AddConstraints(new[] { NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1, 0), NSLayoutConstraint.Create(this.label, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1, 0), NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, 0), NSLayoutConstraint.Create(this.openCollection, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this.label, NSLayoutAttribute.Trailing, 1, 12), NSLayoutConstraint.Create(this.openCollection, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1, 0), NSLayoutConstraint.Create(this.openCollection, NSLayoutAttribute.Width, NSLayoutRelation.GreaterThanOrEqual, 1, 70), NSLayoutConstraint.Create(this.openCollection, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, -6) }); ViewDidChangeEffectiveAppearance(); }
public TypeEditorControl(IHostResourceProvider hostResources) : base(hostResources) { this.typeLabel = new UnfocusableTextField { TranslatesAutoresizingMaskIntoConstraints = false }; AddSubview(this.typeLabel); this.selectType = new FocusableButton { BezelStyle = NSBezelStyle.Rounded, Title = Properties.Resources.Select, ProxyResponder = new ProxyResponder(this, ProxyRowType.SingleView) }; this.selectType.Activated += OnSelectPressed; AddSubview(this.selectType); AddConstraints(new[] { NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1f, 0f), NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f), NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, 0), NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this.selectType, NSLayoutAttribute.Left, 1, -4), NSLayoutConstraint.Create(this.selectType, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0), NSLayoutConstraint.Create(this.selectType, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f), NSLayoutConstraint.Create(this.selectType, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1f, DefaultButtonWidth), }); }
public ObjectEditorControl(IHostResourceProvider hostResources) : base(hostResources) { this.typeLabel = new UnfocusableTextField { TranslatesAutoresizingMaskIntoConstraints = false }; AddSubview(this.typeLabel); this.createObject = new FocusableButton { Title = Properties.Resources.New, BezelStyle = NSBezelStyle.Rounded, }; this.createObject.Activated += OnNewPressed; AddSubview(this.createObject); //this.buttonConstraint = NSLayoutConstraint.Create (this.createObject, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this.typeLabel, NSLayoutAttribute.Trailing, 1f, 12); AddConstraints(new[] { NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1f, 0f), NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f), NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, 0), NSLayoutConstraint.Create(this.typeLabel, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this.createObject, NSLayoutAttribute.Left, 1, -4), NSLayoutConstraint.Create(this.createObject, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0), NSLayoutConstraint.Create(this.createObject, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f), NSLayoutConstraint.Create(this.createObject, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1f, DefaultButtonWidth), }); }
public CollectionItemView(IIconProvider iconProvider, IHostResourceProvider hostResources) { Identifier = CollectionItemId; this.iconProvider = iconProvider; this.hostResources = hostResources; AddSubview(this.label); if (iconProvider != null) { AddSubview(this.iconView); AddConstraints(new[] { NSLayoutConstraint.Create(this.iconView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1, 7), NSLayoutConstraint.Create(this.iconView, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1, 0), NSLayoutConstraint.Create(this.iconView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 16), NSLayoutConstraint.Create(this.iconView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1, 16), NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this.iconView, NSLayoutAttribute.Trailing, 1, 0), }); } else { AddConstraint(NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1, 7)); } AddConstraints(new[] { NSLayoutConstraint.Create(this.label, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1, 0), NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, 0) }); ViewDidChangeEffectiveAppearance(); }
public BrushTabViewController(IHostResourceProvider hostResources) : base(hostResources) { TabBorderColor = NamedResources.TabBorderColor; TabBackgroundColor = NamedResources.PadBackgroundColor; PreferredContentSize = new CGSize(450, 280); TransitionOptions = NSViewControllerTransitionOptions.None; ContentPadding = new NSEdgeInsets(8, 8, 8, 8); this.filterResource = new NSSearchField { ControlSize = NSControlSize.Mini, Font = NSFont.SystemFontOfSize(NSFont.SystemFontSizeForControlSize(NSControlSize.Mini)), PlaceholderString = Properties.Resources.SearchResourcesTitle, }; this.filterResource.Changed += (sender, e) => { ViewModel.ResourceSelector.FilterText = this.filterResource.Cell.Title; this.resource.ReloadData(); }; this.filterResource.Hidden = true; TabStack.AddView(this.filterResource, NSStackViewGravity.Leading); }
public RequestResourcePreviewPanel(IHostResourceProvider hostResources, CGRect frame) : base(frame) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } this.hostResources = hostResources; var FrameHeightHalf = (Frame.Height - 32) / 2; var FrameWidthHalf = (Frame.Width - 32) / 2; var FrameWidthThird = (Frame.Width - 32) / 3; this.noPreviewAvailable = new UnfocusableTextField { StringValue = Properties.Resources.NoPreviewAvailable, Frame = new CGRect(50, FrameHeightHalf, 150, 50), }; AddSubview(this.noPreviewAvailable); this.previewView = new NSView(new CGRect(20, 0, frame.Width - 30, frame.Height)) { Hidden = true // Hidden until a resource is selected and a preview is available for it. }; AddSubview(this.previewView); }
public CategoryContainerControl(IHostResourceProvider hostResources, NSOutlineView outlineView) : base(hostResources) { if (outlineView == null) { throw new ArgumentNullException(nameof(outlineView)); } this.outlineView = outlineView; this.disclosure = this.outlineView.MakeView("NSOutlineViewDisclosureButtonKey", outlineView) as NSButton; this.disclosure.TranslatesAutoresizingMaskIntoConstraints = false; AddSubview(this.disclosure); var label = new UnfocusableTextField { TranslatesAutoresizingMaskIntoConstraints = false }; AddSubview(label); AddConstraints(new[] { NSLayoutConstraint.Create(this.disclosure, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1, 0), NSLayoutConstraint.Create(this.disclosure, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1, 4), NSLayoutConstraint.Create(label, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this.disclosure, NSLayoutAttribute.Right, 1, 0), NSLayoutConstraint.Create(label, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1, 0), }); }
public PropertyButton(IHostResourceProvider hostResources) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } this.hostResources = hostResources; AccessibilityHelp = Properties.Resources.AccessibilityPropertiesButtonDescription; Enabled = true; Image = this.hostResources.GetNamedImage("pe-property-button-default-mac-10"); ImageScaling = NSImageScale.None; ToolTip = Properties.Resources.Default; OnMouseEntered += (sender, e) => { UpdateImage(true); }; OnMouseExited += (sender, e) => { UpdateImage(); }; OnMouseLeftDown += (sender, e) => { PopUpContextMenu(); }; AppearanceChanged(); }
private void Initialize(IHostResourceProvider hostResources) { WantsLayer = true; Editors = CreateEditors(hostResources, EditorType); this.hexLabel = new UnfocusableTextField { StringValue = "#:", Alignment = NSTextAlignment.Right, ToolTip = Properties.Resources.HexValue }; AddSubview(this.hexLabel); this.hexEditor = new NSTextField { Alignment = NSTextAlignment.Right, ControlSize = NSControlSize.Small, Font = NSFont.SystemFontOfSize(NSFont.SystemFontSizeForControlSize(NSControlSize.Small)) }; AddSubview(this.hexEditor); this.hexEditor.EditingEnded += (o, e) => { if (CommonColor.TryParseArgbHex(this.hexEditor.StringValue, out CommonColor c)) { ViewModel.Color = c; this.hexEditor.StringValue = c.ToString(); } }; }
protected BasePointEditorControl(IHostResourceProvider hostResources) : base(hostResources) { XLabel = new UnfocusableTextField { Font = NSFont.FromFontName(DefaultFontName, DefaultDescriptionLabelFontSize), TranslatesAutoresizingMaskIntoConstraints = false, }; XEditor = new NumericSpinEditor <T> (hostResources) { BackgroundColor = NSColor.Clear, Value = 0.0f }; XEditor.ProxyResponder = new ProxyResponder(this, ProxyRowType.FirstView); XEditor.ValueChanged += OnInputUpdated; YLabel = new UnfocusableTextField { Font = NSFont.FromFontName(DefaultFontName, DefaultDescriptionLabelFontSize), TranslatesAutoresizingMaskIntoConstraints = false, }; YEditor = new NumericSpinEditor <T> (hostResources) { BackgroundColor = NSColor.Clear, Value = 0.0f }; YEditor.ProxyResponder = new ProxyResponder(this, ProxyRowType.LastView); YEditor.ValueChanged += OnInputUpdated; AddSubview(XLabel); AddSubview(XEditor); AddSubview(YLabel); AddSubview(YEditor); const float editorHeight = 18; this.AddConstraints(new[] { NSLayoutConstraint.Create(XEditor, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this, NSLayoutAttribute.Top, 1f, 3f), NSLayoutConstraint.Create(XEditor, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1f, 0f), NSLayoutConstraint.Create(XEditor, NSLayoutAttribute.Right, NSLayoutRelation.Equal, YEditor, NSLayoutAttribute.Left, 1f, -10f), NSLayoutConstraint.Create(XEditor, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, editorHeight), NSLayoutConstraint.Create(XLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, XEditor, NSLayoutAttribute.Bottom, 1f, -4f), NSLayoutConstraint.Create(XLabel, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, editorHeight), NSLayoutConstraint.Create(YEditor, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this, NSLayoutAttribute.Top, 1f, 3f), NSLayoutConstraint.Create(YEditor, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0), NSLayoutConstraint.Create(YEditor, NSLayoutAttribute.Width, NSLayoutRelation.Equal, XEditor, NSLayoutAttribute.Width, 1f, 0f), NSLayoutConstraint.Create(YEditor, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, editorHeight), NSLayoutConstraint.Create(YLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, XLabel, NSLayoutAttribute.Top, 1f, 0f), NSLayoutConstraint.Create(YLabel, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, editorHeight), NSLayoutConstraint.Create(XLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, XEditor.Subviews[0], NSLayoutAttribute.CenterX, 1f, 0), NSLayoutConstraint.Create(YLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, YEditor.Subviews[0], NSLayoutAttribute.CenterX, 1f, 0), }); AppearanceChanged(); }
public CustomExpressionView(IHostResourceProvider hostResources, PropertyViewModel viewModel) : base(hostResources, viewModel, Properties.Resources.CustomExpression, "pe-custom-expression-32") { Frame = new CGRect(CGPoint.Empty, new CGSize(250, 80)); Type vmType = viewModel.GetType(); PropertyInfo previewCustomExpressionPropertyInfo = vmType.GetProperty(PreviewCustomExpressionString); previewCustomExpressionPropertyInfo.SetValue(viewModel, string.Empty); PropertyInfo customExpressionPropertyInfo = vmType.GetProperty(CustomExpressionPropertyString); var value = customExpressionPropertyInfo.GetValue(viewModel); NSControl editorControl = null; PropertyInfo customAutocompleteItemsPropertyInfo = vmType.GetProperty(AutocompleteItemsString); if (customAutocompleteItemsPropertyInfo.GetValue(viewModel) is ObservableCollectionEx <string> values) { if (values != null && values.Count > 0) { editorControl = new AutocompleteComboBox(hostResources, viewModel, values, previewCustomExpressionPropertyInfo) { AccessibilityEnabled = true, AccessibilityTitle = Properties.Resources.AccessibilityCustomExpressionCombobox, } } ; } if (editorControl == null) { editorControl = new NSTextField { AccessibilityEnabled = true, AccessibilityTitle = Properties.Resources.AccessibilityCustomExpressionEditControl, } } ; editorControl.TranslatesAutoresizingMaskIntoConstraints = false; editorControl.StringValue = (string)value ?? string.Empty; editorControl.Activated += (sender, e) => { PopOver.CloseOnEnter = true; customExpressionPropertyInfo.SetValue(viewModel, editorControl.StringValue); }; AddSubview(editorControl); this.AddConstraints(new[] { NSLayoutConstraint.Create(editorControl, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this, NSLayoutAttribute.Top, 1f, 37f), NSLayoutConstraint.Create(editorControl, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this, NSLayoutAttribute.Left, 1f, 38f), NSLayoutConstraint.Create(editorControl, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, -57f), NSLayoutConstraint.Create(editorControl, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, PropertyEditorControl.DefaultControlHeight), }); } } }
public ResourceOutlineViewDelegate(IHostResourceProvider hostResource) { if (hostResource == null) { throw new ArgumentNullException(nameof(hostResource)); } this.hostResources = hostResource; }
public RatioEditor(IHostResourceProvider hostResources) : base(hostResources) { AllowNegativeValues = false; AllowRatios = true; BackgroundColor = NSColor.Clear; StringValue = string.Empty; TranslatesAutoresizingMaskIntoConstraints = false; }
public override IValueView CreateView(IHostResourceProvider hostResources, Type valueType) { if (!ValueTypes.TryGetValue(valueType, out Type viewType)) { return(null); } return((IValueView)Activator.CreateInstance(viewType, hostResources)); }
public UnderlinedTabViewController(IHostResourceProvider hostResources) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } HostResources = hostResources; }
protected PropertyEditorControl(IHostResourceProvider hostResources) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } HostResources = hostResources; }
public PropertyContainer(IHostResourceProvider hostResources, INativeContainer nativeView, bool includePropertyButton, float vertInset = 0) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } NativeContainer = nativeView; AddSubview(this.label); AddConstraints(new[] { NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Left, NSLayoutRelation.GreaterThanOrEqual, this, NSLayoutAttribute.Left, 1, 0f), NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, Mac.Layout.GoldenRatioLeft, 0f), NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1f, 18), }); if (NativeContainer != null) { AddSubview(NativeContainer.NativeView); NativeContainer.NativeView.TranslatesAutoresizingMaskIntoConstraints = false; if (NativeContainer.NativeView is PropertyEditorControl pec && pec.FirstKeyView != null) { AddConstraint(NSLayoutConstraint.Create(this.label, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, pec.FirstKeyView, NSLayoutAttribute.CenterY, 1, 0)); } else { AddConstraint(NSLayoutConstraint.Create(this.label, NSLayoutAttribute.Top, NSLayoutRelation.Equal, this, NSLayoutAttribute.Top, 1, 3)); } AddConstraints(new[] { NSLayoutConstraint.Create(NativeContainer.NativeView, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f), NSLayoutConstraint.Create(NativeContainer.NativeView, NSLayoutAttribute.Left, NSLayoutRelation.Equal, this.label, NSLayoutAttribute.Right, 1f, LabelToControlSpacing), NSLayoutConstraint.Create(NativeContainer.NativeView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1f, vertInset) }); if (includePropertyButton) { this.propertyButton = new PropertyButton(hostResources) { TranslatesAutoresizingMaskIntoConstraints = false }; AddSubview(this.propertyButton); AddConstraints(new[] { NSLayoutConstraint.Create(this.propertyButton, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this.label, NSLayoutAttribute.CenterY, 1, 0), NSLayoutConstraint.Create(NativeContainer.NativeView, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this.propertyButton, NSLayoutAttribute.Left, 1f, -EditorToButtonSpacing), NSLayoutConstraint.Create(this.propertyButton, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, -ButtonToWallSpacing), NSLayoutConstraint.Create(this.propertyButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, 1f, PropertyButton.DefaultSize), }); } else { AddConstraint(NSLayoutConstraint.Create(NativeContainer.NativeView, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0f)); } }
public FilePathEditorControl(IHostResourceProvider hostResource) : base(hostResource) { this.currentTextField.ToolTip = this.currentTextField.PlaceholderString = string.Format(Properties.Resources.ChooseFileOrDirectory, Properties.Resources.File); this.panel.CanChooseFiles = true; this.panel.CanChooseDirectories = false; this.revealPathButton.ToolTip = string.Format(Properties.Resources.RevealFileOrDirectory, Properties.Resources.File); this.browsePathButton.ToolTip = string.Format(Properties.Resources.BrowseFileOrDirectory, Properties.Resources.File); this.panel.Title = string.Format(Properties.Resources.ChooseFileOrDirectory, Properties.Resources.File); }
public SolidColorBrushEditorViewController(IHostResourceProvider hostResources) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } this.hostResources = hostResources; PreferredContentSize = new CGSize(430, 230); }
public BasePopOverViewModelControl(IHostResourceProvider hostResources, PropertyViewModel viewModel, string title, string imageNamed) : base(hostResources, title, imageNamed) { if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } ViewModel = viewModel; }
public UnderlinedImageView(IHostResourceProvider hostResources, string name) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } this.hostResources = hostResources; this.name = name; }
public MaterialBrushEditorViewController(IHostResourceProvider hostResources) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } this.hostResources = hostResources; PreferredContentSize = new CGSize(PreferredContentSizeWidth, PreferredContentSizeHeight); }
public ResourceTableDelegate(IHostResourceProvider hostResources, ResourceTableDataSource resourceTableDatasource) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } this.datasource = resourceTableDatasource; this.hostResources = hostResources; }
public RequestResourcePanel(IHostResourceProvider hostResources, ResourceSelectorViewModel viewModel, object value) { if (hostResources == null) { throw new ArgumentNullException(nameof(hostResources)); } this.viewModel = viewModel; this.viewModel.PropertyChanged += OnPropertyChanged; Initialize(hostResources, value); }