widget

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package widget defines UI widgets for the Fyne GUI toolkit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Badge

type Badge struct {
	*widget.Label
}

Badge is a variant of the Fyne label widget that renders a rounded box around the text. Badges are commonly used to display counts.

func NewBadge

func NewBadge(text string) *Badge

NewBadge returns a new instance of a Badge widget.

func (*Badge) CreateRenderer

func (w *Badge) CreateRenderer() fyne.WidgetRenderer

type Slider

type Slider struct {
	widget.BaseWidget

	OnChangeEnded func(float64)
	// contains filtered or unexported fields
}

Slider is a variant of the Fyne Slider widget that also displays the current value.

func NewSlider

func NewSlider(min, max float64) *Slider

NewSlider returns a new instance of a Slider widget.

func (*Slider) CreateRenderer

func (w *Slider) CreateRenderer() fyne.WidgetRenderer

func (*Slider) SetStep

func (w *Slider) SetStep(step float64)

SetStep sets a custom step for a slider.

func (*Slider) SetValue

func (w *Slider) SetValue(v float64)

SetValue set the value of a slider.

func (*Slider) Value

func (w *Slider) Value() float64

Value returns the current value of a slider.

type Switch

type Switch struct {
	widget.DisableableWidget
	OnChanged func(on bool)
	// contains filtered or unexported fields
}

Switch is a widget representing a digital switch with two mutually exclusive states: on/off.

func NewSwitch

func NewSwitch(changed func(on bool)) *Switch

NewSwitch returns a new Switch instance.

func (*Switch) CreateRenderer

func (w *Switch) CreateRenderer() fyne.WidgetRenderer

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

func (*Switch) Cursor

func (w *Switch) Cursor() desktop.Cursor

Cursor returns the cursor type of this widget

func (*Switch) FocusGained

func (w *Switch) FocusGained()

FocusGained is called when the Check has been given focus.

func (*Switch) FocusLost

func (w *Switch) FocusLost()

FocusLost is called when the Check has had focus removed.

func (*Switch) MinSize

func (w *Switch) MinSize() fyne.Size

MinSize returns the size that this widget should not shrink below

func (*Switch) MouseIn

func (w *Switch) MouseIn(me *desktop.MouseEvent)

MouseIn is a hook that is called if the mouse pointer enters the element.

func (*Switch) MouseMoved

func (w *Switch) MouseMoved(me *desktop.MouseEvent)

MouseMoved is called when a desktop pointer hovers over the widget

func (*Switch) MouseOut

func (w *Switch) MouseOut()

func (*Switch) SetState

func (w *Switch) SetState(on bool)

SetState sets the state for a switch.

func (*Switch) State

func (w *Switch) State() bool

State return the state of a switch.

func (*Switch) Tapped

func (w *Switch) Tapped(pe *fyne.PointEvent)

Tapped is called when a pointer tapped event is captured and triggers any change handler

func (*Switch) TappedSecondary

func (w *Switch) TappedSecondary(_ *fyne.PointEvent)

func (*Switch) TypedKey

func (w *Switch) TypedKey(key *fyne.KeyEvent)

TypedKey receives key input events when the Check is focused.

func (*Switch) TypedRune

func (w *Switch) TypedRune(r rune)

TypedRune receives text input events when the Check is focused.

type TappableIcon

type TappableIcon struct {
	*widget.Icon

	// The function that is called when the icon is tapped.
	OnTapped func()
	// contains filtered or unexported fields
}

TappableIcon is an icon widget, which runs a function when tapped.

func NewTappableIcon

func NewTappableIcon(res fyne.Resource, tapped func()) *TappableIcon

NewTappableIcon returns a new instance of a TappableIcon widget.

func (*TappableIcon) Cursor

func (w *TappableIcon) Cursor() desktop.Cursor

Cursor returns the cursor type of this widget

func (*TappableIcon) MouseIn

func (w *TappableIcon) MouseIn(e *desktop.MouseEvent)

MouseIn is a hook that is called if the mouse pointer enters the element.

func (*TappableIcon) MouseMoved

func (w *TappableIcon) MouseMoved(*desktop.MouseEvent)

func (*TappableIcon) MouseOut

func (w *TappableIcon) MouseOut()

MouseOut is a hook that is called if the mouse pointer leaves the element.

func (*TappableIcon) Tapped

func (w *TappableIcon) Tapped(_ *fyne.PointEvent)

func (*TappableIcon) TappedSecondary

func (w *TappableIcon) TappedSecondary(_ *fyne.PointEvent)

type TappableImage

type TappableImage struct {
	widget.BaseWidget

	// The function that is called when the label is tapped.
	OnTapped func()
	// contains filtered or unexported fields
}

TappableImage is widget which shows an image and runs a function when tapped.

func NewTappableImage

func NewTappableImage(res fyne.Resource, tapped func()) *TappableImage

NewTappableImage returns a new instance of a TappableImage widget.

func (*TappableImage) CreateRenderer

func (w *TappableImage) CreateRenderer() fyne.WidgetRenderer

func (*TappableImage) Cursor

func (w *TappableImage) Cursor() desktop.Cursor

Cursor returns the cursor type of this widget

func (*TappableImage) MouseIn

func (w *TappableImage) MouseIn(e *desktop.MouseEvent)

MouseIn is a hook that is called if the mouse pointer enters the element.

func (*TappableImage) MouseMoved

func (w *TappableImage) MouseMoved(*desktop.MouseEvent)

func (*TappableImage) MouseOut

func (w *TappableImage) MouseOut()

MouseOut is a hook that is called if the mouse pointer leaves the element.

func (*TappableImage) SetFillMode

func (w *TappableImage) SetFillMode(fillMode canvas.ImageFill)

SetFillMode sets the fill mode of the image.

func (*TappableImage) SetMinSize

func (w *TappableImage) SetMinSize(size fyne.Size)

SetMinSize sets the minimum size of the image.

func (*TappableImage) Tapped

func (w *TappableImage) Tapped(_ *fyne.PointEvent)

func (*TappableImage) TappedSecondary

func (w *TappableImage) TappedSecondary(_ *fyne.PointEvent)

type TappableLabel

type TappableLabel struct {
	*widget.Label

	// The function that is called when the label is tapped.
	OnTapped func()
	// contains filtered or unexported fields
}

TappableLabel is a variant of the Fyne Label which runs a function when tapped.

func NewTappableLabel

func NewTappableLabel(text string, tapped func()) *TappableLabel

NewTappableLabel returns a new TappableLabel instance.

func (*TappableLabel) Cursor

func (w *TappableLabel) Cursor() desktop.Cursor

Cursor returns the cursor type of this widget

func (*TappableLabel) MouseIn

func (w *TappableLabel) MouseIn(e *desktop.MouseEvent)

MouseIn is a hook that is called if the mouse pointer enters the element.

func (*TappableLabel) MouseMoved

func (w *TappableLabel) MouseMoved(*desktop.MouseEvent)

func (*TappableLabel) MouseOut

func (w *TappableLabel) MouseOut()

MouseOut is a hook that is called if the mouse pointer leaves the element.

func (*TappableLabel) Tapped

func (w *TappableLabel) Tapped(_ *fyne.PointEvent)

type Toggle

type Toggle struct {
	widget.DisableableWidget
	OnChanged func(on bool)

	On bool
	// contains filtered or unexported fields
}

Toggle is a widget implementing a digital switch with two mutually exclusive states: on/off.

func NewToggle deprecated

func NewToggle(changed func(on bool)) *Toggle

NewToggle returns a new Toggle instance.

Deprecated: Please use the [Switch] widget instead. This widget will be removed.

func (*Toggle) CreateRenderer

func (w *Toggle) CreateRenderer() fyne.WidgetRenderer

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

func (*Toggle) Cursor

func (w *Toggle) Cursor() desktop.Cursor

Cursor returns the cursor type of this widget

func (*Toggle) FocusGained

func (w *Toggle) FocusGained()

FocusGained is called when the Check has been given focus.

func (*Toggle) FocusLost

func (w *Toggle) FocusLost()

FocusLost is called when the Check has had focus removed.

func (*Toggle) MinSize

func (w *Toggle) MinSize() fyne.Size

MinSize returns the size that this widget should not shrink below

func (*Toggle) MouseIn

func (w *Toggle) MouseIn(e *desktop.MouseEvent)

MouseIn is a hook that is called if the mouse pointer enters the element.

func (*Toggle) MouseMoved

func (w *Toggle) MouseMoved(*desktop.MouseEvent)

MouseMoved is called when a desktop pointer hovers over the widget

func (*Toggle) MouseOut

func (w *Toggle) MouseOut()

MouseOut is a hook that is called if the mouse pointer leaves the element.

func (*Toggle) SetState

func (w *Toggle) SetState(on bool)

SetState sets the state for a toggle.

func (*Toggle) Tapped

func (w *Toggle) Tapped(_ *fyne.PointEvent)

Tapped is called when a pointer tapped event is captured and triggers any change handler

func (*Toggle) TappedSecondary

func (w *Toggle) TappedSecondary(_ *fyne.PointEvent)

func (*Toggle) TypedKey

func (w *Toggle) TypedKey(key *fyne.KeyEvent)

TypedKey receives key input events when the Check is focused.

func (*Toggle) TypedRune

func (w *Toggle) TypedRune(r rune)

TypedRune receives text input events when the Check is focused.

Jump to

Keyboard shortcuts

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