Table of Contents

Class GuiElementContainer

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll
public class GuiElementContainer : GuiElement, IDisposable
Inheritance
GuiElementContainer
Implements
Inherited Members
Extension Methods

Constructors

GuiElementContainer(ICoreClientAPI, ElementBounds)

Creates a new list in the current GUI.

public GuiElementContainer(ICoreClientAPI capi, ElementBounds bounds)

Parameters

capi ICoreClientAPI

The Client API.

bounds ElementBounds

The bounds of the list.

Fields

Elements

The cells in the list. See IGuiElementCell for how it's supposed to function.

public List<GuiElement> Elements

Field Value

List<GuiElement>

Tabbable

public bool Tabbable

Field Value

bool

UnscaledCellHorPadding

The padding on the horizontal axis of the cell. Default: 7

public int UnscaledCellHorPadding

Field Value

int

UnscaledCellVerPadding

The padding on the vertical axis of the cell. Default: 2

public int UnscaledCellVerPadding

Field Value

int

currentFocusableElementKey

protected int currentFocusableElementKey

Field Value

int

unscaledCellSpacing

the space between the cells. Default: 10

public int unscaledCellSpacing

Field Value

int

Properties

CurrentTabIndexElement

Gets the currently tabbed index element, if there is one currently focused.

public GuiElement CurrentTabIndexElement { get; }

Property Value

GuiElement

FirstTabbableElement

public GuiElement FirstTabbableElement { get; }

Property Value

GuiElement

Focusable

Whether or not the element can be focused.

public override bool Focusable { get; }

Property Value

bool

MaxTabIndex

Gets the maximum tab index of the components.

public int MaxTabIndex { get; }

Property Value

int

Methods

Add(GuiElement, int)

Adds a cell to the list.

public void Add(GuiElement elem, int afterPosition = -1)

Parameters

elem GuiElement

The cell to add.

afterPosition int

The position of the cell to add after. (Default: -1)

BeforeCalcBounds()

public override void BeforeCalcBounds()

CalcTotalHeight()

Calculates the total height for the list.

public void CalcTotalHeight()

Clear()

public void Clear()

ComposeElements(Context, ImageSurface)

Composes the elements.

public override void ComposeElements(Context ctx, ImageSurface surface)

Parameters

ctx Context
surface ImageSurface

The surface of the GUI.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public override void Dispose()

FocusElement(int)

marks an element as in focus.

public bool FocusElement(int tabIndex)

Parameters

tabIndex int

The tab index to focus at.

Returns

bool

Whether or not the focus could be done.

OnFocusGained()

The event fired when the element gains focus.

public override void OnFocusGained()

OnFocusLost()

The event fired when the element looses focus.

public override void OnFocusLost()

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.

OnKeyPress(ICoreClientAPI, KeyEvent)

The event fired the moment a key is pressed.

public override void OnKeyPress(ICoreClientAPI api, KeyEvent args)

Parameters

api ICoreClientAPI

The Client API.

args KeyEvent

The keyboard state when the key was pressed.

OnKeyUp(ICoreClientAPI, KeyEvent)

The event fired when a key is held down.

public override void OnKeyUp(ICoreClientAPI api, KeyEvent args)

Parameters

api ICoreClientAPI

The client API

args KeyEvent

The key event arguments.

OnMouseDown(ICoreClientAPI, MouseEvent)

The event fired when the mouse is down the element is around. Fires before OnMouseDownOnElement, however OnMouseDownOnElement is called within the base function.

public override void OnMouseDown(ICoreClientAPI api, MouseEvent args)

Parameters

api ICoreClientAPI

The Client API

args MouseEvent

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.

OnMouseWheel(ICoreClientAPI, MouseWheelEventArgs)

The event fired when the mouse wheel is scrolled.

public override void OnMouseWheel(ICoreClientAPI api, MouseWheelEventArgs args)

Parameters

api ICoreClientAPI

The Client API

args MouseWheelEventArgs

The mouse wheel arguments.

RemoveCell(int)

Removes a cell at a specified position.

public void RemoveCell(int position)

Parameters

position int

The position of the cell to remove.

RenderInteractiveElements(float)

Renders the element as an interactive element.

public override void RenderInteractiveElements(float deltaTime)

Parameters

deltaTime float

The change in time.

UnfocusOwnElements()

public void UnfocusOwnElements()

UnfocusOwnElementsExcept(GuiElement)

Unfocuses all elements except one specific element.

public void UnfocusOwnElementsExcept(GuiElement elem)

Parameters

elem GuiElement

The element to remain in focus.