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/event"
// Scrollbar is a special type of slider that can control the scroll of any
// overflowing ContainerBox.
type Scrollbar struct {
tomo.ContainerBox
handle *SliderHandle
@ -49,14 +51,18 @@ func newScrollbar (orient string) *Scrollbar {
return this
}
// NewVerticalScrollbar creates a new vertical scrollbar.
func NewVerticalScrollbar () *Scrollbar {
return newScrollbar("vertical")
}
// NewHorizontalScrollbar creates a new horizontal scrollbar.
func NewHorizontalScrollbar () *Scrollbar {
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 {
this.layout.linked = box
this.linkCookie = this.newLinkCookie (