widget

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Repaint

func Repaint(obj fyne.CanvasObject)

Repaint instructs the containing canvas to redraw, even if nothing changed. This method is a duplicate of what is in `canvas/canvas.go` to avoid a dependency loop or public API.

Types

type Base

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

Base provides a helper that handles basic widget behaviours.

func (*Base) ExtendBaseWidget

func (w *Base) ExtendBaseWidget(wid fyne.Widget)

ExtendBaseWidget is used by an extending widget to make use of BaseWidget functionality.

func (*Base) Hide

func (w *Base) Hide()

Hide this widget so it is no longer visible

func (*Base) MinSize

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

MinSize for the widget - it should never be resized below this value.

func (*Base) Move

func (w *Base) Move(pos fyne.Position)

Move the widget to a new position, relative to its parent. Note this should not be used if the widget is being managed by a Layout within a Container.

func (*Base) Position

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

Position gets the current position of this widget, relative to its parent.

func (*Base) Refresh

func (w *Base) Refresh()

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

func (*Base) Resize

func (w *Base) Resize(size fyne.Size)

Resize sets a new size for a widget. Note this should not be used if the widget is being managed by a Layout within a Container.

func (*Base) Show

func (w *Base) Show()

Show this widget so it becomes visible

func (*Base) Size

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

Size gets the current size of this widget.

func (*Base) Visible

func (w *Base) Visible() bool

Visible returns whether or not this widget should be visible. Note that this may not mean it is currently visible if a parent has been hidden.

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

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

MinSize returns the smallest size this widget can shrink to

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(sz fyne.Size)

Resize is called when this scroller should change size. We refresh to ensure the scroll bars are updated.

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.

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

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

func (r *ShadowingRenderer) RefreshShadow()

RefreshShadow asks the shadow graphical element to update to current theme

func (*ShadowingRenderer) SetObjects

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

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

type SimpleRenderer

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

SimpleRenderer is a basic renderer that satisfies widget.Renderer interface by wrapping a single fyne.CanvasObject.

Since: 2.1

func NewSimpleRenderer

func NewSimpleRenderer(object fyne.CanvasObject) *SimpleRenderer

NewSimpleRenderer creates a new SimpleRenderer to render a widget using a single CanvasObject.

Since: 2.1

func (*SimpleRenderer) Destroy

func (r *SimpleRenderer) Destroy()

Destroy does nothing in this implementation.

Implements: fyne.WidgetRenderer

Since: 2.1

func (*SimpleRenderer) Layout

func (r *SimpleRenderer) Layout(s fyne.Size)

Layout updates the contained object to be the requested size.

Implements: fyne.WidgetRenderer

Since: 2.1

func (*SimpleRenderer) MinSize

func (r *SimpleRenderer) MinSize() fyne.Size

MinSize returns the smallest size that this render can use, returned from the underlying object.

Implements: fyne.WidgetRenderer

Since: 2.1

func (*SimpleRenderer) Objects

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

Objects returns the objects that should be rendered.

Implements: fyne.WidgetRenderer

Since: 2.1

func (*SimpleRenderer) Refresh

func (r *SimpleRenderer) Refresh()

Refresh requests the underlying object to redraw.

Implements: fyne.WidgetRenderer

Since: 2.1

Jump to

Keyboard shortcuts

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