widget

package
v2.0.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HideWidget

func HideWidget(b *Base, w fyne.Widget)

HideWidget is a helper method to hide and refresh a widget.

func MinSizeOf

func MinSizeOf(w fyne.Widget) fyne.Size

MinSizeOf is a helper method to get the minSize of a widget.

func MoveWidget

func MoveWidget(b *Base, w fyne.Widget, pos fyne.Position)

MoveWidget is a helper method to set the position of a widget relative to its parent.

func RefreshWidget

func RefreshWidget(w fyne.Widget)

RefreshWidget is a helper method to refresh a widget.

func ResizeWidget

func ResizeWidget(b *Base, w fyne.Widget, size fyne.Size)

ResizeWidget is a helper method to resize a widget.

func ShowWidget

func ShowWidget(b *Base, w fyne.Widget)

ShowWidget is a helper method to show and refresh a widget.

Types

type Base

type Base struct {
	// contains filtered or unexported fields
}

Base is a simple base widget for internal use.

func (*Base) Position

func (b *Base) Position() fyne.Position

Position returns the position of the widget relative to its parent.

Implements: fyne.Widget

func (*Base) Size

func (b *Base) Size() fyne.Size

Size returns the current size of the widget.

Implements: fyne.Widget

func (*Base) Visible

func (b *Base) Visible() bool

Visible returns whether the widget is visible or not.

Implements: fyne.Widget

type BaseRenderer

type BaseRenderer struct {
	// contains filtered or unexported fields
}

BaseRenderer is a renderer base providing the most common implementations of a part of the widget.Renderer interface.

func NewBaseRenderer

func NewBaseRenderer(objects []fyne.CanvasObject) BaseRenderer

NewBaseRenderer creates a new BaseRenderer.

func (*BaseRenderer) Destroy

func (r *BaseRenderer) Destroy()

Destroy does nothing in the base implementation.

Implements: fyne.WidgetRenderer

func (*BaseRenderer) Objects

func (r *BaseRenderer) Objects() []fyne.CanvasObject

Objects returns the objects that should be rendered.

Implements: fyne.WidgetRenderer

func (*BaseRenderer) SetObjects

func (r *BaseRenderer) SetObjects(objects []fyne.CanvasObject)

SetObjects updates the objects of the renderer.

type ElevationLevel

type ElevationLevel int

ElevationLevel is the level of elevation of the shadow casting object.

const (
	BaseLevel             ElevationLevel = 0
	CardLevel             ElevationLevel = 1
	ButtonLevel           ElevationLevel = 2
	MenuLevel             ElevationLevel = 4
	PopUpLevel            ElevationLevel = 8
	SubmergedContentLevel ElevationLevel = 8
	DialogLevel           ElevationLevel = 24
)

ElevationLevel constants inspired by: https://storage.googleapis.com/spec-host/mio-staging%2Fmio-design%2F1584058305895%2Fassets%2F0B6xUSjjSulxceF9udnA4Sk5tdU0%2Fbaselineelevation-chart.png

type OverlayContainer

type OverlayContainer struct {
	Base
	Content fyne.CanvasObject
	// contains filtered or unexported fields
}

OverlayContainer is a transparent widget containing one fyne.CanvasObject and meant to be used as overlay.

func NewOverlayContainer

func NewOverlayContainer(c fyne.CanvasObject, canvas fyne.Canvas, onDismiss func()) *OverlayContainer

NewOverlayContainer creates an OverlayContainer.

func (*OverlayContainer) CreateRenderer

func (o *OverlayContainer) CreateRenderer() fyne.WidgetRenderer

CreateRenderer returns a new renderer for the overlay container.

Implements: fyne.Widget

func (*OverlayContainer) Hide

func (o *OverlayContainer) Hide()

Hide hides the overlay container.

Implements: fyne.Widget

func (*OverlayContainer) MinSize

func (o *OverlayContainer) MinSize() fyne.Size

MinSize returns the minimal size of the overlay container. This is the same as the size of the canvas.

Implements: fyne.Widget

func (*OverlayContainer) MouseIn

func (o *OverlayContainer) MouseIn(*desktop.MouseEvent)

MouseIn catches mouse-in events not handled by the container’s content. It does nothing.

Implements: desktop.Hoverable

func (*OverlayContainer) MouseMoved

func (o *OverlayContainer) MouseMoved(*desktop.MouseEvent)

MouseMoved catches mouse-moved events not handled by the container’s content. It does nothing.

Implements: desktop.Hoverable

func (*OverlayContainer) MouseOut

func (o *OverlayContainer) MouseOut()

MouseOut catches mouse-out events not handled by the container’s content. It does nothing.

Implements: desktop.Hoverable

func (*OverlayContainer) Move

func (o *OverlayContainer) Move(pos fyne.Position)

Move sets the position of the widget relative to its parent.

Implements: fyne.Widget

func (*OverlayContainer) Refresh

func (o *OverlayContainer) Refresh()

Refresh triggers a redraw of the overlay container.

Implements: fyne.Widget

func (*OverlayContainer) Resize

func (o *OverlayContainer) Resize(size fyne.Size)

Resize changes the size of the overlay container. This is normally called by the canvas overlay management.

Implements: fyne.Widget

func (*OverlayContainer) Show

func (o *OverlayContainer) Show()

Show makes the overlay container visible.

Implements: fyne.Widget

func (*OverlayContainer) Tapped

func (o *OverlayContainer) Tapped(*fyne.PointEvent)

Tapped catches tap events not handled by the container’s content. It performs the overlay container’s dismiss action.

Implements: fyne.Tappable

type Scroll

type Scroll struct {
	Base

	Direction ScrollDirection
	Content   fyne.CanvasObject
	Offset    fyne.Position
	// OnScrolled can be set to be notified when the Scroll has changed position.
	// You should not update the Scroll.Offset from this method.
	//
	// Since: 2.0
	OnScrolled func(fyne.Position)
	// contains filtered or unexported fields
}

Scroll defines a container that is smaller than the Content. The Offset is used to determine the position of the child widgets within the container.

func NewHScroll

func NewHScroll(content fyne.CanvasObject) *Scroll

NewHScroll create a scrollable parent wrapping the specified content. Note that this may cause the MinSize.Width to be smaller than that of the passed object.

func NewScroll

func NewScroll(content fyne.CanvasObject) *Scroll

NewScroll creates a scrollable parent wrapping the specified content. Note that this may cause the MinSize to be smaller than that of the passed object.

func NewVScroll

func NewVScroll(content fyne.CanvasObject) *Scroll

NewVScroll create a scrollable parent wrapping the specified content. Note that this may cause the MinSize.Height to be smaller than that of the passed object.

func (*Scroll) CreateRenderer

func (s *Scroll) CreateRenderer() fyne.WidgetRenderer

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

func (*Scroll) DragEnd

func (s *Scroll) DragEnd()

DragEnd will stop scrolling on mobile has stopped

func (*Scroll) Dragged

func (s *Scroll) Dragged(e *fyne.DragEvent)

Dragged will scroll on any drag - bar or otherwise - for mobile

func (*Scroll) Hide

func (s *Scroll) Hide()

Hide hides the shadow.

Implements: fyne.Widget

func (*Scroll) MinSize

func (s *Scroll) MinSize() fyne.Size

MinSize returns the smallest size this widget can shrink to

func (*Scroll) Move

func (s *Scroll) Move(pos fyne.Position)

Move sets the position of the widget relative to its parent.

Implements: fyne.Widget

func (*Scroll) Refresh

func (s *Scroll) Refresh()

Refresh causes this widget to be redrawn in it's current state

func (*Scroll) Resize

func (s *Scroll) Resize(size fyne.Size)

Resize sets a new size for the scroll container.

func (*Scroll) ScrollToBottom

func (s *Scroll) ScrollToBottom()

ScrollToBottom will scroll content to container bottom - to show latest info which end user just added

func (*Scroll) ScrollToTop

func (s *Scroll) ScrollToTop()

ScrollToTop will scroll content to container top

func (*Scroll) Scrolled

func (s *Scroll) Scrolled(ev *fyne.ScrollEvent)

Scrolled is called when an input device triggers a scroll event

func (*Scroll) SetMinSize

func (s *Scroll) SetMinSize(size fyne.Size)

SetMinSize specifies a minimum size for this scroll container. If the specified size is larger than the content size then scrolling will not be enabled This can be helpful to appear larger than default if the layout is collapsing this widget.

func (*Scroll) Show

func (s *Scroll) Show()

Show makes the shadow visible.

Implements: fyne.Widget

type ScrollDirection

type ScrollDirection int

ScrollDirection represents the directions in which a Scroll can scroll its child content.

const (
	// ScrollBoth supports horizontal and vertical scrolling.
	ScrollBoth ScrollDirection = iota
	// ScrollHorizontalOnly specifies the scrolling should only happen left to right.
	ScrollHorizontalOnly
	// ScrollVerticalOnly specifies the scrolling should only happen top to bottom.
	ScrollVerticalOnly
	// ScrollNone turns off scrolling for this container.
	//
	// Since: 2.0
	ScrollNone
)

Constants for valid values of ScrollDirection.

type Shadow

type Shadow struct {
	Base
	// contains filtered or unexported fields
}

Shadow is a widget that renders a shadow.

func NewShadow

func NewShadow(typ ShadowType, level ElevationLevel) *Shadow

NewShadow create a new Shadow.

func (*Shadow) CreateRenderer

func (s *Shadow) CreateRenderer() fyne.WidgetRenderer

CreateRenderer returns a new renderer for the shadow.

Implements: fyne.Widget

func (*Shadow) Hide

func (s *Shadow) Hide()

Hide hides the shadow.

Implements: fyne.Widget

func (*Shadow) MinSize

func (s *Shadow) MinSize() fyne.Size

MinSize returns the minimal size of the shadow.

Implements: fyne.Widget

func (*Shadow) Move

func (s *Shadow) Move(pos fyne.Position)

Move sets the position of the widget relative to its parent.

Implements: fyne.Widget

func (*Shadow) Refresh

func (s *Shadow) Refresh()

Refresh triggers a redraw of the shadow.

Implements: fyne.Widget

func (*Shadow) Resize

func (s *Shadow) Resize(size fyne.Size)

Resize changes the size of the shadow.

Implements: fyne.Widget

func (*Shadow) Show

func (s *Shadow) Show()

Show makes the shadow visible.

Implements: fyne.Widget

type ShadowType

type ShadowType int

ShadowType specifies the type of the shadow.

const (
	ShadowAround ShadowType = iota
	ShadowLeft
	ShadowRight
	ShadowBottom
	ShadowTop
)

ShadowType constants

type ShadowingRenderer

type ShadowingRenderer struct {
	BaseRenderer
	// contains filtered or unexported fields
}

ShadowingRenderer is a renderer that adds a shadow arount the rendered content. When using the ShadowingRenderer the embedding renderer should call LayoutShadow(contentSize, contentPos) to lay out the shadow.

func NewShadowingRenderer

func NewShadowingRenderer(objects []fyne.CanvasObject, level ElevationLevel) *ShadowingRenderer

NewShadowingRenderer creates a ShadowingRenderer.

func (*ShadowingRenderer) LayoutShadow

func (r *ShadowingRenderer) LayoutShadow(size fyne.Size, pos fyne.Position)

LayoutShadow adjusts the size and position of the shadow if necessary.

func (*ShadowingRenderer) SetObjects

func (r *ShadowingRenderer) SetObjects(objects []fyne.CanvasObject)

SetObjects updates the renderer's objects including the shadow if necessary.

Jump to

Keyboard shortcuts

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