sbar

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: BSD-2-Clause Imports: 7 Imported by: 1

README

Overview

PkgGoDev

sbar is a fyne widge for scrollbar. example

Usage

following is an example of using a vertical scrollbar:

	win.scrollBar = sbar.NewSBar(win.onScrollChange, false)
	win.SetContent(fyne.NewContainerWithLayout(
		layout.NewBorderLayout(nil, nil, nil, win.scrollBar),
		win.scrollBar, somewidget))

function win.onScrollChange is called whenever scollbar is dragged

Documentation

Overview

Package sbar is a fyne widget for scroll bar;

Index

Constants

View Source
const (
	BarWidth  = 10
	BarHeight = 30
)

scroll bar size

View Source
const OffsetResolution = 100

OffsetResolution indicate max value of the scroll offset

Variables

This section is empty.

Functions

This section is empty.

Types

type OffsetChangeHandler

type OffsetChangeHandler func(newoffset uint32)

OffsetChangeHandler is the type handler function get called whenever scroller offset changes

type SBar

type SBar struct {
	widget.BaseWidget
	// contains filtered or unexported fields
}

SBar is the fyne widget for scroll bar

func NewSBar

func NewSBar(handler OffsetChangeHandler, h bool) *SBar

NewSBar returns a new scrollbar instance, with the specified handler function handler, could be nil; horizontal scrollbar if h is true, vertical otherwise;

func (*SBar) CreateRenderer

func (sbar *SBar) CreateRenderer() fyne.WidgetRenderer

CreateRenderer implments fyne.Widget interface

func (*SBar) DragEnd

func (sbar *SBar) DragEnd()

DragEnd implements fyne.Draggable interface

func (*SBar) Dragged

func (sbar *SBar) Dragged(evt *fyne.DragEvent)

Dragged implements fyne.Draggable interface

func (*SBar) GetOffset

func (sbar *SBar) GetOffset() uint32

GetOffset returns current offset

func (*SBar) IsHorizontal

func (sbar *SBar) IsHorizontal() bool

IsHorizontal returns true if it is horizontal scroll bar

func (*SBar) SetOffset

func (sbar *SBar) SetOffset(o uint32)

SetOffset set the scroll offset; note this function won't trigger the OffsetChangeHandler function

Jump to

Keyboard shortcuts

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