aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-10-01 03:12:58 +0200
committerRobert Jaros <rjaros@finn.pl>2017-10-01 03:12:58 +0200
commitd732f672bfbfa565c6ec4fc037381554de251ad3 (patch)
treeb0a8388de30e568d2ca5b6d33c330ccdedfebe09 /src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
parent69826202db3424beb47923f80d86bf1412053941 (diff)
downloadkvision-d732f672bfbfa565c6ec4fc037381554de251ad3.tar.gz
kvision-d732f672bfbfa565c6ec4fc037381554de251ad3.tar.bz2
kvision-d732f672bfbfa565c6ec4fc037381554de251ad3.zip
GridPanel, HPanel and VPanel
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
new file mode 100644
index 00000000..685cfc87
--- /dev/null
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/HPanel.kt
@@ -0,0 +1,31 @@
+package pl.treksoft.kvision.panel
+
+import com.github.snabbdom.VNode
+import pl.treksoft.kvision.core.Container
+import pl.treksoft.kvision.core.Widget
+import pl.treksoft.kvision.html.ALIGN
+import pl.treksoft.kvision.html.TAG
+import pl.treksoft.kvision.html.Tag
+
+open class HPanel(align: ALIGN = ALIGN.NONE, classes: Set<String> = setOf()) : GridPanel(GRIDTYPE.DSG, align = align,
+ classes = classes) {
+
+ override fun add(child: Widget, row: Int, col: Int, size: Int, offset: Int): Container {
+ return super.add(child, 0, col, size, offset)
+ }
+
+ override fun childrenVNodesDsg(): Array<VNode> {
+ val ret = mutableListOf<VNode>()
+ val rowContainer = Container(setOf("dsgrow"))
+ val row = map[0]
+ if (row != null) {
+ for (j in 0 until cols) {
+ val wp = row[j]
+ val widget = wp?.widget?.addCssClass("dsgcolf") ?: Tag(TAG.DIV, classes = setOf("dsgcolf"))
+ rowContainer.add(widget)
+ }
+ }
+ ret.add(rowContainer.render())
+ return ret.toTypedArray()
+ }
+}