Update Tomo API
This commit is contained in:
parent
6389556199
commit
bd9dbb762d
@ -31,8 +31,7 @@ func NewCheckbox (value bool) *Checkbox {
|
||||
func (this *Checkbox) SetValue (value bool) {
|
||||
this.value = value
|
||||
if this.value {
|
||||
// FIXME: we need checkbox icons
|
||||
this.SetTextureCenter(tomo.Icon("").Texture(tomo.IconSizeSmall))
|
||||
this.SetTextureCenter(tomo.IconCheckboxChecked.Texture(tomo.IconSizeSmall))
|
||||
} else {
|
||||
this.SetTextureCenter(nil)
|
||||
}
|
||||
|
@ -75,8 +75,7 @@ func NewDialog (kind DialogKind, parent tomo.Window, title, message string, opti
|
||||
// NewDialogOk creates a new dialog window with an OK option.
|
||||
func NewDialogOk (kind DialogKind, parent tomo.Window, title, message string, onOk func ()) (*Dialog, error) {
|
||||
okButton := NewButton("OK")
|
||||
// FIXME: need dialog accept/reject action icons
|
||||
// okButton.SetIcon(tomo.IconStatusOkay)
|
||||
okButton.SetIcon(tomo.IconDialogOkay)
|
||||
okButton.OnClick(func () {
|
||||
if onOk != nil { onOk() }
|
||||
})
|
||||
@ -88,12 +87,10 @@ func NewDialogOk (kind DialogKind, parent tomo.Window, title, message string, on
|
||||
// NewDialogOkCancel creates a new dialog window with OK and Cancel options.
|
||||
func NewDialogOkCancel (kind DialogKind, parent tomo.Window, title, message string, onOk func ()) (*Dialog, error) {
|
||||
cancelButton := NewButton("Cancel")
|
||||
// FIXME: need dialog accept/reject action icons
|
||||
// cancelButton.SetIcon(tomo.IconStatusCancel)
|
||||
cancelButton.SetIcon(tomo.IconDialogCancel)
|
||||
|
||||
okButton := NewButton("OK")
|
||||
// FIXME: need dialog accept/reject action icons
|
||||
// okButton.SetIcon(tomo.IconStatusOkay)
|
||||
okButton.SetIcon(tomo.IconDialogOkay)
|
||||
okButton.OnClick(func () {
|
||||
if onOk != nil { onOk() }
|
||||
})
|
||||
|
2
go.mod
2
go.mod
@ -2,6 +2,6 @@ module git.tebibyte.media/tomo/objects
|
||||
|
||||
go 1.20
|
||||
|
||||
require git.tebibyte.media/tomo/tomo v0.33.0
|
||||
require git.tebibyte.media/tomo/tomo v0.34.0
|
||||
|
||||
require golang.org/x/image v0.11.0 // indirect
|
||||
|
4
go.sum
4
go.sum
@ -1,5 +1,5 @@
|
||||
git.tebibyte.media/tomo/tomo v0.33.0 h1:BBm1oRsogBLeqVKeevNqG9RPCOdmbGeiQM/9hd2GHE8=
|
||||
git.tebibyte.media/tomo/tomo v0.33.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
||||
git.tebibyte.media/tomo/tomo v0.34.0 h1:r5yJPks9rtzdDI2RyAUdqa1qb6BebG0QFe2cTmcFi+0=
|
||||
git.tebibyte.media/tomo/tomo v0.34.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
|
@ -33,8 +33,8 @@ func NewNumberInput (value float64) *NumberInput {
|
||||
box.Add(box.decrement)
|
||||
box.Add(box.increment)
|
||||
box.SetLayout(layouts.NewGrid([]bool { true, false, false }, []bool { true }))
|
||||
box.increment.SetIcon(tomo.IconListAdd) // FIXME: need incr/decrment icons
|
||||
box.decrement.SetIcon(tomo.IconListRemove)
|
||||
box.increment.SetIcon(tomo.IconValueIncrement)
|
||||
box.decrement.SetIcon(tomo.IconValueDecrement)
|
||||
|
||||
box.SetValue(value)
|
||||
|
||||
|
@ -306,9 +306,10 @@ func (this scrollbarLayout) Arrange (hints tomo.LayoutHints, boxes []tomo.Box) {
|
||||
handleLength := gutterLength * this.viewportContentRatio()
|
||||
if handleLength < handleMin { handleLength = handleMin }
|
||||
if handleLength >= gutterLength {
|
||||
// just hide the handle if it isn't needed.
|
||||
// TODO: we need a way to hide and show boxes, this is janky as
|
||||
// fuck
|
||||
// just hide the handle if it isn't needed. we are the layout
|
||||
// and we shouldn't be adding and removing boxes, so this is
|
||||
// really the only good way to hide things.
|
||||
// TODO perhaps have a "Hidden" rectangle in the Tomo API?
|
||||
boxes[0].SetBounds(image.Rect(-16, -16, 0, 0))
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user