Class GuiElementTextButton
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
public class GuiElementTextButton : GuiElementControl, IDisposable
- Inheritance
-
GuiElementTextButton
- Implements
- Inherited Members
- Extension Methods
Constructors
GuiElementTextButton(ICoreClientAPI, string, CairoFont, CairoFont, ActionConsumable, ElementBounds, EnumButtonStyle)
Creates a button with text.
public GuiElementTextButton(ICoreClientAPI capi, string text, CairoFont font, CairoFont hoverFont, ActionConsumable onClick, ElementBounds bounds, EnumButtonStyle style = EnumButtonStyle.Normal)
Parameters
capiICoreClientAPIThe Client API
textstringThe text of the button.
fontCairoFontThe font of the text.
hoverFontCairoFontThe font of the text when the player is hovering over the button.
onClickActionConsumableThe event fired when the button is clicked.
boundsElementBoundsThe bounds of the button.
styleEnumButtonStyleThe style of the button.
Fields
Padding
public static double Padding
Field Value
PlaySound
public bool PlaySound
Field Value
Visible
public bool Visible
Field Value
Properties
Focusable
Whether or not the element can be focused.
public override bool Focusable { get; }
Property Value
Text
public string Text { get; set; }
Property Value
Methods
BeforeCalcBounds()
public override void BeforeCalcBounds()
ComposeElements(Context, ImageSurface)
Composes the elements.
public override void ComposeElements(Context ctxStatic, ImageSurface surfaceStatic)
Parameters
ctxStaticContextThe context of the components.
surfaceStaticImageSurface
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public override void Dispose()
OnKeyDown(ICoreClientAPI, KeyEvent)
The event fired when a key is held down.
public override void OnKeyDown(ICoreClientAPI api, KeyEvent args)
Parameters
apiICoreClientAPIThe client API
argsKeyEventThe key event arguments.
OnMouseDownOnElement(ICoreClientAPI, MouseEvent)
The event fired when the mouse is pressed while on the element. Called after OnMouseDown and tells the engine that the event is handled.
public override void OnMouseDownOnElement(ICoreClientAPI api, MouseEvent args)
Parameters
apiICoreClientAPIThe Client API
argsMouseEventThe mouse event args.
OnMouseMove(ICoreClientAPI, MouseEvent)
The event fired when the mouse is moved.
public override void OnMouseMove(ICoreClientAPI api, MouseEvent args)
Parameters
apiICoreClientAPIThe Client API.
argsMouseEventThe mouse event arguments.
OnMouseUp(ICoreClientAPI, MouseEvent)
The event fired when the mouse is released.
public override void OnMouseUp(ICoreClientAPI api, MouseEvent args)
Parameters
apiICoreClientAPIThe Client API.
argsMouseEventThe arguments for the mouse event.
OnMouseUpOnElement(ICoreClientAPI, MouseEvent)
The event fired when the mouse is released on the element. Called after OnMouseUp.
public override void OnMouseUpOnElement(ICoreClientAPI api, MouseEvent args)
Parameters
apiICoreClientAPIThe Client API
argsMouseEventThe mouse event args.
RenderInteractiveElements(float)
Renders the element as an interactive element.
public override void RenderInteractiveElements(float deltaTime)
Parameters
deltaTimefloatThe change in time.
SetActive(bool)
Sets the button as active or inactive.
public void SetActive(bool active)
Parameters
activeboolActive == clickable
SetOrientation(EnumTextOrientation)
Sets the orientation of the text both when clicked and when idle.
public void SetOrientation(EnumTextOrientation orientation)
Parameters
orientationEnumTextOrientationThe orientation of the text.
setIsOver()
protected void setIsOver()