widget

package
v0.0.0-...-d5a0809 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2024 License: BSD-3-Clause Imports: 28 Imported by: 22

Documentation

Overview

Package widget contains community extensions for Fyne widgets

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnimatedGif

type AnimatedGif struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

AnimatedGif widget shows a Gif image with many frames.

func NewAnimatedGif

func NewAnimatedGif(u fyne.URI) (*AnimatedGif, error)

NewAnimatedGif creates a new widget loaded to show the specified image. If there is an error loading the image it will be returned in the error value.

func NewAnimatedGifFromResource

func NewAnimatedGifFromResource(r fyne.Resource) (*AnimatedGif, error)

NewAnimatedGifFromResource creates a new widget loaded to show the specified image resource. If there is an error loading the image it will be returned in the error value.

func (*AnimatedGif) CreateRenderer

func (g *AnimatedGif) CreateRenderer() fyne.WidgetRenderer

CreateRenderer loads the widget renderer for this widget. This is an internal requirement for Fyne.

func (*AnimatedGif) Load

func (g *AnimatedGif) Load(u fyne.URI) error

Load is used to change the gif file shown. It will change the loaded content and prepare the new frames for animation.

func (*AnimatedGif) LoadResource

func (g *AnimatedGif) LoadResource(r fyne.Resource) error

LoadResource is used to change the gif resource shown. It will change the loaded content and prepare the new frames for animation.

func (*AnimatedGif) MinSize

func (g *AnimatedGif) MinSize() fyne.Size

MinSize returns the minimum size that this GIF can occupy. Because gif images are measured in pixels we cannot use the dimensions, so this defaults to 0x0. You can set a minimum size if required using SetMinSize.

func (*AnimatedGif) SetMinSize

func (g *AnimatedGif) SetMinSize(min fyne.Size)

SetMinSize sets the smallest possible size that this AnimatedGif should be drawn at. Be careful not to set this based on pixel sizes as that will vary based on output device.

func (*AnimatedGif) Start

func (g *AnimatedGif) Start()

Start begins the animation. The speed of the transition is controlled by the loaded gif file.

func (*AnimatedGif) Stop

func (g *AnimatedGif) Stop()

Stop will request that the animation stops running, the last frame will remain visible

type Calendar

type Calendar struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

Calendar creates a new date time picker which returns a time object

func NewCalendar

func NewCalendar(cT time.Time, onSelected func(time.Time)) *Calendar

NewCalendar creates a calendar instance

func (*Calendar) CreateRenderer

func (c *Calendar) CreateRenderer() fyne.WidgetRenderer

CreateRenderer returns a new WidgetRenderer for this widget. This should not be called by regular code, it is used internally to render a widget.

type CompletionEntry

type CompletionEntry struct {
	widget.Entry

	Options []string

	CustomCreate func() fyne.CanvasObject
	CustomUpdate func(id widget.ListItemID, object fyne.CanvasObject)
	// contains filtered or unexported fields
}

CompletionEntry is an Entry with options displayed in a PopUpMenu.

func NewCompletionEntry

func NewCompletionEntry(options []string) *CompletionEntry

NewCompletionEntry creates a new CompletionEntry which creates a popup menu that responds to keystrokes to navigate through the items without losing the editing ability of the text input.

func (*CompletionEntry) HideCompletion

func (c *CompletionEntry) HideCompletion()

HideCompletion hides the completion menu.

func (*CompletionEntry) Move

func (c *CompletionEntry) Move(pos fyne.Position)

Move changes the relative position of the select entry.

Implements: fyne.Widget

func (*CompletionEntry) Refresh

func (c *CompletionEntry) Refresh()

Refresh the list to update the options to display.

func (*CompletionEntry) SetOptions

func (c *CompletionEntry) SetOptions(itemList []string)

SetOptions set the completion list with itemList and update the view.

func (*CompletionEntry) ShowCompletion

func (c *CompletionEntry) ShowCompletion()

ShowCompletion displays the completion menu

type FileTree

type FileTree struct {
	widget.Tree
	Filter       storage.FileFilter
	ShowRootPath bool
	Sorter       func(fyne.URI, fyne.URI) bool
	// contains filtered or unexported fields
}

FileTree extends widget.Tree to display a file system hierarchy.

func NewFileTree

func NewFileTree(root fyne.URI) *FileTree

NewFileTree creates a new FileTree from the given root URI.

type GridWrap deprecated

type GridWrap struct {
	widget.BaseWidget

	Length     func() int                                      `json:"-"`
	CreateItem func() fyne.CanvasObject                        `json:"-"`
	UpdateItem func(id GridWrapItemID, item fyne.CanvasObject) `json:"-"`
	// contains filtered or unexported fields
}

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.

Deprecated: Since Fyne 2.4, GridWrap is available in Fyne core

func NewGridWrap deprecated

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.

Deprecated: Since Fyne 2.4, GridWrap is available in Fyne core

func NewGridWrapWithData deprecated

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.

Deprecated: Since Fyne 2.4, GridWrap is available in Fyne core

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) 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) 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

type GridWrapItemID

type GridWrapItemID = int

GridWrapItemID is the ID of an individual item in the GridWrap widget.

type HexWidget

type HexWidget struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

HexWidget represents a 7-segment hexadecimal display. The segments of the display mapped active-low onto 7 state bits, with segment 0 in the least significant bit.

     0
   -----
  |     |
5 |     | 1
  |  6  |
   -----
  |     |
4 |     | 2
  |  3  |
   -----

func NewHexWidget

func NewHexWidget() *HexWidget

NewHexWidget instantiates a new widget instance, with all of the segments disabled.

func (*HexWidget) CreateRenderer

func (h *HexWidget) CreateRenderer() fyne.WidgetRenderer

CreateRenderer implements fyne.Widget

func (*HexWidget) Set

func (h *HexWidget) Set(val uint)

Set updates the hex widget to show a specific number between 0 and 15, which will be rendered in hexadecimal in 0...f. If the number is greater than 15, it will be modulo-ed by 16.

func (*HexWidget) SetOffColor

func (h *HexWidget) SetOffColor(c color.Color)

SetOffColor changes the color that segments are shown as when they are inactive/off.

func (*HexWidget) SetOnColor

func (h *HexWidget) SetOnColor(c color.Color)

SetOnColor changes the color that segments are shown as when they are active/on.

func (*HexWidget) SetSize

func (h *HexWidget) SetSize(s fyne.Size)

SetSize changes the size of the hex widget.

func (*HexWidget) SetSlant

func (h *HexWidget) SetSlant(s float32)

SetSlant changes the amount of "slant" in the hex widgets. The topmost segment is offset by slant many units to the right. A value of 0 means no slant at all. For example, setting the slant equal to the height should result in a 45 degree angle.

func (*HexWidget) UpdateSegments

func (h *HexWidget) UpdateSegments(segments uint8)

UpdateSegments changes the state of the segments and causes the widget to refresh so the changes are visible to the user. Segments values are packed into the 8-bit segments integer, see the documentation for HexWidget for more information on the appropriate packing.

type Map

type Map struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

Map widget renders an interactive map using OpenStreetMap tile data.

func NewMap

func NewMap() *Map

NewMap creates a new instance of the map widget.

func NewMapWithOptions

func NewMapWithOptions(opts ...MapOption) *Map

NewMapWithOptions creates a new instance of the map widget with provided map options.

func (*Map) CreateRenderer

func (m *Map) CreateRenderer() fyne.WidgetRenderer

CreateRenderer returns the renderer for this widget. A map renderer is simply the map Raster with user interface elements overlaid.

func (*Map) MinSize

func (m *Map) MinSize() fyne.Size

MinSize returns the smallest possible size for a widget. For our map this is a constant size representing a single tile on a device with the highest known DPI (4x).

func (*Map) PanEast

func (m *Map) PanEast()

PanEast will move the map to the East by 1 tile.

func (*Map) PanNorth

func (m *Map) PanNorth()

PanNorth will move the map to the North by 1 tile.

func (*Map) PanSouth

func (m *Map) PanSouth()

PanSouth will move the map to the South by 1 tile.

func (*Map) PanWest

func (m *Map) PanWest()

PanWest will move the map to the west by 1 tile.

func (*Map) Zoom

func (m *Map) Zoom(zoom int)

Zoom sets the zoom level to a specific value, between 0 and 19.

func (*Map) ZoomIn

func (m *Map) ZoomIn()

ZoomIn steps the scale of this map to be one step zoomed in.

func (*Map) ZoomOut

func (m *Map) ZoomOut()

ZoomOut steps the scale of this map to be one step zoomed out.

type MapOption

type MapOption func(*Map)

MapOption configures the provided map with different features.

func WithAttribution

func WithAttribution(enable bool, label, url string) MapOption

WithAttribution configures the map widget to display an attribution.

func WithHTTPClient

func WithHTTPClient(client *http.Client) MapOption

WithHTTPClient configures the map to use a custom http client.

func WithOsmTiles

func WithOsmTiles() MapOption

WithOsmTiles configures the map to use osm tile source.

func WithScrollButtons

func WithScrollButtons(enable bool) MapOption

WithScrollButtons enables or disables map scroll controls.

func WithTileSource

func WithTileSource(tileSource string) MapOption

WithTileSource configures the map to use a custom tile source.

func WithZoomButtons

func WithZoomButtons(enable bool) MapOption

WithZoomButtons enables or disables zoom controls.

type NumericalEntry

type NumericalEntry struct {
	widget.Entry
	AllowFloat bool
}

NumericalEntry is an extended entry that only allows numerical input. Only integers are allowed by default. Support for floats can be enabled by setting AllowFloat.

func NewNumericalEntry

func NewNumericalEntry() *NumericalEntry

NewNumericalEntry returns an extended entry that only allows numerical input.

func (*NumericalEntry) Keyboard

func (e *NumericalEntry) Keyboard() mobile.KeyboardType

Keyboard sets up the right keyboard to use on mobile.

Implements: mobile.Keyboardable

func (*NumericalEntry) TypedRune

func (e *NumericalEntry) TypedRune(r rune)

TypedRune is called when this item receives a char event.

Implements: fyne.Focusable

func (*NumericalEntry) TypedShortcut

func (e *NumericalEntry) TypedShortcut(shortcut fyne.Shortcut)

TypedShortcut handles the registered shortcuts.

Implements: fyne.Shortcutable

Directories

Path Synopsis
geometry
Package geometry implements various useful geometric primitives.
Package geometry implements various useful geometric primitives.
geometry/r2
Package r2 implements operations relating to objects in R2.
Package r2 implements operations relating to objects in R2.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL