Fyne API "widget.GridWrap"

widget.GridWrap


import "fyne.io/fyne/v2/widget"

Usage

type GridWrap

type GridWrap struct {
	BaseWidget

	Length       func() int                                      `json:"-"`
	CreateItem   func() fyne.CanvasObject                        `json:"-"`
	UpdateItem   func(id GridWrapItemID, item fyne.CanvasObject) `json:"-"`
	OnSelected   func(id GridWrapItemID)                         `json:"-"`
	OnUnselected func(id GridWrapItemID)                         `json:"-"`
}

GridWrap is a widget with an API very similar to widget.List, that lays out items in a scrollable wrapping grid similar to container.NewGridWrap. It caches and reuses widgets for performance.

Since: 2.4

func NewGridWrap

func NewGridWrap(length func() int, createItem func() fyne.CanvasObject, updateItem func(GridWrapItemID, fyne.CanvasObject)) *GridWrap

NewGridWrap creates and returns a GridWrap widget for displaying items in a wrapping grid layout with scrolling and caching for performance.

Since: 2.4

func NewGridWrapWithData

func NewGridWrapWithData(data binding.DataList, createItem func() fyne.CanvasObject, updateItem func(binding.DataItem, fyne.CanvasObject)) *GridWrap

NewGridWrapWithData creates a new GridWrap widget that will display the contents of the provided data.

Since: 2.4

func (*GridWrap) CreateRenderer

func (l *GridWrap) CreateRenderer() fyne.WidgetRenderer

CreateRenderer is a private method to Fyne which links this widget to its renderer.

func (*GridWrap) FocusGained

func (l *GridWrap) FocusGained()

FocusGained is called after this GridWrap has gained focus.

Implements: fyne.Focusable

func (*GridWrap) FocusLost

func (l *GridWrap) FocusLost()

FocusLost is called after this GridWrap has lost focus.

Implements: fyne.Focusable

func (*GridWrap) GetScrollOffset

func (l *GridWrap) GetScrollOffset() float32

GetScrollOffset returns the current scroll offset position

func (*GridWrap) MinSize

func (l *GridWrap) MinSize() fyne.Size

MinSize returns the size that this widget should not shrink below.

func (*GridWrap) RefreshItem

func (l *GridWrap) RefreshItem(id GridWrapItemID)

RefreshItem refreshes a single item, specified by the item ID passed in.

Since: 2.4

func (*GridWrap) Resize

func (l *GridWrap) Resize(s fyne.Size)

Resize is called when this GridWrap should change size. We refresh to ensure invisible items are drawn.

func (*GridWrap) ScrollTo

func (l *GridWrap) ScrollTo(id GridWrapItemID)

ScrollTo scrolls to the item represented by id

func (*GridWrap) ScrollToBottom

func (l *GridWrap) ScrollToBottom()

ScrollToBottom scrolls to the end of the list

func (*GridWrap) ScrollToOffset

func (l *GridWrap) ScrollToOffset(offset float32)

ScrollToOffset scrolls the list to the given offset position

func (*GridWrap) ScrollToTop

func (l *GridWrap) ScrollToTop()

ScrollToTop scrolls to the start of the list

func (*GridWrap) Select

func (l *GridWrap) Select(id GridWrapItemID)

Select adds the item identified by the given ID to the selection.

func (*GridWrap) TypedKey

func (l *GridWrap) TypedKey(event *fyne.KeyEvent)

TypedKey is called if a key event happens while this GridWrap is focused.

Implements: fyne.Focusable

func (*GridWrap) TypedRune

func (l *GridWrap) TypedRune(_ rune)

TypedRune is called if a text event happens while this GridWrap is focused.

Implements: fyne.Focusable

func (*GridWrap) Unselect

func (l *GridWrap) Unselect(id GridWrapItemID)

Unselect removes the item identified by the given ID from the selection.

func (*GridWrap) UnselectAll

func (l *GridWrap) UnselectAll()

UnselectAll removes all items from the selection.