Barotrauma Client Doc
Barotrauma.GUITextBlock Class Reference
Inheritance diagram for Barotrauma.GUITextBlock:
Barotrauma.GUIComponent

Classes

struct  ClickableArea
 
class  StrikethroughSettings
 

Public Member Functions

delegate LocalizedString TextGetterHandler ()
 
 GUITextBlock (RectTransform rectT, RichString text, Color? textColor=null, GUIFont font=null, Alignment textAlignment=Alignment.Left, bool wrap=false, string style="", Color? color=null)
 This is the new constructor. If the rectT height is set 0, the height is calculated from the text. More...
 
void CalculateHeightFromText (int padding=0, bool removeExtraSpacing=false)
 
void SetRichText (LocalizedString richText)
 
override void ApplyStyle (GUIComponentStyle componentStyle)
 
void ClearCaretPositions ()
 
void SetTextPos ()
 
void OverrideTextColor (Color color)
 Overrides the color for all the states. More...
 
ImmutableArray< Vector2 > GetAllCaretPositions ()
 
int GetCaretIndexFromScreenPos (in Vector2 pos)
 
int GetCaretIndexFromLocalPos (in Vector2 pos)
 
- 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...
 
virtual void Flash (Color? color=null, float flashDuration=1.5f, bool useRectangleFlash=false, bool useCircularFlash=false, Vector2? flashRectInflate=null)
 
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)
 
void ApplySizeRestrictions (GUIComponentStyle style)
 

Static Public Member Functions

static void AutoScaleAndNormalize (params GUITextBlock[] textBlocks)
 Set the text scale of the GUITextBlocks so that they all use the same scale and can fit the text within the block. More...
 
static void AutoScaleAndNormalize (bool scaleHorizontal=true, bool scaleVertical=false, params GUITextBlock[] textBlocks)
 Set the text scale of the GUITextBlocks so that they all use the same scale and can fit the text within the block. More...
 
static void AutoScaleAndNormalize (IEnumerable< GUITextBlock > textBlocks, bool scaleHorizontal=true, bool scaleVertical=false, float? defaultScale=null)
 Set the text scale of the GUITextBlocks so that they all use the same scale and can fit the text within the block. More...
 
- 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)
 

Public Attributes

TextGetterHandler TextGetter
 
bool Wrap
 
bool RoundToNearestPixel = true
 
bool OverflowClip
 
StrikethroughSettings Strikethrough = null
 
bool OverrideRichTextDataAlpha = 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 SetAlpha (float a)
 
override void Update (float deltaTime)
 
override void Draw (SpriteBatch spriteBatch)
 
- 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)
 

Protected Attributes

RichString text
 
Alignment textAlignment
 
Vector2 textPos
 
Vector2 origin
 
Color textColor
 
- 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

bool OverflowClipActive [get]
 
Vector2 TextOffset [get, set]
 
Vector4 Padding [get, set]
 
override GUIFont Font [get, set]
 
RichString Text [get, set]
 
LocalizedString WrappedText [get]
 
float TextDepth [get, set]
 
Vector2 TextPos [get, set]
 
float TextScale [get, set]
 
bool AutoScaleHorizontal [get, set]
 When enabled, the text is automatically scaled down to fit the textblock horizontally. More...
 
bool AutoScaleVertical [get, set]
 When enabled, the text is automatically scaled down to fit the textblock vertically. More...
 
ForceUpperCase ForceUpperCase [get, set]
 
Vector2 Origin [get]
 
Vector2 TextSize [get]
 
Color TextColor [get, set]
 
Color DisabledTextColor [get, set]
 
Color?? HoverTextColor [get, set]
 
Color SelectedTextColor [get, set]
 
Alignment TextAlignment [get, set]
 
bool Censor [get, set]
 
string CensoredText [get]
 
ImmutableArray< RichTextData >? RichTextData [get]
 
bool HasColorHighlight [get]
 
List< ClickableAreaClickableAreas = new List<ClickableArea>() [get]
 
bool Shadow [get, set]
 
- 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]
 

Additional Inherited Members

- Public Types inherited from Barotrauma.GUIComponent
enum class  ComponentState {
  None , Hover , Pressed , Selected ,
  HoverSelected
}
 

Detailed Description

Definition at line 19 of file GUITextBlock.cs.

Constructor & Destructor Documentation

◆ GUITextBlock()

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

This is the new constructor. If the rectT height is set 0, the height is calculated from the text.

Definition at line 289 of file GUITextBlock.cs.

Member Function Documentation

◆ ApplyStyle()

override void Barotrauma.GUITextBlock.ApplyStyle ( GUIComponentStyle  componentStyle)
virtual

Reimplemented from Barotrauma.GUIComponent.

Definition at line 333 of file GUITextBlock.cs.

◆ AutoScaleAndNormalize() [1/3]

static void Barotrauma.GUITextBlock.AutoScaleAndNormalize ( bool  scaleHorizontal = true,
bool  scaleVertical = false,
params GUITextBlock[]  textBlocks 
)
static

Set the text scale of the GUITextBlocks so that they all use the same scale and can fit the text within the block.

Definition at line 644 of file GUITextBlock.cs.

◆ AutoScaleAndNormalize() [2/3]

static void Barotrauma.GUITextBlock.AutoScaleAndNormalize ( IEnumerable< GUITextBlock textBlocks,
bool  scaleHorizontal = true,
bool  scaleVertical = false,
float?  defaultScale = null 
)
static

Set the text scale of the GUITextBlocks so that they all use the same scale and can fit the text within the block.

Definition at line 652 of file GUITextBlock.cs.

◆ AutoScaleAndNormalize() [3/3]

static void Barotrauma.GUITextBlock.AutoScaleAndNormalize ( params GUITextBlock[]  textBlocks)
static

Set the text scale of the GUITextBlocks so that they all use the same scale and can fit the text within the block.

Definition at line 636 of file GUITextBlock.cs.

◆ CalculateHeightFromText()

void Barotrauma.GUITextBlock.CalculateHeightFromText ( int  padding = 0,
bool  removeExtraSpacing = false 
)

Definition at line 322 of file GUITextBlock.cs.

◆ ClearCaretPositions()

void Barotrauma.GUITextBlock.ClearCaretPositions ( )

Definition at line 350 of file GUITextBlock.cs.

◆ Draw()

override void Barotrauma.GUITextBlock.Draw ( SpriteBatch  spriteBatch)
protectedvirtual

Reimplemented from Barotrauma.GUIComponent.

Definition at line 546 of file GUITextBlock.cs.

◆ GetAllCaretPositions()

ImmutableArray<Vector2> Barotrauma.GUITextBlock.GetAllCaretPositions ( )

Definition at line 466 of file GUITextBlock.cs.

◆ GetCaretIndexFromLocalPos()

int Barotrauma.GUITextBlock.GetCaretIndexFromLocalPos ( in Vector2  pos)

Definition at line 496 of file GUITextBlock.cs.

◆ GetCaretIndexFromScreenPos()

int Barotrauma.GUITextBlock.GetCaretIndexFromScreenPos ( in Vector2  pos)

Definition at line 491 of file GUITextBlock.cs.

◆ OverrideTextColor()

void Barotrauma.GUITextBlock.OverrideTextColor ( Color  color)

Overrides the color for all the states.

Definition at line 455 of file GUITextBlock.cs.

◆ SetAlpha()

override void Barotrauma.GUITextBlock.SetAlpha ( float  a)
protectedvirtual

Reimplemented from Barotrauma.GUIComponent.

Definition at line 446 of file GUITextBlock.cs.

◆ SetRichText()

void Barotrauma.GUITextBlock.SetRichText ( LocalizedString  richText)

Definition at line 328 of file GUITextBlock.cs.

◆ SetTextPos()

void Barotrauma.GUITextBlock.SetTextPos ( )

Definition at line 355 of file GUITextBlock.cs.

◆ TextGetterHandler()

delegate LocalizedString Barotrauma.GUITextBlock.TextGetterHandler ( )

◆ Update()

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

Reimplemented from Barotrauma.GUIComponent.

Definition at line 519 of file GUITextBlock.cs.

Member Data Documentation

◆ origin

Vector2 Barotrauma.GUITextBlock.origin
protected

Definition at line 28 of file GUITextBlock.cs.

◆ OverflowClip

bool Barotrauma.GUITextBlock.OverflowClip

Definition at line 43 of file GUITextBlock.cs.

◆ OverrideRichTextDataAlpha

bool Barotrauma.GUITextBlock.OverrideRichTextDataAlpha = true

Definition at line 271 of file GUITextBlock.cs.

◆ RoundToNearestPixel

bool Barotrauma.GUITextBlock.RoundToNearestPixel = true

Definition at line 40 of file GUITextBlock.cs.

◆ Strikethrough

StrikethroughSettings Barotrauma.GUITextBlock.Strikethrough = null

Definition at line 265 of file GUITextBlock.cs.

◆ text

RichString Barotrauma.GUITextBlock.text
protected

Definition at line 21 of file GUITextBlock.cs.

◆ textAlignment

Alignment Barotrauma.GUITextBlock.textAlignment
protected

Definition at line 23 of file GUITextBlock.cs.

◆ textColor

Color Barotrauma.GUITextBlock.textColor
protected

Definition at line 30 of file GUITextBlock.cs.

◆ TextGetter

TextGetterHandler Barotrauma.GUITextBlock.TextGetter

Definition at line 36 of file GUITextBlock.cs.

◆ textPos

Vector2 Barotrauma.GUITextBlock.textPos
protected

Definition at line 27 of file GUITextBlock.cs.

◆ Wrap

bool Barotrauma.GUITextBlock.Wrap

Definition at line 38 of file GUITextBlock.cs.

Property Documentation

◆ AutoScaleHorizontal

bool Barotrauma.GUITextBlock.AutoScaleHorizontal
getset

When enabled, the text is automatically scaled down to fit the textblock horizontally.

Definition at line 144 of file GUITextBlock.cs.

◆ AutoScaleVertical

bool Barotrauma.GUITextBlock.AutoScaleVertical
getset

When enabled, the text is automatically scaled down to fit the textblock vertically.

Definition at line 161 of file GUITextBlock.cs.

◆ Censor

bool Barotrauma.GUITextBlock.Censor
getset

Definition at line 235 of file GUITextBlock.cs.

◆ CensoredText

string Barotrauma.GUITextBlock.CensoredText
get

Definition at line 241 of file GUITextBlock.cs.

◆ ClickableAreas

List<ClickableArea> Barotrauma.GUITextBlock.ClickableAreas = new List<ClickableArea>()
get

Definition at line 281 of file GUITextBlock.cs.

◆ DisabledTextColor

Color Barotrauma.GUITextBlock.DisabledTextColor
getset

Definition at line 205 of file GUITextBlock.cs.

◆ Font

override GUIFont Barotrauma.GUITextBlock.Font
getset

Definition at line 65 of file GUITextBlock.cs.

◆ ForceUpperCase

ForceUpperCase Barotrauma.GUITextBlock.ForceUpperCase
getset

Definition at line 176 of file GUITextBlock.cs.

◆ HasColorHighlight

bool Barotrauma.GUITextBlock.HasColorHighlight
get

Definition at line 269 of file GUITextBlock.cs.

◆ HoverTextColor

Color?? Barotrauma.GUITextBlock.HoverTextColor
getset

Definition at line 212 of file GUITextBlock.cs.

◆ Origin

Vector2 Barotrauma.GUITextBlock.Origin
get

Definition at line 188 of file GUITextBlock.cs.

◆ OverflowClipActive

bool Barotrauma.GUITextBlock.OverflowClipActive
get

Definition at line 45 of file GUITextBlock.cs.

◆ Padding

Vector4 Barotrauma.GUITextBlock.Padding
getset

Definition at line 55 of file GUITextBlock.cs.

◆ RichTextData

ImmutableArray<RichTextData>? Barotrauma.GUITextBlock.RichTextData
get

Definition at line 267 of file GUITextBlock.cs.

◆ SelectedTextColor

Color Barotrauma.GUITextBlock.SelectedTextColor
getset

Definition at line 218 of file GUITextBlock.cs.

◆ Shadow

bool Barotrauma.GUITextBlock.Shadow
getset

Definition at line 283 of file GUITextBlock.cs.

◆ Text

RichString Barotrauma.GUITextBlock.Text
getset

Definition at line 80 of file GUITextBlock.cs.

◆ TextAlignment

Alignment Barotrauma.GUITextBlock.TextAlignment
getset

Definition at line 224 of file GUITextBlock.cs.

◆ TextColor

Color Barotrauma.GUITextBlock.TextColor
getset

Definition at line 199 of file GUITextBlock.cs.

◆ TextDepth

float Barotrauma.GUITextBlock.TextDepth
getset

Definition at line 110 of file GUITextBlock.cs.

◆ TextOffset

Vector2 Barotrauma.GUITextBlock.TextOffset
getset

Definition at line 52 of file GUITextBlock.cs.

◆ TextPos

Vector2 Barotrauma.GUITextBlock.TextPos
getset

Definition at line 116 of file GUITextBlock.cs.

◆ TextScale

float Barotrauma.GUITextBlock.TextScale
getset

Definition at line 126 of file GUITextBlock.cs.

◆ TextSize

Vector2 Barotrauma.GUITextBlock.TextSize
get

Definition at line 193 of file GUITextBlock.cs.

◆ WrappedText

LocalizedString Barotrauma.GUITextBlock.WrappedText
get

Definition at line 105 of file GUITextBlock.cs.