aboutsummaryrefslogtreecommitdiffstats
path: root/ui.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui.go')
-rw-r--r--ui.go17
1 files changed, 4 insertions, 13 deletions
diff --git a/ui.go b/ui.go
index 9355989..64e7ce5 100644
--- a/ui.go
+++ b/ui.go
@@ -7,6 +7,7 @@ import (
"volute/gui"
"volute/gui/layout"
+ "volute/gui/text"
"volute/gui/widget"
)
@@ -23,7 +24,7 @@ func spawnWidgets(
Background: color.Gray{255},
Gap: 1,
Split: split,
- SplitRows: splitRows,
+ SplitRows: layout.TextRowSplit,
Margin: 0,
Border: 0,
BorderColor: color.Gray{16},
@@ -96,8 +97,8 @@ func spawnWidgets(
func split(elements int, space int) []int {
bounds := make([]int, elements)
widths := []int{
- widget.TextSize(WIDEST_LABEL).X,
- widget.TextSize("123456").X,
+ text.Size(WIDEST_LABEL).X,
+ text.Size("123456").X,
}
for i := 0; i < elements && space > 0; i++ {
bounds[i] = min(widths[min(i, len(widths)-1)], space)
@@ -105,13 +106,3 @@ func split(elements int, space int) []int {
}
return bounds
}
-
-func splitRows(elements int, space int) []int {
- bounds := make([]int, elements)
- height := widget.TextSize("1").Y
- for i := 0; i < elements && space > 0; i++ {
- bounds[i] = min(height, space)
- space -= bounds[i]
- }
- return bounds
-}