Example #1
0
        private void CreateFrame()
        {
            SetLabel(Proxy.Label, Proxy.Tooltip);

            _addButton     = AddHeaderButton(_addIcon.Texture, Proxy.AddTooltip, AddButtonUssClassName, AddItem);
            _removeButtons = Content.Query <IconButton>(className: RemoveButtonUssClassName).Build();

            var empty = new TextElement {
                text = Proxy.EmptyLabel, tooltip = Proxy.EmptyTooltip
            };

            empty.AddToClassList(EmptyLabelUssClassName);

            _itemsContainer = new VisualElement();
            _itemsContainer.AddToClassList(ItemsUssClassName);

            Content.Add(empty);
            Content.Add(_itemsContainer);
        }
Example #2
0
        private VisualElement CreateButton(string label, ButtonIcon icon, Action method, string tooltip)
        {
            if (string.IsNullOrEmpty(label))
            {
                var button = new IconButton(method)
                {
                    image   = null,
                    tooltip = tooltip
                };

                button.SetIcon(icon.ToString());
                button.style.width  = button.image.width;
                button.style.height = button.image.height;
                return(button);
            }
            else
            {
                return(new Button(method)
                {
                    text = label,
                    tooltip = tooltip
                });
            }
        }