Completed documentation for Scrollbar

This commit is contained in:
Sasha Koshka 2023-09-14 21:49:45 -04:00
parent c9e556f47b
commit 71bc235c0e

View File

@ -6,6 +6,8 @@ import "git.tebibyte.media/tomo/tomo/theme"
import "git.tebibyte.media/tomo/tomo/input" import "git.tebibyte.media/tomo/tomo/input"
import "git.tebibyte.media/tomo/tomo/event" import "git.tebibyte.media/tomo/tomo/event"
// Scrollbar is a special type of slider that can control the scroll of any
// overflowing ContainerBox.
type Scrollbar struct { type Scrollbar struct {
tomo.ContainerBox tomo.ContainerBox
handle *SliderHandle handle *SliderHandle
@ -49,14 +51,18 @@ func newScrollbar (orient string) *Scrollbar {
return this return this
} }
// NewVerticalScrollbar creates a new vertical scrollbar.
func NewVerticalScrollbar () *Scrollbar { func NewVerticalScrollbar () *Scrollbar {
return newScrollbar("vertical") return newScrollbar("vertical")
} }
// NewHorizontalScrollbar creates a new horizontal scrollbar.
func NewHorizontalScrollbar () *Scrollbar { func NewHorizontalScrollbar () *Scrollbar {
return newScrollbar("horizontal") return newScrollbar("horizontal")
} }
// Link assigns this scrollbar to a ContentBox. Closing the returned cookie will
// unlink it.
func (this *Scrollbar) Link (box tomo.ContentBox) event.Cookie { func (this *Scrollbar) Link (box tomo.ContentBox) event.Cookie {
this.layout.linked = box this.layout.linked = box
this.linkCookie = this.newLinkCookie ( this.linkCookie = this.newLinkCookie (