Table of Contents

Class GuiElementListMenu

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

Constructors

GuiElementListMenu(ICoreClientAPI, string[], string[], int, SelectionChangedDelegate, ElementBounds, CairoFont, bool)

Creates a new GUI Element List Menu

public GuiElementListMenu(ICoreClientAPI capi, string[] values, string[] names, int selectedIndex, SelectionChangedDelegate onSelectionChanged, ElementBounds bounds, CairoFont font, bool multiSelect)

Parameters

capi ICoreClientAPI

The Client API.

values string[]

The values of the list.

names string[]

The names for each of the values.

selectedIndex int

The default selected index.

onSelectionChanged SelectionChangedDelegate

The event fired when the selection is changed.

bounds ElementBounds

The bounds of the GUI element.

font CairoFont
multiSelect bool

Fields

MaxHeight

Max height of the expanded list

public int MaxHeight

Field Value

int

dropDownTexture

protected LoadedTexture dropDownTexture

Field Value

LoadedTexture

expanded

protected bool expanded

Field Value

bool

expandedBoxHeight

protected double expandedBoxHeight

Field Value

double

expandedBoxWidth

protected double expandedBoxWidth

Field Value

double

hoverTexture

protected LoadedTexture hoverTexture

Field Value

LoadedTexture

multiSelect

protected bool multiSelect

Field Value

bool

onSelectionChanged

protected SelectionChangedDelegate onSelectionChanged

Field Value

SelectionChangedDelegate

richtTextElem

protected GuiElementRichtext[] richtTextElem

Field Value

GuiElementRichtext[]

scrollOffY

protected double scrollOffY

Field Value

double

scrollbar

protected GuiElementCompactScrollbar scrollbar

Field Value

GuiElementCompactScrollbar

scrollbarTexture

protected LoadedTexture scrollbarTexture

Field Value

LoadedTexture

unscaledLineHeight

protected double unscaledLineHeight

Field Value

double

visibleBounds

protected ElementBounds visibleBounds

Field Value

ElementBounds

Properties

DrawOrder

0 = draw first, 1 = draw last. Only for interactive elements.

public override double DrawOrder { get; }

Property Value

double

Focusable

Whether or not the element can be focused.

public override bool Focusable { get; }

Property Value

bool

HoveredIndex

The element the user currently has the mouse over

public int HoveredIndex { get; set; }

Property Value

int

IsOpened

Is the current menu opened?

public bool IsOpened { get; }

Property Value

bool

Names

public string[] Names { get; set; }

Property Value

string[]

SelectedIndex

The (first) currently selected element

public int SelectedIndex { get; set; }

Property Value

int

SelectedIndices

On multi select mode, the list of all selected elements

public int[] SelectedIndices { get; set; }

Property Value

int[]

Values

public string[] Values { get; set; }

Property Value

string[]

Methods

ComposeDynamicElements()

Composes the list of elements dynamically.

public void ComposeDynamicElements()

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()

IsPositionInside(int, int)

Whether or not the point on screen is inside the Element's area.

public override bool IsPositionInside(int posX, int posY)

Parameters

posX int

The X Position of the point.

posY int

The Y Position of the point.

Returns

bool

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.

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.

Open()

Opens the menu.

public void Open()

RenderInteractiveElements(float)

Renders the element as an interactive element.

public override void RenderInteractiveElements(float deltaTime)

Parameters

deltaTime float

The change in time.

SetList(string[], string[])

Sets the list for the GUI Element list value.

public void SetList(string[] values, string[] names)

Parameters

values string[]

The values of the list.

names string[]

The names of the values.

SetSelectedIndex(int)

Sets the selected index.

public void SetSelectedIndex(int selectedIndex)

Parameters

selectedIndex int

The index to be set to.

SetSelectedValue(params string[])

Sets the selected index to the given value.

public void SetSelectedValue(params string[] value)

Parameters

value string[]

The value to be set to.