Table of Contents

Class GuiElementDropDown

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

Creates a drop-down list of items.

public class GuiElementDropDown : GuiElementTextBase, IDisposable
Inheritance
GuiElementDropDown
Implements
Inherited Members

Constructors

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

Constructor.

public GuiElementDropDown(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 strings.

names string[]

The names of the strings.

selectedIndex int

The default selected index.

onSelectionChanged SelectionChangedDelegate

The event that occurs when the selection is changed.

bounds ElementBounds

The bounds of the drop down.

font CairoFont
multiSelect bool

Fields

PluralMoreNameCode

public string PluralMoreNameCode

Field Value

string

PluralNameCode

public string PluralNameCode

Field Value

string

SingularMoreNameCode

public string SingularMoreNameCode

Field Value

string

SingularNameCode

public string SingularNameCode

Field Value

string

arrowDownButtonPressed

protected LoadedTexture arrowDownButtonPressed

Field Value

LoadedTexture

arrowDownButtonReleased

protected LoadedTexture arrowDownButtonReleased

Field Value

LoadedTexture

currentValueTexture

protected LoadedTexture currentValueTexture

Field Value

LoadedTexture

highlightBounds

protected ElementBounds highlightBounds

Field Value

ElementBounds

highlightTexture

protected LoadedTexture highlightTexture

Field Value

LoadedTexture

listMenu

public GuiElementListMenu listMenu

Field Value

GuiElementListMenu

onSelectionChanged

protected SelectionChangedDelegate onSelectionChanged

Field Value

SelectionChangedDelegate

richTextElem

public GuiElementRichtext richTextElem

Field Value

GuiElementRichtext

Properties

DrawOrder

The draw order of this GUI Element.

public override double DrawOrder { get; }

Property Value

double

Enabled

Enables/disables the given element (default is enabled)

public override bool Enabled { get; set; }

Property Value

bool

Focusable

Can this element be put into focus?

public override bool Focusable { get; }

Property Value

bool

Scale

The scale of this GUI element.

public override double Scale { get; set; }

Property Value

double

SelectedIndices

public int[] SelectedIndices { get; }

Property Value

int[]

SelectedValue

public string SelectedValue { get; }

Property Value

string

SelectedValues

public string[] SelectedValues { get; }

Property Value

string[]

Methods

ComposeElements(Context, ImageSurface)

Composes the element based on the context.

public override void ComposeElements(Context ctx, ImageSurface surface)

Parameters

ctx Context

The context of the element.

surface ImageSurface

The surface of the image. (Not used)

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.

RenderInteractiveElements(float)

Renders the dropdown's interactive elements.

public override void RenderInteractiveElements(float deltaTime)

Parameters

deltaTime float

The change in time.

SetList(string[], string[])

Sets the values of the list with their corresponding names.

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

Parameters

values string[]

The values of the list.

names string[]

The names of the list.

SetSelectedIndex(int)

Sets the current index to a newly selected index.

public void SetSelectedIndex(int selectedIndex)

Parameters

selectedIndex int

the index that is to be selected.

SetSelectedValue(params string[])

Sets the current index to the value of the selected string.

public void SetSelectedValue(params string[] value)

Parameters

value string[]

the string contained in the drop down.