コード例 #1
0
        void InsertToolbarItem(ShellSection section)
        {
            if (_toolbarItemList.Count < 5)
            {
                EToolbarItem item = null;
                if (_moreToolbarItem == null)
                {
                    item = _tabs.Append(section.Title, GetIconPath(section.Icon));
                }
                else
                {
                    item = _tabs.InsertBefore(_moreToolbarItem, section.Title, GetIconPath(section.Icon));
                }

                if (item != null)
                {
                    item.SetPartColor("bg", _backgroudColor);
                    item.SetPartColor("underline", EColor.Transparent);

                    _toolbarItemList.AddLast(item);
                    _itemToSection.Add(item, section);
                    _sectionToitem.Add(section, item);
                }
            }
            else if (_moreToolbarItem == null && _toolbarItemList.Count == 5)
            {
                var last        = _toolbarItemList.Last() as EToolbarItem;
                var lastSection = _itemToSection[last];

                _toolbarItemList.RemoveLast();
                _itemToSection.Remove(last);
                _sectionToitem.Remove(lastSection);
                last.Delete();

                _moreToolbarItem = CreateTabsItem("More");
                _toolbarItemList.AddLast(_moreToolbarItem);
                InitializeTabsItem(_moreToolbarItem, _dotsIcon);

                _more.AddItem(lastSection);
                _more.AddItem(section);
            }
            else
            {
                _more.AddItem(section);
            }
        }
コード例 #2
0
        EToolbarItem InsertToolbarItem(ShellContent content)
        {
            EToolbarItem item = _tabs.Append(content.Title, null);

            item.SetPartColor("bg", _backgroundColor);

            _toolbarItemList.AddLast(item);
            _itemToContent.Add(item, content);
            _contentToItem.Add(content, item);

            return(item);
        }