internal Caret(TextArea textArea) { this.textArea = textArea; this.textView = textArea.TextView; position = new TextViewPosition(1, 1, 0); ime = new ImeSupport(textArea); caretAdorner = new CaretLayer(textView); textView.InsertLayer(caretAdorner, KnownLayer.Caret, LayerInsertionPosition.Replace); textView.VisualLinesChanged += TextView_VisualLinesChanged; textView.ScrollOffsetChanged += TextView_ScrollOffsetChanged; }
/// <summary> /// Creates a new TextArea instance. /// </summary> protected TextArea(TextView textView) { if (textView == null) throw new ArgumentNullException("textView"); this.textView = textView; this.Options = textView.Options; selection = emptySelection = new EmptySelection(this); textView.Services.AddService(typeof(TextArea), this); textView.LineTransformers.Add(new SelectionColorizer(this)); textView.InsertLayer(new SelectionLayer(this), KnownLayer.Selection, LayerInsertionPosition.Replace); caret = new Caret(this); caret.PositionChanged += (sender, e) => RequestSelectionValidation(); ime = new ImeSupport(this); leftMargins.CollectionChanged += leftMargins_CollectionChanged; this.DefaultInputHandler = new TextAreaDefaultInputHandler(this); this.ActiveInputHandler = this.DefaultInputHandler; }