From 134cb687c4e05fd81a03b682505f9fb9d741a8d7 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 9 May 2020 23:53:57 +0200 Subject: Add new className parameter to all DSL builder functions. --- src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt') diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt index 59c61637..52239032 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/DockPanel.kt @@ -24,6 +24,7 @@ package pl.treksoft.kvision.panel import pl.treksoft.kvision.core.Component import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.utils.perc +import pl.treksoft.kvision.utils.set /** * Dock layout directions. @@ -50,21 +51,25 @@ open class DockPanel(classes: Set = setOf(), init: (DockPanel.() -> Unit * Internal property. */ protected var leftComponent: Component? = null + /** * @suppress * Internal property. */ protected var centerComponent: Component? = null + /** * @suppress * Internal property. */ protected var rightComponent: Component? = null + /** * @suppress * Internal property. */ protected var upComponent: Component? = null + /** * @suppress * Internal property. @@ -83,6 +88,7 @@ open class DockPanel(classes: Set = setOf(), init: (DockPanel.() -> Unit @Suppress("MagicNumber") height = 100.perc } + /** * @suppress * Internal property. @@ -204,8 +210,12 @@ open class DockPanel(classes: Set = setOf(), init: (DockPanel.() -> Unit * * It takes the same parameters as the constructor of the built component. */ -fun Container.dockPanel(classes: Set = setOf(), init: (DockPanel.() -> Unit)? = null): DockPanel { - val dockPanel = DockPanel(classes, init) +fun Container.dockPanel( + classes: Set? = null, + className: String? = null, + init: (DockPanel.() -> Unit)? = null +): DockPanel { + val dockPanel = DockPanel(classes ?: className.set, init) this.add(dockPanel) return dockPanel } -- cgit