GaldurScrollList
classclient onlysince 0.1.0com.galdurstudio.galdurui.api.widget.GaldurScrollList
Themed scrolling list of text lines, usable in vanilla layouts. The player selects a line with a click, or with the up and down arrows.
Like GaldurCheckbox, the widget keeps neither the lines nor the selection: it
reads them every frame from suppliers and reports the changes the player asks
for. The lines can change at any time without rebuilding the widget. Only the scroll position
lives in the widget; onScroll() lets you keep it elsewhere when the
widget is rebuilt (resize).
List<Component> ores = List.of(Component.literal("Iron"), Component.literal("Gold"));int[] choice = {-1};column.addChild(GaldurScrollList.of(120, 5, () -> ores, () -> choice[0], index -> choice[0] = index));- Mouse wheel: scrolls one line per notch.
- Scrollbar: shown only when the lines do not fit; it can be grabbed and dragged.
- Keyboard: up and down arrows change the selection; the list scrolls to keep the selected line visible.
- Disabled (
active = false): muted text, no click, selection or scrolling.
A line that is too long is clipped at the list edge (see GaldurRender.drawClipped).
Sizes from the theme: spacing.list_row_height and spacing.scrollbar_width.
Constructors 1
GaldurScrollList
protectedPrefer of().
PARAMETERS
-1 for noneMethods 7
of
staticPARAMETERS
-1 for noneRETURNSGaldurScrollList — a scrolling list at (0, 0), for a layout to place
preferredWidth
staticPARAMETERS
RETURNSint — the width that shows the longest given line in full, scrollbar included, or
minWidth if larger
onScroll
Sets the action called when the scroll offset changes, by the player or by code. Only one action is kept.
PARAMETERS
RETURNSGaldurScrollList — this list, for chaining
getScroll
RETURNSdouble — the scroll offset, in pixels from the top of the content
setScroll
Scrolls the list, clamped between the top and the bottom of the content.
PARAMETERS
scrollToLine
Scrolls just enough for line index to be fully visible.
PARAMETERS
playDownSound
A list does not play the button sound when a line is clicked.
PARAMETERS