示例#1
0
        /// <inheritdoc/>
        public void Setup(IInspector inspectorContainingToolbar, IInspectorToolbar toolbarContainingItem, ToolbarItemAlignment alignment)
        {
            inspector    = inspectorContainingToolbar;
            toolbar      = toolbarContainingItem;
            bounds.width = 0f;
            Alignment    = alignment;

            Setup();
        }
 /// <inheritdoc/>
 protected override void SetupToolbar(IInspectorToolbar setupToolbar)
 {
     setupToolbar.Setup(this /*, OnBackButtonActivate, OnForwardButtonActivate, OnViewMenuButtonActivated*/);
 }
示例#3
0
        public static IInspectorToolbarItem[] GetItemsForToolbar([NotNull] IInspector inspector, [NotNull] IInspectorToolbar toolbar)
        {
            if (toolbarItemsByToolbarType == null)
            {
                BuildDictionaries();
            }

            Type[] itemTypes;
            if (!toolbarItemsByToolbarType.TryGetValue(toolbar.GetType(), out itemTypes))
            {
                return(ArrayPool <IInspectorToolbarItem> .ZeroSizeArray);
            }

            int count = itemTypes.Length;

            IInspectorToolbarItem[] items = new IInspectorToolbarItem[count];
            for (int n = count - 1; n >= 0; n--)
            {
                var itemType  = itemTypes[n];
                var item      = (IInspectorToolbarItem)itemType.CreateInstance();
                var alignment = ((ToolbarItemForAttribute)itemType.GetCustomAttributes(typeof(ToolbarItemForAttribute), false)[0]).alignment;
                item.Setup(inspector, toolbar, alignment);
                items[n] = item;
            }

            return(items);
        }