Table of Contents

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

capi ICoreClientAPI

The Client API

text string

The text of the button.

font CairoFont

The font of the text.

hoverFont CairoFont

The font of the text when the player is hovering over the button.

onClick ActionConsumable

The event fired when the button is clicked.

bounds ElementBounds

The bounds of the button.

style EnumButtonStyle

The style of the button.

Fields

Padding

public static double Padding

Field Value

double

PlaySound

public bool PlaySound

Field Value

bool

Visible

public bool Visible

Field Value

bool

Properties

Focusable

Whether or not the element can be focused.

public override bool Focusable { get; }

Property Value

bool

Text

public string Text { get; set; }

Property Value

string

Methods

BeforeCalcBounds()

public override void BeforeCalcBounds()

ComposeElements(Context, ImageSurface)

Composes the elements.

public override void ComposeElements(Context ctxStatic, ImageSurface surfaceStatic)

Parameters

ctxStatic Context

The context of the components.

surfaceStatic ImageSurface

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

api ICoreClientAPI

The client API

args KeyEvent

The 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

api ICoreClientAPI

The Client API

args MouseEvent

The mouse event args.

OnMouseMove(ICoreClientAPI, MouseEvent)

The event fired when the mouse is moved.

public override void OnMouseMove(ICoreClientAPI api, MouseEvent args)

Parameters

api ICoreClientAPI

The Client API.

args MouseEvent

The mouse event arguments.

OnMouseUp(ICoreClientAPI, MouseEvent)

The event fired when the mouse is released.

public override void OnMouseUp(ICoreClientAPI api, MouseEvent args)

Parameters

api ICoreClientAPI

The Client API.

args MouseEvent

The 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

api ICoreClientAPI

The Client API

args MouseEvent

The mouse event args.

RenderInteractiveElements(float)

Renders the element as an interactive element.

public override void RenderInteractiveElements(float deltaTime)

Parameters

deltaTime float

The change in time.

SetActive(bool)

Sets the button as active or inactive.

public void SetActive(bool active)

Parameters

active bool

Active == clickable

SetOrientation(EnumTextOrientation)

Sets the orientation of the text both when clicked and when idle.

public void SetOrientation(EnumTextOrientation orientation)

Parameters

orientation EnumTextOrientation

The orientation of the text.

setIsOver()

protected void setIsOver()