From d12c4298e2e40c7bdf69b64c0932f10ce22773da Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Mon, 30 Jun 2025 18:31:08 +0200 Subject: [PATCH] add kotlin listview --- .../kotlin/de/unixwork/ui/kotlin/Toplevel.kt | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/ui-kotlin/src/main/kotlin/de/unixwork/ui/kotlin/Toplevel.kt b/ui-kotlin/src/main/kotlin/de/unixwork/ui/kotlin/Toplevel.kt index 0a694e5..56954c3 100644 --- a/ui-kotlin/src/main/kotlin/de/unixwork/ui/kotlin/Toplevel.kt +++ b/ui-kotlin/src/main/kotlin/de/unixwork/ui/kotlin/Toplevel.kt @@ -7,8 +7,11 @@ import de.unixwork.ui.ContainerBuilder import de.unixwork.ui.ContainerUI import de.unixwork.ui.EventHandler import de.unixwork.ui.EventWrapper.eventHandler +import de.unixwork.ui.ListValueConverter +import de.unixwork.ui.ListView import de.unixwork.ui.ToggleBuilder import de.unixwork.ui.UiInteger +import de.unixwork.ui.UiList import de.unixwork.ui.UiObject import de.unixwork.ui.UiWidget import java.lang.foreign.MemorySegment @@ -492,4 +495,62 @@ class Toplevel(obj: UiObject) { onChange = onChange ) } + + fun listview( + varname: String? = null, + value: UiList? = null, + fill: Boolean = false, + hexpand: Boolean = false, + vexpand: Boolean = false, + hfill: Boolean = false, + vfill: Boolean = false, + overrideDefaults: Boolean = false, + colspan: Int = -1, + rowspan: Int = -1, + name: String? = null, + styleClass: String? = null, + getvalue: ListValueConverter? = null + ): UiWidget { + val list = ListView.list(obj) + varname?.let { + list.varname(varname) + } + value?.let { + // TODO + } + if(fill) { + list.fill(true) + } + if(hexpand) { + list.hexpand(true) + } + if(vexpand) { + list.vexpand(true) + } + if(hfill) { + list.hfill(true) + } + if(vfill) { + list.vfill(true) + } + if(overrideDefaults) { + list.overrideDefaults(true) + } + if(colspan > 0) { + list.colspan(colspan) + } + if(rowspan > 0) { + list.rowspan(rowspan) + } + name?.let { + list.name(it) + } + styleClass?.let { + list.styleClass(it) + } + getvalue?.let { + list.getvalue(it) + } + return list.create() + } } \ No newline at end of file -- 2.47.3