Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ContainerElement.cs « ViewElementFactories « ToolTipService « Adornments « TextUI « Def « Text « src - github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 22d0b42e992aaeb618457096344124f1e5b95047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
namespace Microsoft.VisualStudio.Text.Adornments
{
    using System;
    using System.Collections.Generic;
    using System.Collections.Immutable;

    /// <summary>
    /// Represents a container of zero or more elements for display in an <see cref="IToolTipPresenter"/>.
    /// </summary>
    /// <remarks>
    /// Elements are translated to platform-specific UI constructs via the <see cref="IViewElementFactoryService"/>.
    /// </remarks>
    public sealed class ContainerElement
    {
        /// <summary>
        /// Constructs a new container.
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="elements"/> is <c>null</c>.</exception>
        /// <param name="style">The layout style for the container.</param>
        /// <param name="elements">The <see cref="IViewElementFactoryService"/> elements to display.</param>
        public ContainerElement(ContainerElementStyle style, IEnumerable<object> elements)
        {
            this.Style = style;
            this.Elements = elements?.ToImmutableList() ?? throw new ArgumentNullException(nameof(elements));
        }

        /// <summary>
        /// Constructs a new container.
        /// </summary>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="elements"/> is <c>null</c>.</exception>
        /// <param name="style">The layout style for the container.</param>
        /// <param name="elements">The elements to translate to UI and display via the <see cref="IViewElementFactoryService"/>.</param>
        public ContainerElement(ContainerElementStyle style, params object[] elements)
        {
            this.Style = style;
            this.Elements = elements?.ToImmutableList() ?? throw new ArgumentNullException(nameof(elements));
        }

        /// <summary>
        /// The elements to be displayed in the container.
        /// </summary>
        public IEnumerable<object> Elements { get; }

        /// <summary>
        /// The layout style for the container.
        /// </summary>
        public ContainerElementStyle Style { get; }
    }
}