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

IViewElementFactory.cs « 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: eaf2893b14e57039a66cf999407c15129d913e25 (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
namespace Microsoft.VisualStudio.Text.Adornments
{
    using System;
    using Microsoft.VisualStudio.Text.Editor;
    using Microsoft.VisualStudio.Utilities;

    /// <summary>
    /// Converts from an object to its equivalent platform specific UI element.
    /// </summary>
    /// <remarks>
    /// <para>
    /// This type allows the same intermediate type to be rendered on different platforms through
    /// the use of platform specific exports that live in that platform's UI layer.
    /// </para>
    /// <para>
    /// You can supersede an existing <see cref="IViewElementFactory"/> for a (to, from) type
    /// pair via MEF <see cref="OrderAttribute"/>s.
    /// </para>
    /// </remarks>
    /// <example>
    /// [Export(typeof(IViewElementFactory))]
    /// [Name("object item")]
    /// [Conversion(from: typeof(object), to: typeof(UIElement))]
    /// [Order(After = "Foo", Before = "Bar")]
    /// </example>
    public interface IViewElementFactory
    {
        /// <summary>
        /// Converts <paramref name="model"/> into an equivalent object of type <typeparamref name="TView"/>.
        /// </summary>
        /// <exception cref="ArgumentException">Thrown if the conversion is unknown or unsupported.</exception>
        /// <typeparam name="TView">The base type of the view element on the specific platform.</typeparam>
        /// <param name="textView">The view that owns the control that will host this view element.</param>
        /// <param name="model">The object to convert to a view element.</param>
        /// <returns>A new object of type <typeparamref name="TView"/>.</returns>
        TView CreateViewElement<TView>(ITextView textView, object model) where TView : class;
    }
}