widget

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 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) BackgroundColor

func (r *BaseRenderer) BackgroundColor() color.Color

BackgroundColor returns the theme background color.

Implements: fyne.WidgetRenderer

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