2022-10-16 08:07:13 -05:00
|
|
|
package toolkit
|
|
|
|
|
|
|
|
import "log"
|
2022-10-19 13:23:22 -05:00
|
|
|
import "os"
|
2022-10-16 08:07:13 -05:00
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
func (t Toolkit) NewSlider(title string, x int, y int) *Toolkit {
|
2022-10-16 08:07:13 -05:00
|
|
|
// make new node here
|
2022-10-20 06:55:42 -05:00
|
|
|
log.Println("gui.Toolkit.NewSpinbox()", x, y)
|
2022-10-19 13:23:22 -05:00
|
|
|
var newt Toolkit
|
2022-10-16 08:07:13 -05:00
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
if (t.uiBox == nil) {
|
2022-10-20 06:55:42 -05:00
|
|
|
log.Println("gui.ToolkitNode.NewGroup() node.UiBox == nil. I can't add a range UI element without a place to put it")
|
2022-10-19 13:23:22 -05:00
|
|
|
log.Println("probably could just make a box here?")
|
|
|
|
os.Exit(0)
|
|
|
|
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
|
|
|
}
|