public override NSToolbarItem WillInsertItem(NSToolbar toolbar, string itemIdentifier, bool willBeInserted) { var group = new NSToolbarItemGroup(itemIdentifier); var view = new NSView(); group.View = view; if (itemIdentifier == NavigationGroupIdentifier) { _navigationGroup = new NativeToolbarGroup(group, BackButtonItemWidth); } else if (itemIdentifier == TitleGroupIdentifier) { _titleGroup = new NativeToolbarGroup(group); } else if (itemIdentifier == TabbedGroupIdentifier) { _tabbedGroup = new NativeToolbarGroup(group); } else if (itemIdentifier == ToolbarItemsGroupIdentifier) { _toolbarGroup = new NativeToolbarGroup(group, ToolbarItemWidth, ToolbarItemSpacing); } return(group); }
public NativeToolbarGroup(NSToolbarItemGroup itemGroup, double minItemWidth = 0, double itemSpacing = 0) { Group = itemGroup; Items = new List <Item>(); MinItemWidth = minItemWidth; ItemSpacing = itemSpacing; }
public void InitTests() { const string TestLabel = "NSToolbarItemTests.Label"; NSToolbarItem item = new NSToolbarItem(); Assert.IsNotNull(item.Handle, "NSToolbarItem has handle"); item.Label = TestLabel; Assert.AreEqual(item.Label, TestLabel, "NSToolbarItem has non null Label"); NSToolbarItemGroup group = new NSToolbarItemGroup(); Assert.IsNotNull(group.Handle, "NSToolbarItemGroup has handle"); Assert.AreEqual(group.Subitems.Length, 0, "NSToolbarItemGroup has zero items"); group.Label = TestLabel; Assert.AreEqual(group.Label, TestLabel, "NSToolbarItemGroup has non null Label"); }
public NativeToolbarGroup(NSToolbarItemGroup itemGroup) { Group = itemGroup; Items = new List <Item>(); }