示例#1
0
        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;
        }
示例#3
0
        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;
            }
        }