示例#1
0
 public TextCaret(IWpfTextView textView, IAdornmentLayer caretLayer, ISmartIndentationService smartIndentationService, IClassificationFormatMap classificationFormatMap)
 {
     if (caretLayer == null)
     {
         throw new ArgumentNullException(nameof(caretLayer));
     }
     if (classificationFormatMap == null)
     {
         throw new ArgumentNullException(nameof(classificationFormatMap));
     }
     this.textView = textView ?? throw new ArgumentNullException(nameof(textView));
     imeState      = new ImeState();
     this.smartIndentationService = smartIndentationService ?? throw new ArgumentNullException(nameof(smartIndentationService));
     preferredXCoordinate         = 0;
     __preferredYCoordinate       = 0;
     Affinity        = PositionAffinity.Successor;
     currentPosition = new VirtualSnapshotPoint(textView.TextSnapshot, 0);
     textView.TextBuffer.ChangedHighPriority += TextBuffer_ChangedHighPriority;
     textView.TextBuffer.ContentTypeChanged  += TextBuffer_ContentTypeChanged;
     textView.Options.OptionChanged          += Options_OptionChanged;
     textView.VisualElement.AddHandler(UIElement.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true);
     textView.VisualElement.AddHandler(UIElement.LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true);
     textView.LayoutChanged += TextView_LayoutChanged;
     textCaretLayer          = new TextCaretLayer(this, caretLayer, classificationFormatMap);
     InputMethod.SetIsInputMethodSuspended(textView.VisualElement, true);
 }
示例#2
0
		public TextCaret(IWpfTextView textView, IAdornmentLayer caretLayer, ISmartIndentationService smartIndentationService, IClassificationFormatMap classificationFormatMap) {
			if (textView == null)
				throw new ArgumentNullException(nameof(textView));
			if (caretLayer == null)
				throw new ArgumentNullException(nameof(caretLayer));
			if (smartIndentationService == null)
				throw new ArgumentNullException(nameof(smartIndentationService));
			if (classificationFormatMap == null)
				throw new ArgumentNullException(nameof(classificationFormatMap));
			this.textView = textView;
			imeState = new ImeState();
			this.smartIndentationService = smartIndentationService;
			preferredXCoordinate = 0;
			__preferredYCoordinate = 0;
			Affinity = PositionAffinity.Successor;
			currentPosition = new VirtualSnapshotPoint(textView.TextSnapshot, 0);
			textView.TextBuffer.ChangedHighPriority += TextBuffer_ChangedHighPriority;
			textView.TextBuffer.ContentTypeChanged += TextBuffer_ContentTypeChanged;
			textView.Options.OptionChanged += Options_OptionChanged;
			textView.VisualElement.AddHandler(UIElement.GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true);
			textView.VisualElement.AddHandler(UIElement.LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true);
			textView.LayoutChanged += TextView_LayoutChanged;
			textCaretLayer = new TextCaretLayer(this, caretLayer, classificationFormatMap);
			InputMethod.SetIsInputMethodSuspended(textView.VisualElement, true);
		}