/// <inheritdoc />
 public override void OnThumbnailDrawBegin(ThumbnailRequest request, ContainerControl guiRoot, GPUContext context)
 {
     guiRoot.AddChild(new Label
     {
         Text         = Path.GetFileNameWithoutExtension(request.Asset.Path),
         Offsets      = Margin.Zero,
         AnchorPreset = AnchorPresets.StretchAll,
         Wrapping     = TextWrapping.WrapWords
     });
 }
示例#2
0
 /// <summary>
 /// Called when thumbnail drawing begins. Proxy should setup scene GUI for guiRoot.
 /// </summary>
 /// <param name="request">The request to render thumbnail.</param>
 /// <param name="guiRoot">The GUI root container control.</param>
 /// <param name="context">GPU context.</param>
 public virtual void OnThumbnailDrawBegin(ThumbnailRequest request, ContainerControl guiRoot, GPUContext context)
 {
     guiRoot.AddChild(new Label
     {
         Text         = Name,
         AnchorPreset = AnchorPresets.StretchAll,
         Offsets      = Margin.Zero,
         Wrapping     = TextWrapping.WrapWords
     });
 }
示例#3
0
        /// <inheritdoc />
        public override void OnThumbnailDrawBegin(ThumbnailRequest request, ContainerControl guiRoot, GPUContext context)
        {
            var asset = FlaxEngine.Content.Load <FontAsset>(request.Item.Path);

            guiRoot.AddChild(new Label(Vector2.Zero, guiRoot.Size)
            {
                Text     = asset.FamilyName,
                Wrapping = TextWrapping.WrapWords
            });
        }
示例#4
0
        /// <inheritdoc />
        public override void OnThumbnailDrawBegin(ThumbnailRequest request, ContainerControl guiRoot, GPUContext context)
        {
            var asset = FlaxEngine.Content.LoadAsync <FontAsset>(request.Item.ID);

            guiRoot.AddChild(new Label
            {
                Text         = asset.FamilyName,
                AnchorPreset = AnchorPresets.StretchAll,
                Offsets      = Margin.Zero,
                Wrapping     = TextWrapping.WrapWords
            });
        }
示例#5
0
        private void OnSearchBoxTextChanged()
        {
            // Skip events during setup or init stuff
            if (IsLayoutLocked)
            {
                return;
            }

            var filterText = _searchBox.Text;

            _groupSearch.LockChildrenRecursive();
            _groupSearch.DisposeChildren();

            foreach (var actorType in Editor.CodeEditing.Actors.Get())
            {
                var text = actorType.Name;

                QueryFilterHelper.Range[] ranges;
                if (!QueryFilterHelper.Match(filterText, text, out ranges))
                {
                    continue;
                }

                var item = _groupSearch.AddChild(CreateActorItem(CustomEditors.CustomEditorsUtil.GetPropertyNameUI(text), actorType));
                item.TooltipText = actorType.TypeName;
                var attributes       = actorType.GetAttributes(false);
                var tooltipAttribute = (TooltipAttribute)attributes.FirstOrDefault(x => x is TooltipAttribute);
                if (tooltipAttribute != null)
                {
                    item.TooltipText += '\n';
                    item.TooltipText += tooltipAttribute.Text;
                }

                var highlights = new List <Rectangle>(ranges.Length);
                var style      = Style.Current;
                var font       = style.FontSmall;
                var textRect   = item.TextRect;
                for (int i = 0; i < ranges.Length; i++)
                {
                    var start = font.GetCharPosition(text, ranges[i].StartIndex);
                    var end   = font.GetCharPosition(text, ranges[i].EndIndex);
                    highlights.Add(new Rectangle(start.X + textRect.X, textRect.Y, end.X - start.X, textRect.Height));
                }
                item.SetHighlights(highlights);
            }

            _groupSearch.UnlockChildrenRecursive();
            PerformLayout();
            PerformLayout();
        }