Fyne API "fyne.Container"

fyne.Container


import "fyne.io/fyne/v2"

Usage

type Container

type Container struct {
	Hidden bool // Is this Container hidden

	Layout Layout // The Layout algorithm for arranging child [CanvasObject]s

	Objects []CanvasObject // The set of [CanvasObject]s this container holds
}

Container is a [CanvasObject] that contains a collection of child objects. The layout of the children is set by the specified Layout.

func NewContainer

func NewContainer(objects ...CanvasObject) *Container

NewContainer returns a new [Container] instance holding the specified [CanvasObject]s.

Deprecated: Use [fyne.io/fyne/v2/container.NewWithoutLayout] to create a container that uses manual layout.

func NewContainerWithLayout

func NewContainerWithLayout(layout Layout, objects ...CanvasObject) *Container

NewContainerWithLayout returns a new [Container] instance holding the specified [CanvasObject]s which will be laid out according to the specified Layout.

Deprecated: Use [fyne.io/fyne/v2/container.New] instead.

func NewContainerWithoutLayout

func NewContainerWithoutLayout(objects ...CanvasObject) *Container

NewContainerWithoutLayout returns a new [Container] instance holding the specified [CanvasObject]s that are manually arranged.

Deprecated: Use [fyne.io/fyne/v2/container.NewWithoutLayout] instead.

func (*Container) Add

func (c *Container) Add(add CanvasObject)

Add appends the specified object to the items this container manages.

Since: 1.4

func (*Container) AddObject

func (c *Container) AddObject(o CanvasObject)

AddObject adds another [CanvasObject] to the set this Container holds.

Deprecated: Use [Container.Add] instead.

func (*Container) Hide

func (c *Container) Hide()

Hide sets this container, and all its children, to be not visible.

func (*Container) MinSize

func (c *Container) MinSize() Size

MinSize calculates the minimum size of c. This is delegated to the [Container.Layout], if specified, otherwise it will be calculated.

func (*Container) Move

func (c *Container) Move(pos Position)

Move the container (and all its children) to a new position, relative to its parent.

func (*Container) Position

func (c *Container) Position() Position

Position gets the current position of c relative to its parent.

func (*Container) Refresh

func (c *Container) Refresh()

Refresh causes this object to be redrawn in it’s current state

func (*Container) Remove

func (c *Container) Remove(rem CanvasObject)

Remove updates the contents of this container to no longer include the specified object. This method is not intended to be used inside a loop, to remove all the elements. It is much more efficient to call [Container.RemoveAll) instead.

func (*Container) RemoveAll

func (c *Container) RemoveAll()

RemoveAll updates the contents of this container to no longer include any objects.

Since: 2.2

func (*Container) Resize

func (c *Container) Resize(size Size)

Resize sets a new size for c.

func (*Container) Show

func (c *Container) Show()

Show sets this container, and all its children, to be visible.

func (*Container) Size

func (c *Container) Size() Size

Size returns the current size c.

func (*Container) Visible

func (c *Container) Visible() bool

Visible returns true if the container is currently visible, false otherwise.