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

ViewPrimitives.cs « EditorPrimitives « Impl « Text « src - github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b2b1dcf71f16a5c96afb5e1bb0a36007e6fbf9c (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
//
//  Copyright (c) Microsoft Corporation. All rights reserved.
//  Licensed under the MIT License. See License.txt in the project root for license information.
//
// This file contain implementations details that are subject to change without notice.
// Use at your own risk.
//
namespace Microsoft.VisualStudio.Text.EditorPrimitives.Implementation
{
    using Microsoft.VisualStudio.Text.Editor;

    internal sealed class ViewPrimitives : IViewPrimitives
    {
        private TextView _textView;
        private Selection _selection;
        private Caret _caret;
        private TextBuffer _textBuffer;
        
        #region IViewPrimitives Members

        internal ViewPrimitives(ITextView textView, IViewPrimitivesFactoryService viewPrimitivesFactory)
        {
            _textView = viewPrimitivesFactory.CreateTextView(textView);

            _textBuffer = _textView.TextBuffer;
            _selection = _textView.Selection;
            _caret = _textView.Caret;
        }

        public TextView View
        {
            get { return _textView; }
        }

        public Selection Selection
        {
            get { return _selection; }
        }

        public Caret Caret
        {
            get { return _caret; }
        }

        public TextBuffer Buffer
        {
            get { return _textBuffer; }
        }

        #endregion
    }
}