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
capiICoreClientAPIThe Client API.
valuesstring[]The values of the list.
namesstring[]The names for each of the values.
selectedIndexintThe default selected index.
onSelectionChangedSelectionChangedDelegateThe event fired when the selection is changed.
boundsElementBoundsThe bounds of the GUI element.
fontCairoFontmultiSelectbool
Fields
MaxHeight
Max height of the expanded list
public int MaxHeight
Field Value
dropDownTexture
protected LoadedTexture dropDownTexture
Field Value
expanded
protected bool expanded
Field Value
expandedBoxHeight
protected double expandedBoxHeight
Field Value
expandedBoxWidth
protected double expandedBoxWidth
Field Value
hoverTexture
protected LoadedTexture hoverTexture
Field Value
multiSelect
protected bool multiSelect
Field Value
onSelectionChanged
protected SelectionChangedDelegate onSelectionChanged
Field Value
richtTextElem
protected GuiElementRichtext[] richtTextElem
Field Value
scrollOffY
protected double scrollOffY
Field Value
scrollbar
protected GuiElementCompactScrollbar scrollbar
Field Value
scrollbarTexture
protected LoadedTexture scrollbarTexture
Field Value
unscaledLineHeight
protected double unscaledLineHeight
Field Value
visibleBounds
protected ElementBounds visibleBounds
Field Value
Properties
DrawOrder
0 = draw first, 1 = draw last. Only for interactive elements.
public override double DrawOrder { get; }
Property Value
Focusable
Whether or not the element can be focused.
public override bool Focusable { get; }
Property Value
HoveredIndex
The element the user currently has the mouse over
public int HoveredIndex { get; set; }
Property Value
IsOpened
Is the current menu opened?
public bool IsOpened { get; }
Property Value
Names
public string[] Names { get; set; }
Property Value
- string[]
SelectedIndex
The (first) currently selected element
public int SelectedIndex { get; set; }
Property Value
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
ctxContextsurfaceImageSurfaceThe 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
Returns
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
apiICoreClientAPIThe client API
argsKeyEventThe 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
apiICoreClientAPIThe Client API
argsMouseEvent
OnMouseMove(ICoreClientAPI, MouseEvent)
The event fired when the mouse is moved.
public override void OnMouseMove(ICoreClientAPI api, MouseEvent args)
Parameters
apiICoreClientAPIThe Client API.
argsMouseEventThe mouse event arguments.
OnMouseUp(ICoreClientAPI, MouseEvent)
The event fired when the mouse is released.
public override void OnMouseUp(ICoreClientAPI api, MouseEvent args)
Parameters
apiICoreClientAPIThe Client API.
argsMouseEventThe 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
apiICoreClientAPIThe Client API
argsMouseWheelEventArgsThe 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
deltaTimefloatThe change in time.
SetList(string[], string[])
Sets the list for the GUI Element list value.
public void SetList(string[] values, string[] names)
Parameters
SetSelectedIndex(int)
Sets the selected index.
public void SetSelectedIndex(int selectedIndex)
Parameters
selectedIndexintThe index to be set to.
SetSelectedValue(params string[])
Sets the selected index to the given value.
public void SetSelectedValue(params string[] value)
Parameters
valuestring[]The value to be set to.