Update Tomo API
This commit is contained in:
parent
6ab689b5c1
commit
06d99b2790
@ -1,7 +1,6 @@
|
|||||||
package objects
|
package objects
|
||||||
|
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
import "git.tebibyte.media/tomo/objects/layouts"
|
import "git.tebibyte.media/tomo/objects/layouts"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package objects
|
package objects
|
||||||
|
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package objects
|
package objects
|
||||||
|
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
|
|
||||||
// Container is an object that can contain other objects. It can be used as a
|
// Container is an object that can contain other objects. It can be used as a
|
||||||
// primitive for building more complex layouts. It has two variants: an outer
|
// primitive for building more complex layouts. It has two variants: an outer
|
||||||
|
@ -3,7 +3,6 @@ package objects
|
|||||||
import "image"
|
import "image"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
import "git.tebibyte.media/tomo/objects/layouts"
|
import "git.tebibyte.media/tomo/objects/layouts"
|
||||||
|
|
||||||
// DialogKind defines the semantic role of a dialog window.
|
// DialogKind defines the semantic role of a dialog window.
|
||||||
|
2
go.mod
2
go.mod
@ -2,6 +2,6 @@ module git.tebibyte.media/tomo/objects
|
|||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require git.tebibyte.media/tomo/tomo v0.31.0
|
require git.tebibyte.media/tomo/tomo v0.33.0
|
||||||
|
|
||||||
require golang.org/x/image v0.11.0 // indirect
|
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.31.0 h1:LHPpj3AWycochnC8F441aaRNS6Tq6w6WnBrp/LGjyhM=
|
git.tebibyte.media/tomo/tomo v0.33.0 h1:BBm1oRsogBLeqVKeevNqG9RPCOdmbGeiQM/9hd2GHE8=
|
||||||
git.tebibyte.media/tomo/tomo v0.31.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
git.tebibyte.media/tomo/tomo v0.33.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
@ -2,7 +2,6 @@ package objects
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
|
|
||||||
// Heading is a label that denotes the start of some section of content. It can
|
// Heading is a label that denotes the start of some section of content. It can
|
||||||
// have a level from 0 to 2, with 0 being the most prominent and 2 being the
|
// have a level from 0 to 2, with 0 being the most prominent and 2 being the
|
||||||
|
1
icon.go
1
icon.go
@ -3,7 +3,6 @@ package objects
|
|||||||
import "image"
|
import "image"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/data"
|
import "git.tebibyte.media/tomo/tomo/data"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||||
|
|
||||||
// Icon displays a single icon.
|
// Icon displays a single icon.
|
||||||
|
1
label.go
1
label.go
@ -1,7 +1,6 @@
|
|||||||
package objects
|
package objects
|
||||||
|
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
|
|
||||||
// Label is a simple text label.
|
// Label is a simple text label.
|
||||||
type Label struct {
|
type Label struct {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package objects
|
package objects
|
||||||
|
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
import "git.tebibyte.media/tomo/objects/layouts"
|
import "git.tebibyte.media/tomo/objects/layouts"
|
||||||
|
@ -3,7 +3,6 @@ package objects
|
|||||||
import "math"
|
import "math"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
import "git.tebibyte.media/tomo/objects/layouts"
|
import "git.tebibyte.media/tomo/objects/layouts"
|
||||||
|
@ -2,7 +2,6 @@ package objects
|
|||||||
|
|
||||||
import "image"
|
import "image"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package objects
|
|||||||
import "image"
|
import "image"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
|
|
||||||
// ScrollSide determines which Scrollbars are active in a ScrollContainer.
|
// ScrollSide determines which Scrollbars are active in a ScrollContainer.
|
||||||
type ScrollSide int; const (
|
type ScrollSide int; const (
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package objects
|
package objects
|
||||||
|
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
|
|
||||||
// Separator is a line for visually separating elements.
|
// Separator is a line for visually separating elements.
|
||||||
type Separator struct {
|
type Separator struct {
|
||||||
|
@ -2,7 +2,6 @@ package objects
|
|||||||
|
|
||||||
import "image"
|
import "image"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
|
|
||||||
|
13
textinput.go
13
textinput.go
@ -3,7 +3,6 @@ package objects
|
|||||||
import "image"
|
import "image"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/text"
|
import "git.tebibyte.media/tomo/tomo/text"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
import "git.tebibyte.media/tomo/tomo/input"
|
import "git.tebibyte.media/tomo/tomo/input"
|
||||||
import "git.tebibyte.media/tomo/tomo/event"
|
import "git.tebibyte.media/tomo/tomo/event"
|
||||||
|
|
||||||
@ -60,8 +59,8 @@ func (this *TextInput) handleKeyDown (key input.Key, numpad bool) {
|
|||||||
sel := modifiers.Shift
|
sel := modifiers.Shift
|
||||||
changed := false
|
changed := false
|
||||||
|
|
||||||
// TODO all this (except editing stuff) really should be moved into the
|
// TODO all dot control (movement, selection, etc) should be done in the
|
||||||
// backend
|
// backend. (editing should be done here, though)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case key == input.KeyEnter:
|
case key == input.KeyEnter:
|
||||||
@ -105,6 +104,14 @@ func (this *TextInput) handleKeyDown (key input.Key, numpad bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Type types a character at the current dot position.
|
||||||
|
func (this *TextInput) Type (char rune) {
|
||||||
|
dot := this.Dot()
|
||||||
|
this.text, dot = text.Type(this.text, dot, rune(char))
|
||||||
|
this.Select(dot)
|
||||||
|
this.SetText(string(this.text))
|
||||||
|
}
|
||||||
|
|
||||||
func (this *TextInput) handleScroll (x, y float64) {
|
func (this *TextInput) handleScroll (x, y float64) {
|
||||||
this.ScrollTo(this.ContentBounds().Min.Add(image.Pt(int(x), int(y))))
|
this.ScrollTo(this.ContentBounds().Min.Add(image.Pt(int(x), int(y))))
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package objects
|
|||||||
|
|
||||||
import "image"
|
import "image"
|
||||||
import "git.tebibyte.media/tomo/tomo"
|
import "git.tebibyte.media/tomo/tomo"
|
||||||
import "git.tebibyte.media/tomo/tomo/theme"
|
|
||||||
|
|
||||||
// TextView is an area for displaying a large amount of multi-line text.
|
// TextView is an area for displaying a large amount of multi-line text.
|
||||||
type TextView struct {
|
type TextView struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user