public ITextRangeProvider[] GetVisibleRanges() { ITextRangeProvider[] ret = new ITextRangeProvider[1]; if (this.fooTextBox.LayoutLineCollection.Count == 0) { ret[0] = new FooTextBoxRangeProvider(this.fooTextBox, 0, 0, this); } else { EditView view = this.fooTextBox.View; int startIndex = view.GetIndexFromLayoutLine(new TextPoint(view.Src.Row, 0)); int endIndex = view.GetIndexFromLayoutLine(new TextPoint(view.Src.Row + view.LineCountOnScreen, 0)); ret[0] = new FooTextBoxRangeProvider(this.fooTextBox, startIndex, endIndex - startIndex, this); } return(ret); }
public ITextRangeProvider GetCaretRange(out bool isActive) { EditView view = this.fooTextBox.View; Document doc = this.fooTextBox.Document; isActive = true; int index = view.GetIndexFromLayoutLine(doc.CaretPostion); int length = 1; if (index == this.fooTextBox.Document.Length) { length = 0; } return(new FooTextBoxRangeProvider(this.fooTextBox, index, length, this)); }
public ITextRangeProvider RangeFromPoint(System.Windows.Point screenLocation) #endif { Point pt = Util.GetClientPoint(screenLocation, fooTextBox); EditView view = this.fooTextBox.View; TextPoint tp = view.GetTextPointFromPostion(pt); if (tp == TextPoint.Null) { tp = new TextPoint(view.Src.Row, 0); } int index = view.GetIndexFromLayoutLine(tp); int length = 1; if (index == this.fooTextBox.Document.Length) { length = 0; } return(new FooTextBoxRangeProvider(this.fooTextBox, index, length, this)); }