aboutsummaryrefslogtreecommitdiff
path: root/vendor/maunium.net/go/tview/flex.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/maunium.net/go/tview/flex.go')
-rw-r--r--vendor/maunium.net/go/tview/flex.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/vendor/maunium.net/go/tview/flex.go b/vendor/maunium.net/go/tview/flex.go
index ad42d3a..bc1cfe1 100644
--- a/vendor/maunium.net/go/tview/flex.go
+++ b/vendor/maunium.net/go/tview/flex.go
@@ -28,7 +28,7 @@ type Flex struct {
*Box
// The items to be positioned.
- items []flexItem
+ items []*flexItem
// FlexRow or FlexColumn.
direction int
@@ -79,7 +79,7 @@ func (f *Flex) SetFullScreen(fullScreen bool) *Flex {
// You can provide a nil value for the primitive. This will still consume screen
// space but nothing will be drawn.
func (f *Flex) AddItem(item Primitive, fixedSize, proportion int, focus bool) *Flex {
- f.items = append(f.items, flexItem{Item: item, FixedSize: fixedSize, Proportion: proportion, Focus: focus})
+ f.items = append(f.items, &flexItem{Item: item, FixedSize: fixedSize, Proportion: proportion, Focus: focus})
return f
}
@@ -94,6 +94,19 @@ func (f *Flex) RemoveItem(p Primitive) *Flex {
return f
}
+// ResizeItem sets a new size for the item(s) with the given primitive. If there
+// are multiple Flex items with the same primitive, they will all receive the
+// same size. For details regarding the size parameters, see AddItem().
+func (f *Flex) ResizeItem(p Primitive, fixedSize, proportion int) *Flex {
+ for _, item := range f.items {
+ if item.Item == p {
+ item.FixedSize = fixedSize
+ item.Proportion = proportion
+ }
+ }
+ return f
+}
+
// Draw draws this primitive onto the screen.
func (f *Flex) Draw(screen tcell.Screen) {
f.Box.Draw(screen)