protected LabelWithTooltipWidget(LabelWithTooltipWidget other) : base(other) { TooltipTemplate = other.TooltipTemplate; TooltipContainer = other.TooltipContainer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get<TooltipContainerWidget>(TooltipContainer)); GetTooltipText = other.GetTooltipText; }
protected LabelWithTooltipWidget(LabelWithTooltipWidget other) : base(other) { TooltipTemplate = other.TooltipTemplate; TooltipContainer = other.TooltipContainer; tooltipContainer = Exts.Lazy(() => Ui.Root.Get <TooltipContainerWidget>(TooltipContainer)); GetTooltipText = other.GetTooltipText; }
public static void TruncateLabelToTooltip(LabelWithTooltipWidget label, string text) { var truncatedText = TruncateText(text, label.Bounds.Width, Game.Renderer.Fonts[label.Font]); label.GetText = () => truncatedText; if (text != truncatedText) { label.GetTooltipText = () => text; } else { label.GetTooltipText = null; } }