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

GraphBufferContentTypeChangedEventArgs.cs « Projection « Model « TextData « Def « Text « src - github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b3f2e49f5857c86b21827263e24b5af069afecdf (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
//  Copyright (c) Microsoft Corporation. All rights reserved.
//  Licensed under the MIT License. See License.txt in the project root for license information.
//
namespace Microsoft.VisualStudio.Text.Projection
{
    using System;
    using Microsoft.VisualStudio.Utilities;

    /// <summary>
    /// Provides data about a change of <see cref="IContentType"/> on a member of a <see cref="IBufferGraph"/>.
    /// </summary>
    public class GraphBufferContentTypeChangedEventArgs : EventArgs
    {
        private ITextBuffer textBuffer;
        private IContentType beforeContentType;
        private IContentType afterContentType;

        /// <summary>
        /// Initializes a new instance of <see cref="GraphBufferContentTypeChangedEventArgs"/> with the specified
        /// text buffer and the old and new content types.
        /// </summary>
        /// <param name="textBuffer">The <see cref="ITextBuffer"/> whose <see cref="IContentType"/> has changed.</param>
        /// <param name="beforeContentType">The <see cref="IContentType"/> before the change.</param>
        /// <param name="afterContentType">The <see cref="IContentType"/> after the change.</param>
        /// <exception cref="ArgumentNullException">One of <paramref name="textBuffer"/>, <paramref name="beforeContentType"/>, 
        /// or <paramref name="afterContentType"/> is null.</exception>
        public GraphBufferContentTypeChangedEventArgs(ITextBuffer textBuffer, IContentType beforeContentType, IContentType afterContentType)
        {
            if (textBuffer == null)
            {
                throw new ArgumentNullException(nameof(textBuffer));
            }
            if (beforeContentType == null)
            {
                throw new ArgumentNullException(nameof(beforeContentType));
            }
            if (afterContentType == null)
            {
                throw new ArgumentNullException(nameof(afterContentType));
            }
            this.textBuffer = textBuffer;
            this.beforeContentType = beforeContentType;
            this.afterContentType = afterContentType;
        }

        /// <summary>
        /// The <see cref="ITextBuffer"/> whose <see cref="IContentType"/> has changed.
        /// </summary>
        public ITextBuffer TextBuffer
        {
            get { return this.textBuffer; }
        }

        /// <summary>
        /// The <see cref="IContentType"/> before the change.
        /// </summary>
        public IContentType BeforeContentType
        {
            get { return this.beforeContentType; }
        }

        /// <summary>
        /// The <see cref="IContentType"/> after the change.
        /// </summary>
        public IContentType AfterContentType
        {
            get { return this.afterContentType; }
        }
    }
}