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
ICoreClientAPIThe Client API.
values
string[]The values of the list.
names
string[]The names for each of the values.
selectedIndex
intThe default selected index.
onSelectionChanged
SelectionChangedDelegateThe event fired when the selection is changed.
bounds
ElementBoundsThe bounds of the GUI element.
font
CairoFontmultiSelect
bool
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
ctx
Contextsurface
ImageSurfaceThe 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
api
ICoreClientAPIThe client API
args
KeyEventThe 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
ICoreClientAPIThe 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
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.
OnMouseWheel(ICoreClientAPI, MouseWheelEventArgs)
The event fired when the mouse wheel is scrolled.
public override void OnMouseWheel(ICoreClientAPI api, MouseWheelEventArgs args)
Parameters
api
ICoreClientAPIThe Client API
args
MouseWheelEventArgsThe 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
floatThe 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
selectedIndex
intThe 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.