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 ScrollContainerView(NSView content) { ContentInsets = new NSEdgeInsets(0, 0, 0, 0); HasVerticalScroller = true; HasHorizontalScroller = false; DocumentView = content; }
public override CoreGraphics.CGRect ConstrainBoundsRect(CGRect proposedBounds) { if (DocumentView == null) { return(base.ConstrainBoundsRect(proposedBounds)); } CGRect newClipBoundsRect = base.ConstrainBoundsRect(proposedBounds); NSEdgeInsets insets = ConvertetContentInsetsToProposedBoundsSize(newClipBoundsRect.Size); nfloat minYInset = IsFlipped ? insets.Top : insets.Bottom; nfloat maxYInset = IsFlipped ? insets.Bottom : insets.Top; nfloat minXInset = insets.Left; nfloat maxXInset = insets.Right; CGRect documentFrame = DocumentView.Frame; CGRect outsetDocumentFrame = new CGRect( documentFrame.GetMinX() - minXInset, documentFrame.GetMinY() - minYInset, documentFrame.Width + (minXInset + maxXInset), documentFrame.Height + (minYInset + maxYInset)); if (newClipBoundsRect.Width > outsetDocumentFrame.Width) { newClipBoundsRect.X = outsetDocumentFrame.GetMinX() - (newClipBoundsRect.Width - outsetDocumentFrame.Width) / 2.0f; } else if (newClipBoundsRect.Width < outsetDocumentFrame.Width) { if (newClipBoundsRect.GetMaxX() > outsetDocumentFrame.GetMaxX()) { newClipBoundsRect.X = outsetDocumentFrame.GetMaxX() - newClipBoundsRect.Width; } else if (newClipBoundsRect.GetMinX() < outsetDocumentFrame.GetMinX()) { newClipBoundsRect.X = outsetDocumentFrame.GetMinX(); } } if (newClipBoundsRect.Height > outsetDocumentFrame.Height) { newClipBoundsRect.Y = outsetDocumentFrame.GetMinY() - (newClipBoundsRect.Height - outsetDocumentFrame.Height) / 2.0f; } else if (newClipBoundsRect.Height < outsetDocumentFrame.Height) { if (newClipBoundsRect.GetMaxY() > outsetDocumentFrame.GetMaxY()) { newClipBoundsRect.Y = outsetDocumentFrame.GetMaxY() - newClipBoundsRect.Height; } else if (newClipBoundsRect.GetMinY() < outsetDocumentFrame.GetMinY()) { newClipBoundsRect.Y = outsetDocumentFrame.GetMinY(); } } return(BackingAlignedRect(newClipBoundsRect, NSAlignmentOptions.AllEdgesNearest)); }
public ColorComponentTabViewController(IHostResourceProvider hostResources) : base(hostResources) { foreach (var value in Enum.GetValues(typeof(ChannelEditorType))) { var editorType = (ChannelEditorType)value; AddTabViewItem(new NSTabViewItem { Label = value.ToString(), ToolTip = GetToolTip(editorType), ViewController = new ColorComponentViewController(hostResources, editorType) }); } ContentPadding = new NSEdgeInsets(9, 0, 9, 0); TabStack.Spacing = 4; }
public static SizeF ToEtoSize(this NSEdgeInsets insets) { return(new SizeF((float)(insets.Left + insets.Right), (float)(insets.Top + insets.Bottom))); }
public static Padding ToEto(this NSEdgeInsets insets) { return(new Padding((int)insets.Left, (int)insets.Top, (int)insets.Right, (int)insets.Bottom)); }