shadow

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

README

The contents of this package are lifted from Fyne internal widget package

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
	ToolTipLevel          ElevationLevel = 4
	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 Shadow

type Shadow struct {
	widget.BaseWidget
	// 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.

Jump to

Keyboard shortcuts

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