C# Class FSO.Client.UI.Controls.UITextEdit

Big complex text edit control, used in many places
Inheritance: FSO.Client.UI.Framework.UIElement, IFocusableUI, ITextControl
Show file Open project: RHY3756547/FreeSO Class Usage Examples

Public Properties

Property Type Description
TextMargin Microsoft.Xna.Framework.Rectangle

Private Properties

Property Type Description
Control_GetIndexForLineAdjusment int
Control_GetSelectableIndex int
Control_GetSelectionStart int
Control_MoveCursor void
Control_MoveSelection void
Control_ScrollTo void
Control_SetSelectionEnd void
Control_SetSelectionStart void
Control_ValidateText void

Public Methods

Method Description
AttachSlider ( UISlider slider ) : void
ComputeDrawingCommands ( ) : void

When the text / scroll / highlight changes we need to re-compute how we are going to draw this text field

CreateTextBox ( ) : UITextEdit
Draw ( FSO.Client.UI.Framework.UISpriteBatch batch ) : void

Render

GetBounds ( ) : Rectangle
GetLineForIndex ( int index ) : UITextEditLine
HitTestText ( Vector2 point ) : int

Returns which character index would be hit by the given mouse coordinates. The coords should be in local coords.

InitDefaultSlider ( ) : void
OnFocusChanged ( FocusEvent newFocus ) : void
OnMouseEvent ( UIMouseEventType evt, UpdateState state ) : void
PositionChildSlider ( ) : void
SetBackgroundTexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, int marginLeft, int marginRight, int marginTop, int marginBottom ) : void
SetSize ( float width, float height ) : void
UITextEdit ( ) : System
Update ( UpdateState state ) : void
m_Slider_OnChange ( UIElement element ) : void

Protected Methods

Method Description
CalculateMatrix ( ) : void
CalculateSegments ( UITextEditLine line ) : List

Creates a list of segments to split the line into in order to draw selection boxes

Private Methods

Method Description
Control_GetIndexForLineAdjusment ( int startIndex, int deltaY ) : int

Calculate & return the index that should be selected if the cursor is moved up or down by the value deltaY

Control_GetSelectableIndex ( int index, int delta ) : int

Takes in a string index and adjusts it if that index lies between non-breakable chars

Control_GetSelectionStart ( ) : int

Gets the absolute selection start position

Control_MoveCursor ( int deltaX, int deltaY ) : void

Handles using arrow keys to move the selection start

Control_MoveSelection ( int deltaX, int deltaY ) : void

Handles using arrow keys to move the selection end

Control_ScrollTo ( int index ) : void

Sets the scroll position such that the given index is visible on screen

Control_SetSelectionEnd ( int val ) : void
Control_SetSelectionStart ( int val ) : void

Sets the selection start index

Control_ValidateText ( ) : void

Makes sure that the text does not overflow max lines or max chars

Method Details

AttachSlider() public method

public AttachSlider ( UISlider slider ) : void
slider UISlider
return void

CalculateMatrix() protected method

protected CalculateMatrix ( ) : void
return void

CalculateSegments() protected method

Creates a list of segments to split the line into in order to draw selection boxes
protected CalculateSegments ( UITextEditLine line ) : List
line UITextEditLine
return List

ComputeDrawingCommands() public method

When the text / scroll / highlight changes we need to re-compute how we are going to draw this text field
public ComputeDrawingCommands ( ) : void
return void

CreateTextBox() public static method

public static CreateTextBox ( ) : UITextEdit
return UITextEdit

Draw() public method

Render
public Draw ( FSO.Client.UI.Framework.UISpriteBatch batch ) : void
batch FSO.Client.UI.Framework.UISpriteBatch
return void

GetBounds() public method

public GetBounds ( ) : Rectangle
return Microsoft.Xna.Framework.Rectangle

GetLineForIndex() public method

public GetLineForIndex ( int index ) : UITextEditLine
index int
return UITextEditLine

HitTestText() public method

Returns which character index would be hit by the given mouse coordinates. The coords should be in local coords.
public HitTestText ( Vector2 point ) : int
point Vector2
return int

InitDefaultSlider() public method

public InitDefaultSlider ( ) : void
return void

OnFocusChanged() public method

public OnFocusChanged ( FocusEvent newFocus ) : void
newFocus FocusEvent
return void

OnMouseEvent() public method

public OnMouseEvent ( UIMouseEventType evt, UpdateState state ) : void
evt UIMouseEventType
state FSO.Common.Rendering.Framework.Model.UpdateState
return void

PositionChildSlider() public method

public PositionChildSlider ( ) : void
return void

SetBackgroundTexture() public method

public SetBackgroundTexture ( Microsoft.Xna.Framework.Graphics.Texture2D texture, int marginLeft, int marginRight, int marginTop, int marginBottom ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D
marginLeft int
marginRight int
marginTop int
marginBottom int
return void

SetSize() public method

public SetSize ( float width, float height ) : void
width float
height float
return void

UITextEdit() public method

public UITextEdit ( ) : System
return System

Update() public method

public Update ( UpdateState state ) : void
state FSO.Common.Rendering.Framework.Model.UpdateState
return void

m_Slider_OnChange() public method

public m_Slider_OnChange ( UIElement element ) : void
element FSO.Client.UI.Framework.UIElement
return void

Property Details

TextMargin public property

public Rectangle,Microsoft.Xna.Framework TextMargin
return Microsoft.Xna.Framework.Rectangle