Barotrauma Client Doc
Barotrauma.GUITextBox Class Reference
Inheritance diagram for Barotrauma.GUITextBox:
Barotrauma.GUIComponent EventInput.IKeyboardSubscriber

Public Member Functions

delegate bool OnEnterHandler (GUITextBox textBox, string text)
 
delegate bool OnTextChangedHandler (GUITextBox textBox, string text)
 
 GUITextBox (RectTransform rectT, string text="", Color? textColor=null, GUIFont font=null, Alignment textAlignment=Alignment.Left, bool wrap=false, string style="", Color? color=null, bool createClearButton=false, bool createPenIcon=true)
 
void Select (int forcedCaretIndex=-1, bool ignoreSelectSound=false)
 
void Deselect ()
 
override void Flash (Color? color=null, float flashDuration=1.5f, bool useRectangleFlash=false, bool useCircularFlash=false, Vector2? flashRectOffset=null)
 
void ReceiveTextInput (char inputChar)
 
void ReceiveTextInput (string input)
 
void ReceiveCommandInput (char command)
 
void ReceiveEditingInput (string text, int start, int length)
 
void ReceiveSpecialInput (Keys key)
 
void SelectAll ()
 
void DrawIMEPreview (SpriteBatch spriteBatch)
 
- Public Member Functions inherited from Barotrauma.GUIComponent
delegate bool SecondaryButtonDownHandler (GUIComponent component, object userData)
 
GetChild< T > ()
 
GetAnyChild< T > ()
 
IEnumerable< T > GetAllChildren< T > ()
 
IEnumerable< GUIComponentGetAllChildren ()
 Returns all child elements in the hierarchy. More...
 
GUIComponent GetChild (int index)
 
int GetChildIndex (GUIComponent child)
 
GUIComponent GetChildByUserData (object obj)
 
bool IsParentOf (GUIComponent component, bool recursive=true)
 
bool IsChildOf (GUIComponent component, bool recursive=true)
 
virtual void RemoveChild (GUIComponent child)
 
GUIComponent FindChild (Func< GUIComponent, bool > predicate, bool recursive=false)
 
GUIComponent FindChild (object userData, bool recursive=false)
 
IEnumerable< GUIComponentFindChildren (object userData)
 
IEnumerable< GUIComponentFindChildren (Func< GUIComponent, bool > predicate)
 
virtual void ClearChildren ()
 
void SetAsFirstChild ()
 
void SetAsLastChild ()
 
virtual void AddToGUIUpdateList (bool ignoreChildren=false, int order=0)
 
void RemoveFromGUIUpdateList (bool alsoChildren=true)
 
void UpdateAuto (float deltaTime)
 Only GUI should call this method. Auto updating follows the order of GUI update list. This order can be tweaked by changing the UpdateOrder property. More...
 
void UpdateManually (float deltaTime, bool alsoChildren=false, bool recursive=true)
 By default, all the gui elements are updated automatically in the same order they appear on the update list. More...
 
virtual void ForceLayoutRecalculation ()
 
void ForceUpdate ()
 
void UpdateChildren (float deltaTime, bool recursive)
 Updates all the children manually. More...
 
void DrawAuto (SpriteBatch spriteBatch)
 Only GUI should call this method. Auto drawing follows the order of GUI update list. This order can be tweaked by changing the UpdateOrder property. More...
 
virtual void DrawManually (SpriteBatch spriteBatch, bool alsoChildren=false, bool recursive=true)
 By default, all the gui elements are drawn automatically in the same order they appear on the update list. More...
 
virtual void DrawChildren (SpriteBatch spriteBatch, bool recursive)
 Draws all the children manually. More...
 
void DrawToolTip (SpriteBatch spriteBatch)
 Creates and draws a tooltip. More...
 
void ImmediateFlash (Color? color=null)
 
void FadeOut (float duration, bool removeAfter, float wait=0.0f, Action onRemove=null)
 
void FadeIn (float wait, float duration)
 
void SlideIn (float wait, float duration, int amount, SlideDirection direction)
 
void SlideOut (float duration, int amount, SlideDirection direction)
 
void Pulsate (Vector2 startScale, Vector2 endScale, float duration)
 
virtual void ApplyStyle (GUIComponentStyle style)
 
void ApplySizeRestrictions (GUIComponentStyle style)
 

Public Attributes

Func< string, string > textFilterFunction
 
OnEnterHandler OnEnterPressed
 
bool DeselectAfterMessage = true
 
- Public Attributes inherited from Barotrauma.GUIComponent
CursorState HoverCursor = CursorState.Default
 
bool AlwaysOverrideCursor = false
 
SecondaryButtonDownHandler OnSecondaryClicked
 
Action< GUIComponentOnAddedToGUIUpdateList
 
bool CanBeFocused
 
Dictionary< ComponentState, List< UISprite > > sprites
 
SpriteEffects SpriteEffects
 
object UserData
 
bool ExternalHighlight = false
 

Protected Member Functions

override void Update (float deltaTime)
 
- Protected Member Functions inherited from Barotrauma.GUIComponent
Rectangle ClampRect (Rectangle r)
 
 GUIComponent (string style, RectTransform rectT)
 This is the new constructor. More...
 
 GUIComponent (string style)
 
virtual Color GetColor (ComponentState state)
 
Color GetBlendedColor (Color targetColor, ref Color blendedColor)
 
virtual void Draw (SpriteBatch spriteBatch)
 
virtual void SetAlpha (float a)
 

Protected Attributes

Vector2 caretPos
 
- Protected Attributes inherited from Barotrauma.GUIComponent
Alignment alignment
 
Identifier[] styleHierarchy
 
Color color
 
Color hoverColor
 
Color selectedColor
 
Color disabledColor
 
Color pressedColor
 
Color flashColor
 
float flashDuration = 1.5f
 
float flashTimer
 
bool enabled
 
ComponentState _state
 
ComponentState _previousState
 
bool isSelected
 
Color _currentColor
 

Properties

OnTextChangedHandler OnTextChangedDelegate [set]
 
bool CaretEnabled [get, set]
 
ColorCaretColor [get, set]
 
int CaretIndex [get, set]
 
Vector2 CaretScreenPos [get]
 
GUIFrame Frame [get]
 
GUITextBlock.TextGetterHandler TextGetter [get, set]
 
new bool Selected [get, set]
 
bool Wrap [get, set]
 
GUITextBlock TextBlock [get]
 
bool ClampText [get, set]
 
int? MaxTextLength [get, set]
 
bool OverflowClip [get, set]
 
override bool Enabled [get, set]
 
bool Censor [get, set]
 
override RichString ToolTip [get, set]
 
override GUIFont??? Font [get, set]
 
override Color Color [get, set]
 
Color TextColor [get, set]
 
override Color HoverColor [get, set]
 
Vector4 Padding [get, set]
 
Color SelectionColor = Color.White * 0.25f [get, set]
 
string? Text [get, set]
 
string WrappedText [get]
 
bool Readonly [get, set]
 
override bool PlaySoundOnSelect = true [get, set]
 
bool IsIMEActive [get]
 
- Properties inherited from Barotrauma.GUIComponent
GUIComponent Parent [get]
 
IEnumerable< GUIComponentChildren [get]
 
bool AutoUpdate = true [get, set]
 
bool AutoDraw = true [get, set]
 
int UpdateOrder [get, set]
 
bool Bounce [get, set]
 
bool GlowOnSelect [get, set]
 
Vector2 UVOffset [get, set]
 
virtual float FlashTimer [get]
 
bool IgnoreLayoutGroups [get, set]
 
virtual GUIFont Font [get, set]
 
virtual RichString ToolTip [get, set]
 
GUIComponentStyle Style [get]
 
bool Visible [get, set]
 
virtual bool Enabled [get, set]
 
Vector2 Center [get]
 
virtual Rectangle Rect [get]
 
bool ClampMouseRectToParent = false [get, set]
 
virtual Rectangle? MouseRect [get]
 
virtual Color OutlineColor [get, set]
 
virtual bool Selected [get, set]
 
virtual ComponentState State [get, set]
 
int CountChildren [get]
 
Color DefaultColor [get, set]
 Currently only used for the fade effect in GUIListBox, should be set to the same value as Color but only assigned once More...
 
virtual Color Color [get, set]
 
virtual Color HoverColor [get, set]
 
virtual Color SelectedColor [get, set]
 
virtual Color DisabledColor [get, set]
 
virtual Color PressedColor [get, set]
 
TransitionMode ColorTransition [get]
 
SpriteFallBackState FallBackState [get]
 
float SpriteCrossFadeTime [get]
 
float ColorCrossFadeTime [get]
 
virtual bool PlaySoundOnSelect = false [get, set]
 
RectTransform RectTransform [get]
 
- Properties inherited from EventInput.IKeyboardSubscriber
bool Selected [get, set]
 

Events

TextBoxEvent OnSelected
 
TextBoxEvent OnDeselected
 
TextBoxEvent OnKeyHit
 
OnTextChangedHandler OnTextChanged
 Don't set the Text property on delegates that register to this event, because modifying the Text will launch this event -> stack overflow. If the event launches, the text should already be up to date! More...
 

Additional Inherited Members

- Public Types inherited from Barotrauma.GUIComponent
enum class  ComponentState {
  None , Hover , Pressed , Selected ,
  HoverSelected
}
 
- Static Public Member Functions inherited from Barotrauma.GUIComponent
static void DrawToolTip (SpriteBatch spriteBatch, RichString toolTip, Vector2 pos)
 
static void DrawToolTip (SpriteBatch spriteBatch, RichString toolTip, Rectangle targetElement, Anchor anchor=Anchor.BottomCenter, Pivot pivot=Pivot.TopLeft)
 
static GUIComponent FromXML (ContentXElement element, RectTransform parent)
 

Detailed Description

Definition at line 14 of file GUITextBox.cs.

Constructor & Destructor Documentation

◆ GUITextBox()

Barotrauma.GUITextBox.GUITextBox ( RectTransform  rectT,
string  text = "",
Color textColor = null,
GUIFont  font = null,
Alignment  textAlignment = Alignment.Left,
bool  wrap = false,
string  style = "",
Color color = null,
bool  createClearButton = false,
bool  createPenIcon = true 
)

Definition at line 271 of file GUITextBox.cs.

Member Function Documentation

◆ Deselect()

void Barotrauma.GUITextBox.Deselect ( )

Definition at line 394 of file GUITextBox.cs.

◆ DrawIMEPreview()

void Barotrauma.GUITextBox.DrawIMEPreview ( SpriteBatch  spriteBatch)

Definition at line 906 of file GUITextBox.cs.

◆ Flash()

override void Barotrauma.GUITextBox.Flash ( Color color = null,
float  flashDuration = 1.5f,
bool  useRectangleFlash = false,
bool  useCircularFlash = false,
Vector2?  flashRectOffset = null 
)
virtual

Reimplemented from Barotrauma.GUIComponent.

Definition at line 408 of file GUITextBox.cs.

◆ OnEnterHandler()

delegate bool Barotrauma.GUITextBox.OnEnterHandler ( GUITextBox  textBox,
string  text 
)

◆ OnTextChangedHandler()

delegate bool Barotrauma.GUITextBox.OnTextChangedHandler ( GUITextBox  textBox,
string  text 
)

◆ ReceiveCommandInput()

void Barotrauma.GUITextBox.ReceiveCommandInput ( char  command)

Implements EventInput.IKeyboardSubscriber.

Definition at line 621 of file GUITextBox.cs.

◆ ReceiveEditingInput()

void Barotrauma.GUITextBox.ReceiveEditingInput ( string  text,
int  start,
int  length 
)

Implements EventInput.IKeyboardSubscriber.

Definition at line 702 of file GUITextBox.cs.

◆ ReceiveSpecialInput()

void Barotrauma.GUITextBox.ReceiveSpecialInput ( Keys  key)

Implements EventInput.IKeyboardSubscriber.

Definition at line 713 of file GUITextBox.cs.

◆ ReceiveTextInput() [1/2]

void Barotrauma.GUITextBox.ReceiveTextInput ( char  inputChar)

Implements EventInput.IKeyboardSubscriber.

Definition at line 577 of file GUITextBox.cs.

◆ ReceiveTextInput() [2/2]

void Barotrauma.GUITextBox.ReceiveTextInput ( string  input)

Implements EventInput.IKeyboardSubscriber.

Definition at line 582 of file GUITextBox.cs.

◆ Select()

void Barotrauma.GUITextBox.Select ( int  forcedCaretIndex = -1,
bool  ignoreSelectSound = false 
)

Definition at line 374 of file GUITextBox.cs.

◆ SelectAll()

void Barotrauma.GUITextBox.SelectAll ( )

Definition at line 848 of file GUITextBox.cs.

◆ Update()

override void Barotrauma.GUITextBox.Update ( float  deltaTime)
protectedvirtual

Reimplemented from Barotrauma.GUIComponent.

Definition at line 413 of file GUITextBox.cs.

Member Data Documentation

◆ caretPos

Vector2 Barotrauma.GUITextBox.caretPos
protected

Definition at line 70 of file GUITextBox.cs.

◆ DeselectAfterMessage

bool Barotrauma.GUITextBox.DeselectAfterMessage = true

Definition at line 52 of file GUITextBox.cs.

◆ OnEnterPressed

OnEnterHandler Barotrauma.GUITextBox.OnEnterPressed

Definition at line 29 of file GUITextBox.cs.

◆ textFilterFunction

Func<string, string> Barotrauma.GUITextBox.textFilterFunction

Definition at line 26 of file GUITextBox.cs.

Property Documentation

◆ CaretColor

Color? Barotrauma.GUITextBox.CaretColor
getset

Definition at line 51 of file GUITextBox.cs.

◆ CaretEnabled

bool Barotrauma.GUITextBox.CaretEnabled
getset

Definition at line 50 of file GUITextBox.cs.

◆ CaretIndex

int Barotrauma.GUITextBox.CaretIndex
getset

Definition at line 57 of file GUITextBox.cs.

◆ CaretScreenPos

Vector2 Barotrauma.GUITextBox.CaretScreenPos
get

Definition at line 71 of file GUITextBox.cs.

◆ Censor

bool Barotrauma.GUITextBox.Censor
getset

Definition at line 176 of file GUITextBox.cs.

◆ ClampText

bool Barotrauma.GUITextBox.ClampText
getset

Definition at line 136 of file GUITextBox.cs.

◆ Color

override Color Barotrauma.GUITextBox.Color
getset

Definition at line 206 of file GUITextBox.cs.

◆ Enabled

override bool Barotrauma.GUITextBox.Enabled
getset

Definition at line 162 of file GUITextBox.cs.

◆ Font

override GUIFont??? Barotrauma.GUITextBox.Font
getset

Definition at line 194 of file GUITextBox.cs.

◆ Frame

GUIFrame Barotrauma.GUITextBox.Frame
get

Definition at line 89 of file GUITextBox.cs.

◆ HoverColor

override Color Barotrauma.GUITextBox.HoverColor
getset

Definition at line 222 of file GUITextBox.cs.

◆ IsIMEActive

bool Barotrauma.GUITextBox.IsIMEActive
get

Definition at line 269 of file GUITextBox.cs.

◆ MaxTextLength

int? Barotrauma.GUITextBox.MaxTextLength
getset

Definition at line 142 of file GUITextBox.cs.

◆ OnTextChangedDelegate

OnTextChangedHandler Barotrauma.GUITextBox.OnTextChangedDelegate
set

Definition at line 39 of file GUITextBox.cs.

◆ OverflowClip

bool Barotrauma.GUITextBox.OverflowClip
getset

Definition at line 156 of file GUITextBox.cs.

◆ Padding

Vector4 Barotrauma.GUITextBox.Padding
getset

Definition at line 235 of file GUITextBox.cs.

◆ PlaySoundOnSelect

override bool Barotrauma.GUITextBox.PlaySoundOnSelect = true
getset

Definition at line 265 of file GUITextBox.cs.

◆ Readonly

bool Barotrauma.GUITextBox.Readonly
getset

Definition at line 263 of file GUITextBox.cs.

◆ Selected

new bool Barotrauma.GUITextBox.Selected
getset

Definition at line 101 of file GUITextBox.cs.

◆ SelectionColor

Color Barotrauma.GUITextBox.SelectionColor = Color.White * 0.25f
getset

Definition at line 242 of file GUITextBox.cs.

◆ Text

string? Barotrauma.GUITextBox.Text
getset

Definition at line 244 of file GUITextBox.cs.

◆ TextBlock

GUITextBlock Barotrauma.GUITextBox.TextBlock
get

Definition at line 129 of file GUITextBox.cs.

◆ TextColor

Color Barotrauma.GUITextBox.TextColor
getset

Definition at line 216 of file GUITextBox.cs.

◆ TextGetter

GUITextBlock.TextGetterHandler Barotrauma.GUITextBox.TextGetter
getset

Definition at line 94 of file GUITextBox.cs.

◆ ToolTip

override RichString Barotrauma.GUITextBox.ToolTip
getset

Definition at line 182 of file GUITextBox.cs.

◆ Wrap

bool Barotrauma.GUITextBox.Wrap
getset

Definition at line 120 of file GUITextBox.cs.

◆ WrappedText

string Barotrauma.GUITextBox.WrappedText
get

Definition at line 258 of file GUITextBox.cs.

Event Documentation

◆ OnDeselected

TextBoxEvent Barotrauma.GUITextBox.OnDeselected

Definition at line 17 of file GUITextBox.cs.

◆ OnKeyHit

TextBoxEvent Barotrauma.GUITextBox.OnKeyHit

Definition at line 31 of file GUITextBox.cs.

◆ OnSelected

TextBoxEvent Barotrauma.GUITextBox.OnSelected

Definition at line 16 of file GUITextBox.cs.

◆ OnTextChanged

OnTextChangedHandler Barotrauma.GUITextBox.OnTextChanged

Don't set the Text property on delegates that register to this event, because modifying the Text will launch this event -> stack overflow. If the event launches, the text should already be up to date!

Definition at line 38 of file GUITextBox.cs.