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

Public Member Functions

delegate bool OnClickedHandler (GUIButton button, object obj)
 
delegate bool OnPressedHandler ()
 
delegate bool OnButtonDownHandler ()
 
 GUIButton (RectTransform rectT, Alignment textAlignment=Alignment.Center, string style="", Color? color=null)
 
 GUIButton (RectTransform rectT, LocalizedString text, Alignment textAlignment=Alignment.Center, string style="", Color? color=null)
 
override void ApplyStyle (GUIComponentStyle style)
 
override void Flash (Color? color=null, float flashDuration=1.5f, bool useRectangleFlash=false, bool useCircularFlash=false, Vector2? flashRectInflate=null)
 
- 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)
 
void ApplySizeRestrictions (GUIComponentStyle style)
 

Public Attributes

OnClickedHandler OnClicked
 
OnPressedHandler OnPressed
 
OnButtonDownHandler OnButtonDown
 
bool CanBeSelected = 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 Draw (SpriteBatch spriteBatch)
 
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 SetAlpha (float a)
 

Protected Attributes

GUITextBlock textBlock
 
GUIFrame frame
 
- 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

GUITextBlock TextBlock [get]
 
GUIFrame Frame [get]
 
override bool Enabled [get, set]
 
override Color Color [get, set]
 
override Color HoverColor [get, set]
 
override Color SelectedColor [get, set]
 
override Color PressedColor [get, set]
 
override Color OutlineColor [get, set]
 
Color TextColor [get, set]
 
Color HoverTextColor [get, set]
 
Color SelectedTextColor [get, set]
 
Color DisabledTextColor [get]
 
override float FlashTimer [get]
 
override GUIFontFont [get, set]
 
LocalizedString Text [get, set]
 
ForceUpperCase ForceUpperCase [get, set]
 
override RichString ToolTip [get, set]
 
bool Pulse [get, set]
 
GUISoundType ClickSound = GUISoundType.Select [get, set]
 
override bool PlaySoundOnSelect = true [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
}
 
- 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 8 of file GUIButton.cs.

Constructor & Destructor Documentation

◆ GUIButton() [1/2]

Barotrauma.GUIButton.GUIButton ( RectTransform  rectT,
Alignment  textAlignment = Alignment.Center,
string  style = "",
Color color = null 
)

Definition at line 171 of file GUIButton.cs.

◆ GUIButton() [2/2]

Barotrauma.GUIButton.GUIButton ( RectTransform  rectT,
LocalizedString  text,
Alignment  textAlignment = Alignment.Center,
string  style = "",
Color color = null 
)

Definition at line 173 of file GUIButton.cs.

Member Function Documentation

◆ ApplyStyle()

override void Barotrauma.GUIButton.ApplyStyle ( GUIComponentStyle  style)
virtual

Reimplemented from Barotrauma.GUIComponent.

Definition at line 204 of file GUIButton.cs.

◆ Draw()

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

Reimplemented from Barotrauma.GUIComponent.

Definition at line 216 of file GUIButton.cs.

◆ Flash()

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

Reimplemented from Barotrauma.GUIComponent.

Definition at line 211 of file GUIButton.cs.

◆ OnButtonDownHandler()

delegate bool Barotrauma.GUIButton.OnButtonDownHandler ( )

◆ OnClickedHandler()

delegate bool Barotrauma.GUIButton.OnClickedHandler ( GUIButton  button,
object  obj 
)

◆ OnPressedHandler()

delegate bool Barotrauma.GUIButton.OnPressedHandler ( )

◆ Update()

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

Reimplemented from Barotrauma.GUIComponent.

Definition at line 228 of file GUIButton.cs.

Member Data Documentation

◆ CanBeSelected

bool Barotrauma.GUIButton.CanBeSelected = true

Definition at line 24 of file GUIButton.cs.

◆ frame

GUIFrame Barotrauma.GUIButton.frame
protected

Definition at line 12 of file GUIButton.cs.

◆ OnButtonDown

OnButtonDownHandler Barotrauma.GUIButton.OnButtonDown

Definition at line 22 of file GUIButton.cs.

◆ OnClicked

OnClickedHandler Barotrauma.GUIButton.OnClicked

Definition at line 16 of file GUIButton.cs.

◆ OnPressed

OnPressedHandler Barotrauma.GUIButton.OnPressed

Definition at line 19 of file GUIButton.cs.

◆ textBlock

GUITextBlock Barotrauma.GUIButton.textBlock
protected

Definition at line 10 of file GUIButton.cs.

Property Documentation

◆ ClickSound

GUISoundType Barotrauma.GUIButton.ClickSound = GUISoundType.Select
getset

Definition at line 167 of file GUIButton.cs.

◆ Color

override Color Barotrauma.GUIButton.Color
getset

Definition at line 40 of file GUIButton.cs.

◆ DisabledTextColor

Color Barotrauma.GUIButton.DisabledTextColor
get

Definition at line 114 of file GUIButton.cs.

◆ Enabled

override bool Barotrauma.GUIButton.Enabled
getset

Definition at line 26 of file GUIButton.cs.

◆ FlashTimer

override float Barotrauma.GUIButton.FlashTimer
get

Definition at line 119 of file GUIButton.cs.

◆ Font

override GUIFont? Barotrauma.GUIButton.Font
getset

Definition at line 124 of file GUIButton.cs.

◆ ForceUpperCase

ForceUpperCase Barotrauma.GUIButton.ForceUpperCase
getset

Definition at line 143 of file GUIButton.cs.

◆ Frame

GUIFrame Barotrauma.GUIButton.Frame
get

Definition at line 13 of file GUIButton.cs.

◆ HoverColor

override Color Barotrauma.GUIButton.HoverColor
getset

Definition at line 50 of file GUIButton.cs.

◆ HoverTextColor

Color Barotrauma.GUIButton.HoverTextColor
getset

Definition at line 102 of file GUIButton.cs.

◆ OutlineColor

override Color Barotrauma.GUIButton.OutlineColor
getset

Definition at line 86 of file GUIButton.cs.

◆ PlaySoundOnSelect

override bool Barotrauma.GUIButton.PlaySoundOnSelect = true
getset

Definition at line 169 of file GUIButton.cs.

◆ PressedColor

override Color Barotrauma.GUIButton.PressedColor
getset

Definition at line 73 of file GUIButton.cs.

◆ Pulse

bool Barotrauma.GUIButton.Pulse
getset

Definition at line 162 of file GUIButton.cs.

◆ SelectedColor

override Color Barotrauma.GUIButton.SelectedColor
getset

Definition at line 60 of file GUIButton.cs.

◆ SelectedTextColor

Color Barotrauma.GUIButton.SelectedTextColor
getset

Definition at line 108 of file GUIButton.cs.

◆ Text

LocalizedString Barotrauma.GUIButton.Text
getset

Definition at line 137 of file GUIButton.cs.

◆ TextBlock

GUITextBlock Barotrauma.GUIButton.TextBlock
get

Definition at line 11 of file GUIButton.cs.

◆ TextColor

Color Barotrauma.GUIButton.TextColor
getset

Definition at line 96 of file GUIButton.cs.

◆ ToolTip

override RichString Barotrauma.GUIButton.ToolTip
getset

Definition at line 149 of file GUIButton.cs.