Path: blob/main/src/vs/base/browser/ui/iconLabel/simpleIconLabel.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { reset } from '../../dom.js';6import type { IManagedHover } from '../hover/hover.js';7import { getBaseLayerHoverDelegate } from '../hover/hoverDelegate2.js';8import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';9import { renderLabelWithIcons } from './iconLabels.js';10import { IDisposable } from '../../../common/lifecycle.js';1112export class SimpleIconLabel implements IDisposable {1314private hover?: IManagedHover;1516constructor(17private readonly _container: HTMLElement18) { }1920set text(text: string) {21reset(this._container, ...renderLabelWithIcons(text ?? ''));22}2324set title(title: string) {25if (!this.hover && title) {26this.hover = getBaseLayerHoverDelegate().setupManagedHover(getDefaultHoverDelegate('mouse'), this._container, title);27} else if (this.hover) {28this.hover.update(title);29}30}3132dispose(): void {33this.hover?.dispose();34}35}363738