widgets

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package widgets is wayle-widgets: the controls the shell surfaces and the settings app share.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Center

func Center(w widget.Widget) widget.Widget

Center keeps w at its natural size in the middle of the space its parent gives it (halign and valign center) and returns it.

func ChoiceRows

func ChoiceRows(font render.Font, choices []portalreq.Choice, class string) ([]widget.Widget, func() []portalreq.Selection)

ChoiceRows builds a row per portal choice, a check button for a yes/no and a labelled dropdown otherwise, each starting at its choice's start value, and the function reading what the user picked. The rows carry class and their labels class+"-label".

Types

type DebouncedSlider

type DebouncedSlider struct {
	*widget.Box
	// Knob is the slider itself (class it, read it).
	Knob *pressSlider

	// Format renders the value label (default "{:.0}%").
	Format func(float64) string

	// OnCommit hears the throttled user commits.
	OnCommit func(float64)
	// OnValue sees every value change, the user's and set's alike
	// (the value-changed notify a #[watch] reads).
	OnValue func(float64)
	// contains filtered or unexported fields
}

DebouncedSlider is wayle-widgets' DebouncedSlider: a slider with an optional value label that commits (backend writes) at most every 100ms while dragged, with a trailing commit of the last value and one on release, and ignores external values while held and for 150ms after.

func NewDebouncedSlider

func NewDebouncedSlider(value float64, font render.Font, px float64, color render.Color, invoke func(func())) *DebouncedSlider

NewDebouncedSlider builds a 0-100 slider (every lys-shell slider is a percentage); with a font the value label shows (format, default "{:.0}%"). invoke runs the trailing commit on the loop.

func NewRangedSlider

func NewRangedSlider(min, max, value float64, font render.Font, px float64, color render.Color, invoke func(func())) *DebouncedSlider

NewRangedSlider is NewDebouncedSlider over [min, max].

func (*DebouncedSlider) Label

func (d *DebouncedSlider) Label() *widget.Label

Label is the value label, nil without a font.

func (*DebouncedSlider) Set

func (d *DebouncedSlider) Set(v float64)

Set is set_value_external: an outside value, ignored while the user interacts.

func (*DebouncedSlider) SetClock

func (d *DebouncedSlider) SetClock(now func() time.Time)

SetClock replaces the clock the throttle and the release grace read (a test seam).

func (*DebouncedSlider) SetFormat

func (d *DebouncedSlider) SetFormat(format func(float64) string)

SetFormat replaces the value label's format and re-renders it.

func (*DebouncedSlider) Value

func (d *DebouncedSlider) Value() float64

Value is the slider's current value.

func (*DebouncedSlider) ValueLabel

func (d *DebouncedSlider) ValueLabel() *widget.Label

ValueLabel hands back the formatted value label, for the caller to class the way its stylesheet names it (audio-slider-value, brightness-slider-value, ...).

type Pinned

type Pinned struct {
	widget.Base
	// contains filtered or unexported fields
}

Pinned holds a child at an exact size on each non-zero axis, the extent GTK reaches with a size request where the content measures smaller and a clip where it measures larger: the file chooser's resizable columns and HiDPI thumbnails, a portal header image. A zero axis keeps the child's natural extent. (Minimum sizes are lys-ui's SetSizeRequest; this is for boxes that must not grow.)

func NewPinned

func NewPinned(child widget.Widget, w, h int) *Pinned

NewPinned wraps child at w x h (0 = natural).

func (*Pinned) Arrange

func (f *Pinned) Arrange(r render.Rect)

Arrange gives the child the whole rect.

func (*Pinned) ArrangeRoot

func (f *Pinned) ArrangeRoot(r render.Rect)

ArrangeRoot mirrors Arrange for the tree-root path.

func (*Pinned) Children

func (f *Pinned) Children() []widget.Widget

Children exposes the child for focus traversal.

func (*Pinned) HitTest

func (f *Pinned) HitTest(pt widget.Point) widget.Widget

HitTest forwards to the child.

func (*Pinned) Measure

func (f *Pinned) Measure(con widget.Constraints) widget.Size

Measure reports the pinned axes and the child's natural others.

func (*Pinned) Paint

func (f *Pinned) Paint(cv *render.Canvas)

Paint paints the child.

func (*Pinned) SetSize

func (f *Pinned) SetSize(w, h int)

SetSize re-pins the size (a column dragged wider).

func (*Pinned) Size

func (f *Pinned) Size() (w, h int)

Size is the pinned size.

Jump to

Keyboard shortcuts

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