TextView Class
Represents a base class that can be used to implement an ITextView.
public abstract class TextView : UIElement, IInputElement, IUIElement, ILogicalTreeNode, IDisposable, ITextView, INotifyPropertyChanged
- Inheritance:
- Object MarshalByRefObject DisposableObject LogicalTreeNodeBase UIElement Object
- Derived:
- EditorView
- Implements:
- IInputElement IUIElement ILogicalTreeNode IDisposable ITextView
Constructors
TextView(SyntaxEditor, ITextSnapshot)
Initializes a new instance of the TextView
class.
protected TextView(SyntaxEditor syntaxEditor, ITextSnapshot initialSnapshot)
Parameter | Type | Description |
---|---|---|
syntaxEditor | SyntaxEditor | The SyntaxEditor that owns the object. |
initialSnapshot | ITextSnapshot | The initial ITextSnapshot. |
Properties
ArePartiallyVisibleViewLinesAllowed
Gets whether partially-visible view lines are allowed, other than the first visible view line.
protected virtual bool ArePartiallyVisibleViewLinesAllowed { get; }
Property Value
- Boolean:
true
if partially-visible view lines are allowed; otherwise,false
.
ClassificationTagAggregator
Gets the IClassificationTag aggregator for the view.
protected abstract ITagAggregator<IClassificationTag> ClassificationTagAggregator { get; }
Property Value
- ITagAggregator<IClassificationTag>:
The IClassificationTag aggregator for the view.
CollapsedRegionManager
Gets an ICollapsedRegionManager that provides information about collapsed regions in the view.
public abstract ICollapsedRegionManager CollapsedRegionManager { get; }
Property Value
- ICollapsedRegionManager:
An ICollapsedRegionManager that provides information about collapsed regions in the view.
CurrentSnapshot
Gets the ITextSnapshot that currently is used to populate the view.
public ITextSnapshot CurrentSnapshot { get; }
Property Value
- ITextSnapshot:
The ITextSnapshot that currently is used to populate the view.
DefaultBackgroundColor
Gets the default background color.
DefaultCharacterWidth
Gets the width of an average default font character in the view.
public int DefaultCharacterWidth { get; }
Property Value
- Int32:
The width of an average default font character in the view.
DefaultFontFamilyName
Gets the default font family name.
DefaultFontSize
Gets the default font size.
DefaultFontStyle
Gets or sets the default font style.
DefaultFontWeight
Gets or sets the default font weight.
DefaultForegroundColor
Gets the default foreground color.
DefaultLineHeight
Gets the default line height.
DefaultSpaceWidth
Gets the width of a default font space character in the view.
public int DefaultSpaceWidth { get; }
Property Value
- Int32:
The width of a default font space character in the view.
HighlightingStyleRegistry
Gets the IHighlightingStyleRegistry used by this view.
public virtual IHighlightingStyleRegistry HighlightingStyleRegistry { get; }
Property Value
- IHighlightingStyleRegistry:
The IHighlightingStyleRegistry used by this view.
IntraLineSpacerTagAggregator
Gets the IIntraLineSpacerTag aggregator for the view.
protected abstract ITagAggregator<IIntraLineSpacerTag> IntraLineSpacerTagAggregator { get; }
Property Value
- ITagAggregator<IIntraLineSpacerTag>:
The IIntraLineSpacerTag aggregator for the view.
IntraTextSpacerTagAggregator
Gets the IIntraTextSpacerTag aggregator for the view.
protected abstract ITagAggregator<IIntraTextSpacerTag> IntraTextSpacerTagAggregator { get; }
Property Value
- ITagAggregator<IIntraTextSpacerTag>:
The IIntraTextSpacerTag aggregator for the view.
IsDefaultBackgroundColorLight
Gets whether the background color of the editor is light.
public bool IsDefaultBackgroundColorLight { get; }
Property Value
- Boolean:
true
if the background color of the editor is light; otherwise,false
.
IsWhitespaceVisible
Gets whether whitespace (spaces and tabs) is visible.
public abstract bool IsWhitespaceVisible { get; }
Property Value
- Boolean:
true
if whitespace (spaces and tabs) is visible; otherwise,false
.
Properties
Gets the dictionary containing custom properties for this object.
public PropertyDictionary Properties { get; }
Property Value
- PropertyDictionary:
The dictionary containing custom properties for this object.
RenderableTextRange
Gets the text range that can be rendered.
protected virtual TextRange RenderableTextRange { get; }
Property Value
- TextRange:
The text range that can be rendered.
Remarks
A value of TextRange.Deleted
means no text range limitation.
ScrollableContentHostBounds
Gets a Rectangle indicating the bounds of scrollable content host, relative to view coordinates.
protected abstract Rectangle ScrollableContentHostBounds { get; }
Property Value
ScrollState
Gets the view's current scroll state.
public TextViewScrollState ScrollState { get; }
Property Value
- TextViewScrollState:
The view's current scroll state.
SquiggleTagAggregator
Gets the ISquiggleTag aggregator for the view.
protected virtual ITagAggregator<ISquiggleTag> SquiggleTagAggregator { get; }
Property Value
- ITagAggregator<ISquiggleTag>:
The ISquiggleTag aggregator for the view.
SyntaxEditor
Gets the SyntaxEditor that contains the view.
public SyntaxEditor SyntaxEditor { get; }
Property Value
- SyntaxEditor:
The SyntaxEditor that contains the view.
TextAreaPadding
Gets the padding thickness around the text area content.
public virtual Padding TextAreaPadding { get; }
Property Value
- Padding:
The padding thickness around the text area content.
TextAreaSize
Gets the size of the text area in text area coordinates.
public abstract Size TextAreaSize { get; }
Property Value
- Size:
The size of the text area in text area coordinates.
TextAreaViewportBounds
Gets a Rectangle indicating the bounds of the visible portion of the text area, relative to view coordinates.
public abstract Rectangle TextAreaViewportBounds { get; }
Property Value
UniqueId
Gets the Guid that uniquely identifies the view.
UnusedRegionTagAggregator
Gets the IUnusedRegionTag aggregator for the view.
protected abstract ITagAggregator<IUnusedRegionTag> UnusedRegionTagAggregator { get; }
Property Value
- ITagAggregator<IUnusedRegionTag>:
The IUnusedRegionTag aggregator for the view.
UseSyntaxEditorDisplayItemProperties
Gets whether to use SyntaxEditor display item properties.
protected abstract bool UseSyntaxEditorDisplayItemProperties { get; }
Property Value
- Boolean:
true
if SyntaxEditor display item properties should be used; otherwise,false
.
VisibleViewLines
Gets the collection of ITextViewLine objects that are currently visible within the view.
public ITextViewLineCollection VisibleViewLines { get; }
Property Value
- ITextViewLineCollection:
The collection of ITextViewLine objects that are currently visible within the view.
Remarks
The ITextViewLine items in this collection are sorted in their display order, top to bottom.
VisualElement
Gets the IUIElement that represents the view.
public IUIElement VisualElement { get; }
Property Value
- IUIElement:
The IUIElement that represents the view.
WordWrapMode
Gets a WordWrapMode value indicating the type of word wrapping that is performed.
protected abstract WordWrapMode WordWrapMode { get; }
Property Value
- WordWrapMode:
A WordWrapMode value indicating the type of word wrapping that is performed.
ZoomLevel
Gets a percentage value indicating the zoom level.
public int ZoomLevel { get; }
Property Value
- Int32:
A percentage value indicating the zoom level. The default value is
1.0
, meaning100%
.
Methods
Close()
Closes the view.
protected abstract void Close()
CreateTagAggregator<T>()
Creates a new ITagAggregator<T> that collects the tag results from all ITagger<T> instances associated with this view.
public abstract ITagAggregator<T> CreateTagAggregator<T>()
where T : ITag
- Type Parameters:
-
T
-The type of ITag associated with this aggregator.
Returns
- ITagAggregator<T>:
The ITagAggregator<T> that was created.
GetAdornmentLayer(AdornmentLayerDefinition)
Returns an IAdornmentLayer for the view with the specified definition.
public abstract IAdornmentLayer GetAdornmentLayer(AdornmentLayerDefinition layerDefinition)
Parameter | Type | Description |
---|---|---|
layerDefinition | AdornmentLayerDefinition | The layer definition. |
Returns
- IAdornmentLayer:
An IAdornmentLayer for the view with the specified string-based key.
Remarks
If no IAdornmentLayer already exists with the specified name, one is created.
GetViewLine(TextPosition)
Returns an ITextViewLine that contains the specified TextPosition.
public ITextViewLine GetViewLine(TextPosition position)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The TextPosition for which to retrieve an ITextViewLine. |
Returns
- ITextViewLine:
An ITextViewLine that contains the specified TextPosition.
GetViewLine(ITextViewLine, Int32)
Returns the ITextViewLine that is relative to the specified ITextViewLine.
public ITextViewLine GetViewLine(ITextViewLine viewLine, int lineDelta)
Parameter | Type | Description |
---|---|---|
viewLine | ITextViewLine | The source ITextViewLine. |
lineDelta | Int32 | The number of lines to traverse (can be negative). |
Returns
- ITextViewLine:
The ITextViewLine that is relative to the specified ITextViewLine.
GetViewLine(ITextViewLine, Int32, Boolean)
Returns the ITextViewLine that is relative to the specified ITextViewLine.
public ITextViewLine GetViewLine(ITextViewLine viewLine, int lineDelta, bool forceVirtualSpace)
Parameter | Type | Description |
---|---|---|
viewLine | ITextViewLine | The source ITextViewLine. |
lineDelta | Int32 | The number of lines to traverse (can be negative). |
forceVirtualSpace | Boolean | Whether to force virtual line space to be used as needed (for block selections). |
Returns
- ITextViewLine:
The ITextViewLine that is relative to the specified ITextViewLine.
GetViewLine(Int32)
Returns an ITextViewLine that contains the specified offset.
public ITextViewLine GetViewLine(int offset)
Parameter | Type | Description |
---|---|---|
offset | Int32 | The offset for which to retrieve an ITextViewLine. |
Returns
- ITextViewLine:
An ITextViewLine that contains the specified offset.
GetViewLine(Int32, Boolean)
Returns an ITextViewLine that contains the specified offset.
public ITextViewLine GetViewLine(int offset, bool hasFarAffinity)
Parameter | Type | Description |
---|---|---|
offset | Int32 | The offset for which to retrieve an ITextViewLine. |
hasFarAffinity | Boolean | Whether the offset has affinity for the far side, which is used when the offset is where a view line is wrapped to a second view line. |
Returns
- ITextViewLine:
An ITextViewLine that contains the specified offset.
InvalidateRender()
Invalidates and repaints the view's canvas.
public void InvalidateRender()
NotifyPropertyChanged(String)
Notifies that a property has changed.
protected void NotifyPropertyChanged(string propertyName)
Parameter | Type | Description |
---|---|---|
propertyName | String | The name of the property that was changed. |
OffsetToPosition(Int32)
Returns the TextPosition that represents the specified offset within the view lines.
public TextPosition OffsetToPosition(int offset)
Parameter | Type | Description |
---|---|---|
offset | Int32 | The offset of a character within the document. |
Returns
- TextPosition:
The TextPosition that represents the specified offset within the view lines.
OnClosed(EventArgs)
Occurs when the view's margins need to be destroyed.
protected virtual void OnClosed(EventArgs e)
Parameter | Type | Description |
---|---|---|
e | EventArgs | The |
OnMarginsDestroyed(EventArgs)
Occurs when the view's margins need to be destroyed.
protected virtual void OnMarginsDestroyed(EventArgs e)
Parameter | Type | Description |
---|---|---|
e | EventArgs | The |
OnPropertyChanged(PropertyChangedEventArgs)
Raises the PropertyChanged event.
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | PropertyChangedEventArgs | The PropertyChangedEventArgs that contains the event data. |
OnRendered()
Occurs when rendering of the view is complete.
protected virtual void OnRendered()
OnScrollBarUpdateRequested(EventArgs)
Occurs when a scrollbar update is requested.
protected virtual void OnScrollBarUpdateRequested(EventArgs e)
Parameter | Type | Description |
---|---|---|
e | EventArgs | The |
OnScrollStatePropertyChanged(TextViewScrollState, TextViewScrollState)
Occurs when the ScrollState property is changed.
protected virtual void OnScrollStatePropertyChanged(TextViewScrollState oldValue, TextViewScrollState newValue)
Parameter | Type | Description |
---|---|---|
oldValue | TextViewScrollState | The old value. |
newValue | TextViewScrollState | The new value. |
OnTextAreaLayout(TextViewTextAreaLayoutEventArgs)
Occurs when the layout of the lines in the text area has been updated.
protected virtual void OnTextAreaLayout(TextViewTextAreaLayoutEventArgs e)
Parameter | Type | Description |
---|---|---|
e | TextViewTextAreaLayoutEventArgs | The |
PositionToOffset(TextPosition)
Returns the offset for the specified TextPosition within the view lines.
public int PositionToOffset(TextPosition position)
Parameter | Type | Description |
---|---|---|
position | TextPosition | The TextPosition of a character within the view lines. |
Returns
- Int32:
The offset for the specified TextPosition within the view lines.
TransformFromTextArea(Point)
Transforms the specified Point in text area-relative coordinates to view-relative coordinates.
public abstract Point TransformFromTextArea(Point location)
Parameter | Type | Description |
---|---|---|
location | Point | The Point to transform. |
Returns
TransformFromTextArea(Rectangle)
Transforms the specified Rectangle in text area-relative coordinates to view-relative coordinates.
public abstract Rectangle TransformFromTextArea(Rectangle bounds)
Parameter | Type | Description |
---|---|---|
bounds | Rectangle | The Rectangle to transform. |
Returns
TransformToTextArea(Point)
Transforms the specified Point in view-relative coordinates to text area-relative coordinates.
public abstract Point TransformToTextArea(Point location)
Parameter | Type | Description |
---|---|---|
location | Point | The Point to transform. |
Returns
TransformToTextArea(Rectangle)
Transforms the specified Rectangle in view-relative coordinates to text area-relative coordinates.
public abstract Rectangle TransformToTextArea(Rectangle bounds)
Parameter | Type | Description |
---|---|---|
bounds | Rectangle | The Rectangle to transform. |
Returns
Events
Closed
Occurs when the view is closed.
MarginsDestroyed
Occurs when the view's margins need to be destroyed.
PropertyChanged
Occurs when a property has been changed.
ScrollBarUpdateRequested
Occurs when a scrollbar update is requested.
TextAreaLayout
Occurs when the layout of the lines in the text area has been updated.
public event EventHandler<TextViewTextAreaLayoutEventArgs> TextAreaLayout
Event Type
Inherited Members
- UIElement.IInputElement.RaiseClickEvent(MouseEventArgs)
- UIElement.IInputElement.RaiseDoubleClickEvent(MouseEventArgs)
- UIElement.IInputElement.RaiseMouseDownEvent(MouseEventArgs)
- UIElement.IInputElement.RaiseMouseEnterEvent(MouseEventArgs)
- UIElement.IInputElement.RaiseMouseHoverEvent(MouseEventArgs)
- UIElement.IInputElement.RaiseMouseLeaveEvent(MouseEventArgs)
- UIElement.IInputElement.RaiseMouseMoveEvent(MouseEventArgs)
- UIElement.IInputElement.RaiseMouseUpEvent(MouseEventArgs)
- UIElement.IInputElement.RaiseMouseWheelEvent(MouseEventArgs)
- UIElement.IUIElement.GetDrawState()
- UIElement.IUIElement.HitTest(PointHitTestParameters)
- UIElement.IUIElement.HitTest(PointHitTestParameters, Func<IUIElement, PointHitTestParameters, Boolean>)
- UIElement.IUIElement.HitTestRecursive(PointHitTestParameters)
- UIElement.IUIElement.HitTestRecursive(PointHitTestParameters, Func<IUIElement, PointHitTestParameters, Boolean>)
- UIElement.IUIElement.NotifyChildDesiredSizeChanged()
- UIElement.IUIElement.NotifyMouseLeaveEvent()
- UIElement.AddPendingGraphicsInversion(Rectangle)
- UIElement.AddPendingScrollOperation(Rectangle, Orientation, Int32)
- UIElement.AddPendingScrollOperation(Rectangle, Int32, Int32)
- UIElement.Arrange(Rectangle)
- UIElement.ArrangeOverride(Size)
- UIElement.CaptureMouse()
- UIElement.ContainsLocation(Point)
- UIElement.CreateGraphics()
- UIElement.Dispose(Boolean)
- UIElement.GetCursor(Point)
- UIElement.Invalidate()
- UIElement.Invalidate(Rectangle)
- UIElement.Invalidate(InvalidationLevels, InvalidationTypes)
- UIElement.InvalidateArrange()
- UIElement.InvalidateMeasure()
- UIElement.Measure(Graphics, Size)
- UIElement.MeasureOverride(Graphics, Size)
- UIElement.OnClick(MouseEventArgs)
- UIElement.OnDoubleClick(MouseEventArgs)
- UIElement.OnMouseDown(MouseEventArgs)
- UIElement.OnMouseEnter(MouseEventArgs)
- UIElement.OnMouseHover(MouseEventArgs)
- UIElement.OnMouseLeave(MouseEventArgs)
- UIElement.OnMouseMove(MouseEventArgs)
- UIElement.OnMouseUp(MouseEventArgs)
- UIElement.OnMouseWheel(MouseEventArgs)
- UIElement.OnRender(PaintEventArgs)
- UIElement.OnRenderChildElements(PaintEventArgs)
- UIElement.OnResize(EventArgs)
- UIElement.PostArrangeOverride()
- UIElement.ReleaseMouseCapture()
- UIElement.Render(PaintEventArgs)
- UIElement.TransformToAncestor(IUIElement)
- UIElement.TransformToDescendant(IUIElement)
- UIElement.UpdateLayout()
- UIElement.IInputElement.IsMouseDirectlyOver
- UIElement.IUIElement.Visibility
- UIElement.ActualHeight
- UIElement.ActualWidth
- UIElement.Bounds
- UIElement.CaptureMouseWhenPressed
- UIElement.ClipBounds
- UIElement.DesiredSize
- UIElement.InvalidateOnMouseEvents
- UIElement.IsArrangeValid
- UIElement.IsMeasureValid
- UIElement.IsMouseCaptured
- UIElement.IsRightToLeft
- UIElement.Size
- UIElement.VisualOffset
- UIElement.Click
- UIElement.DoubleClick
- UIElement.MouseDown
- UIElement.MouseEnter
- UIElement.MouseHover
- UIElement.MouseLeave
- UIElement.MouseMove
- UIElement.MouseUp
- UIElement.MouseWheel
- UIElement.Resize
- LogicalTreeNodeBase.ILogicalTreeNode.FindAncestor(Type)
- LogicalTreeNodeBase.ILogicalTreeNode.GetCommonAncestor(ILogicalTreeNode)
- LogicalTreeNodeBase.ILogicalTreeNode.IsAncestorOf(ILogicalTreeNode)
- LogicalTreeNodeBase.ILogicalTreeNode.IsDescendantOf(ILogicalTreeNode)
- LogicalTreeNodeBase.CreateChildren()
- LogicalTreeNodeBase.OnParentChanged()
- LogicalTreeNodeBase.ILogicalTreeNode.Children
- LogicalTreeNodeBase.ILogicalTreeNode.Parent
- DisposableObject.Dispose()
- DisposableObject.VerifyNotDisposed()
- DisposableObject.IsDisposed
- DisposableObject.Disposed
- MarshalByRefObject.MemberwiseClone(Boolean)
- MarshalByRefObject.GetLifetimeService()
- MarshalByRefObject.InitializeLifetimeService()
- MarshalByRefObject.CreateObjRef(Type)
- Object.ToString()
- Object.Equals(Object)
- Object.Equals(Object, Object)
- Object.ReferenceEquals(Object, Object)
- Object.GetHashCode()
- Object.GetType()
- Object.MemberwiseClone()