示例#1
0
        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);
        }
示例#2
0
 public NativeToolbarGroup(NSToolbarItemGroup itemGroup, double minItemWidth = 0, double itemSpacing = 0)
 {
     Group        = itemGroup;
     Items        = new List <Item>();
     MinItemWidth = minItemWidth;
     ItemSpacing  = itemSpacing;
 }
示例#3
0
        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");
        }
示例#4
0
 public NativeToolbarGroup(NSToolbarItemGroup itemGroup)
 {
     Group = itemGroup;
     Items = new List <Item>();
 }