2022-11-14 14:30:28 -06:00
|
|
|
package main
|
2022-10-16 08:07:13 -05:00
|
|
|
|
2022-11-14 14:30:28 -06:00
|
|
|
import (
|
|
|
|
"git.wit.org/wit/gui/toolkit"
|
2022-10-16 08:07:13 -05:00
|
|
|
|
2022-11-14 14:30:28 -06:00
|
|
|
"github.com/andlabs/ui"
|
|
|
|
_ "github.com/andlabs/ui/winmanifest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (t andlabsT) NewSlider(title string, x int, y int) *andlabsT {
|
2022-10-16 08:07:13 -05:00
|
|
|
// make new node here
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "gui.Toolkit.NewSpinbox()", x, y)
|
2022-11-14 14:30:28 -06:00
|
|
|
var newt andlabsT
|
2022-10-16 08:07:13 -05:00
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
if (t.uiBox == nil) {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "gui.ToolkitNode.NewGroup() node.UiBox == nil. I can't add a range UI element without a place to put it")
|
|
|
|
log(debugToolkit, "probably could just make a box here?")
|
|
|
|
exit("internal golang wit/gui/toolkit error")
|
2022-10-19 13:23:22 -05:00
|
|
|
return nil
|
2022-10-16 08:07:13 -05:00
|
|
|
}
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2022-10-16 08:07:13 -05:00
|
|
|
s := ui.NewSlider(x, y)
|
2022-10-19 13:23:22 -05:00
|
|
|
newt.uiSlider = s
|
|
|
|
newt.uiBox = t.uiBox
|
2022-10-21 11:40:08 -05:00
|
|
|
t.uiBox.Append(s, stretchy)
|
2022-10-16 08:07:13 -05:00
|
|
|
|
|
|
|
s.OnChanged(func(spin *ui.Slider) {
|
2022-11-05 10:19:04 -05:00
|
|
|
newt.commonChange("Slider")
|
2022-10-16 08:07:13 -05:00
|
|
|
})
|
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
return &newt
|
2022-10-16 08:07:13 -05:00
|
|
|
}
|
2022-11-14 14:30:28 -06:00
|
|
|
|
|
|
|
func NewSlider(parentW *toolkit.Widget, w *toolkit.Widget) {
|
|
|
|
var newt *andlabsT
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "gui.andlabs.NewTab()", w.Name)
|
2022-11-14 14:30:28 -06:00
|
|
|
|
|
|
|
t := mapToolkits[parentW]
|
|
|
|
if (t == nil) {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "go.andlabs.NewTab() toolkit struct == nil. name=", parentW.Name, w.Name)
|
2022-11-14 14:30:28 -06:00
|
|
|
return
|
|
|
|
}
|
|
|
|
newt = t.NewSlider(w.Name, w.X, w.Y)
|
|
|
|
mapWidgetsToolkits(w, newt)
|
|
|
|
}
|