forked from vlang/ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
column.v
44 lines (41 loc) · 1.23 KB
/
column.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) 2020-2021 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by a GPL license
// that can be found in the LICENSE file.
module ui
import gx
pub struct ColumnConfig {
id string
width int // To remove soon
height int // To remove soon
alignment HorizontalAlignment
spacing f64 // Size = Size(0.) // Spacing = Spacing(0) // int
spacings []f64 = []f64{}
stretch bool // to remove ui.stretch doing the job from parent
margin Margin
margin_ f64
// children related
widths Size //[]f64 // children sizes
heights Size //[]f64
alignments HorizontalAlignments
align Alignments
bg_color gx.Color = no_color
title string
}
pub fn column(c ColumnConfig, children []Widget) &Stack {
return stack({
id: c.id
height: c.height
width: c.width
horizontal_alignment: c.alignment
spacings: spacings(c.spacing, c.spacings, children.len - 1)
stretch: c.stretch
direction: .column
margins: margins(c.margin_, c.margin)
heights: c.heights.as_f32_array(children.len) //.map(f32(it))
widths: c.widths.as_f32_array(children.len) //.map(f32(it))
horizontal_alignments: c.alignments
align: c.align
bg_color: c.bg_color
title: c.title
}, children)
}