VIM-GO: auto-reformatting by vim-go

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2021-10-06 11:56:52 -05:00
parent 62010a8d16
commit 375444ea28
1 changed files with 30 additions and 12 deletions

View File

@ -1,18 +1,23 @@
package gui package gui
import "log" import (
"log"
import "github.com/andlabs/ui" "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest" _ "github.com/andlabs/ui/winmanifest"
)
// https://ieftimov.com/post/golang-datastructures-trees/
type Node struct { type Node struct {
Name string id int
tag string Name string
Width int tag string
Height int Width int
Height int
uiType *ui.Control uiType *ui.Control
Children []*Node Children []*Node
} }
func (n Node) SetName(name string) { func (n Node) SetName(name string) {
@ -22,8 +27,21 @@ func (n Node) SetName(name string) {
} }
func (n Node) Append(child Node) { func (n Node) Append(child Node) {
// if (n.UiBox == nil) { // if (n.UiBox == nil) {
// return // return
// } // }
// n.uiType.Append(child, x) // n.uiType.Append(child, x)
} }
func findByIdDFS(node *Node, id string) *Node {
if node.id == id {
return node
}
if len(node.children) > 0 {
for _, child := range node.children {
findByIdDFS(child, id)
}
}
return nil
}