39 lines
728 B
Go
39 lines
728 B
Go
package objects
|
|
|
|
import "git.tebibyte.media/tomo/tomo"
|
|
import "git.tebibyte.media/tomo/tomo/theme"
|
|
|
|
|
|
type Slider struct {
|
|
tomo.ContainerBox
|
|
handle *SliderHandle
|
|
vertical bool
|
|
}
|
|
|
|
type SliderHandle struct {
|
|
tomo.Box
|
|
}
|
|
|
|
func newSlider (orient string) *Slider {
|
|
this := &Slider {
|
|
ContainerBox: tomo.NewContainerBox(),
|
|
handle: &SliderHandle {
|
|
Box: tomo.NewBox(),
|
|
},
|
|
vertical: orient == "vertical",
|
|
}
|
|
|
|
this.Add(this.handle)
|
|
theme.Apply(this.handle, theme.R("objects", "SliderHandle", orient))
|
|
theme.Apply(this, theme.R("objects", "Slider", orient))
|
|
return this
|
|
}
|
|
|
|
func NewVerticalSlider () *Slider {
|
|
return newSlider("vertical")
|
|
}
|
|
|
|
func NewHorizontalSlider () *Slider {
|
|
return newSlider("horizontal")
|
|
}
|