scrollbar

package
v0.0.0-...-af996ba Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// StdTheme is the theme all new ScrollBars get by default.
	StdTheme = NewTheme()
)

Functions

This section is empty.

Types

type Pager

type Pager interface {
	// LineScrollAmount is called to determine how far to scroll in the given direction to reveal
	// a full 'line' of content. A positive value should be returned regardless of the direction,
	// although negative values will behave as if they were positive.
	LineScrollAmount(horizontal, towardsStart bool) float64
	// PageScrollAmount is called to determine how far to scroll in the given direction to reveal
	// a full 'page' of content. A positive value should be returned regardless of the direction,
	// although negative values will behave as if they were positive.
	PageScrollAmount(horizontal, towardsStart bool) float64
}

Pager objects can provide line and page information for scrolling.

type ScrollBar

type ScrollBar struct {
	widget.Block
	Target Scrollable // The target of the scrollbar.
	Theme  *Theme     // The theme the scrollbar will use to draw itself.
	// contains filtered or unexported fields
}

ScrollBar represents a widget for controlling scrolling.

func New

func New(horizontal bool, target Scrollable) *ScrollBar

New creates a new scrollbar.

func (*ScrollBar) SetScrolledPosition

func (sb *ScrollBar) SetScrolledPosition(position float64)

SetScrolledPosition attempts to set the current scrolled position of this ScrollBar to the specified value. The value will be clipped to the available range. If no target has been set, then nothing will happen.

func (*ScrollBar) Sizes

func (sb *ScrollBar) Sizes(hint geom.Size) (min, pref, max geom.Size)

Sizes implements the Sizer interface.

type Scrollable

type Scrollable interface {
	Pager
	// ScrolledPosition is called to determine the current position of the Scrollable.
	ScrolledPosition(horizontal bool) float64
	// SetScrolledPosition is called to set the current position of the Scrollable.
	SetScrolledPosition(horizontal bool, position float64)
	// VisibleSize is called to determine the size of the visible portion of the Scrollable.
	VisibleSize(horizontal bool) float64
	// ContentSize is called to determine the total size of the Scrollable.
	ContentSize(horizontal bool) float64
}

Scrollable objects can respond to ScrollBars.

type Theme

type Theme struct {
	InitialRepeatDelay    time.Duration // The amount of time to wait before triggering the first repeating event.
	RepeatDelay           time.Duration // The amount of time to wait before triggering a repeating event.
	Background            color.Color   // The background color when enabled but not pressed or focused.
	BackgroundWhenPressed color.Color   // The background color when enabled and pressed.
	MarkWhenLight         color.Color   // The color to use for control marks when the background is considered to be 'light'.
	MarkWhenDark          color.Color   // The color to use for control marks when the background is considered to be 'dark'.
	MarkWhenDisabled      color.Color   // The color to use for control marks when disabled.
	GradientAdjustment    float64       // The amount to vary the color when creating the background gradient.
	DisabledAdjustment    float64       // The amount to adjust the background brightness when disabled.
	OutlineAdjustment     float64       // The amount to adjust the background brightness when using it to draw the button outline.
	Size                  float64       // The height of a horizontal scrollbar or the width of a vertical scrollbar.
}

Theme contains the theme elements for ScrollBars.

func NewTheme

func NewTheme() *Theme

NewTheme creates a new image button theme.

func (*Theme) Gradient

func (theme *Theme) Gradient(base color.Color) *draw.Gradient

Gradient returns a gradient for the specified color.

func (*Theme) Init

func (theme *Theme) Init()

Init initializes the theme with its default values.

Jump to

Keyboard shortcuts

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