From 84b5963407e2d0f888145a0985a4f0111dae7223 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Mon, 10 Apr 2023 19:14:36 -0700 Subject: [PATCH] add comments to some custom layouts --- ui/layouts/columnslayout.go | 8 ++++++++ ui/layouts/leftmiddlerightlayout.go | 3 +++ 2 files changed, 11 insertions(+) diff --git a/ui/layouts/columnslayout.go b/ui/layouts/columnslayout.go index 614915e..5276483 100644 --- a/ui/layouts/columnslayout.go +++ b/ui/layouts/columnslayout.go @@ -2,6 +2,14 @@ package layouts import "fyne.io/fyne/v2" +// ColumnsLayout lays out a number of items into columns. +// There are two types of columns: fixed-width and variable width. +// A fixed width column is any with a non-negative width and will +// be laid out with that width. A variable width column is created +// by using any negative number as its width. Variable width columns +// are all laid out with the same width, splitting the "leftover" space +// equally between themselves after accounting for the fixed-width columns. +// Hidden items are not shown and take up 0 space. type ColumnsLayout struct { ColumnWidths []float32 } diff --git a/ui/layouts/leftmiddlerightlayout.go b/ui/layouts/leftmiddlerightlayout.go index f18da27..2aeccda 100644 --- a/ui/layouts/leftmiddlerightlayout.go +++ b/ui/layouts/leftmiddlerightlayout.go @@ -6,6 +6,9 @@ import ( "fyne.io/fyne/v2/theme" ) +// Lays out up to 3 objects such that the middle object, Objects[1], +// is centered in the available space and takes up a fixed width. +// The left, and right (if non-nil), split the leftover space equally. type LeftMiddleRightLayout struct { middleWidth float32 hbox fyne.Layout