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
ICoreClientAPIThe Client API
text
stringThe text of the button.
font
CairoFontThe font of the text.
hoverFont
CairoFontThe font of the text when the player is hovering over the button.
onClick
ActionConsumableThe event fired when the button is clicked.
bounds
ElementBoundsThe bounds of the button.
style
EnumButtonStyleThe 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
ctxStatic
ContextThe 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
ICoreClientAPIThe client API
args
KeyEventThe 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
ICoreClientAPIThe Client API
args
MouseEventThe mouse event args.
OnMouseMove(ICoreClientAPI, MouseEvent)
The event fired when the mouse is moved.
public override void OnMouseMove(ICoreClientAPI api, MouseEvent args)
Parameters
api
ICoreClientAPIThe Client API.
args
MouseEventThe mouse event arguments.
OnMouseUp(ICoreClientAPI, MouseEvent)
The event fired when the mouse is released.
public override void OnMouseUp(ICoreClientAPI api, MouseEvent args)
Parameters
api
ICoreClientAPIThe Client API.
args
MouseEventThe 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
ICoreClientAPIThe Client API
args
MouseEventThe mouse event args.
RenderInteractiveElements(float)
Renders the element as an interactive element.
public override void RenderInteractiveElements(float deltaTime)
Parameters
deltaTime
floatThe change in time.
SetActive(bool)
Sets the button as active or inactive.
public void SetActive(bool active)
Parameters
active
boolActive == clickable
SetOrientation(EnumTextOrientation)
Sets the orientation of the text both when clicked and when idle.
public void SetOrientation(EnumTextOrientation orientation)
Parameters
orientation
EnumTextOrientationThe orientation of the text.
setIsOver()
protected void setIsOver()