2023-03-03 14:41:38 -06:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.wit.org/wit/gui/toolkit"
|
|
|
|
)
|
|
|
|
|
2023-04-04 06:31:30 -05:00
|
|
|
// Grid numbering examples (H) or (W,H)
|
2023-03-23 12:35:12 -05:00
|
|
|
// ---------
|
|
|
|
// -- (1) --
|
|
|
|
// -- (2) --
|
|
|
|
// ---------
|
|
|
|
//
|
|
|
|
// -----------------------------
|
2023-04-04 06:31:30 -05:00
|
|
|
// -- (1,1) -- (2,1) -- (3,1) --
|
|
|
|
// -- (1,2) -- (2,2) -- (3,2) --
|
|
|
|
// -- (1,3) -- -- (3,3) --
|
2023-03-23 12:35:12 -05:00
|
|
|
// -----------------------------
|
|
|
|
|
2023-04-04 06:31:30 -05:00
|
|
|
func (n *Node) NewGrid(name string, w int, h int) *Node {
|
2023-03-03 14:41:38 -06:00
|
|
|
newNode := n.New(name, toolkit.Grid, func() {
|
|
|
|
log(debugChange, "click() NewGrid not defined =", name)
|
|
|
|
})
|
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
var a toolkit.Action
|
2023-03-29 23:03:04 -05:00
|
|
|
a.ActionType = toolkit.Add
|
2023-04-04 06:31:30 -05:00
|
|
|
a.Name = name
|
|
|
|
a.Text = name
|
|
|
|
a.X = w
|
|
|
|
a.Y = h
|
|
|
|
a.Width = w
|
|
|
|
a.Height = h
|
|
|
|
newNode.X = w
|
|
|
|
newNode.Y = h
|
2023-03-23 12:35:12 -05:00
|
|
|
newNode.NextX = 1
|
|
|
|
newNode.NextY = 1
|
|
|
|
newaction(&a, newNode, n)
|
|
|
|
|
2023-03-03 14:41:38 -06:00
|
|
|
return newNode
|
|
|
|
}
|
2023-03-12 08:47:16 -05:00
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
func (n *Node) NewBox(name string, b bool) *Node {
|
|
|
|
newNode := n.New(name, toolkit.Box, nil)
|
2023-04-03 10:26:47 -05:00
|
|
|
newNode.B = b
|
2023-03-12 08:47:16 -05:00
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
var a toolkit.Action
|
2023-03-29 23:03:04 -05:00
|
|
|
a.ActionType = toolkit.Add
|
|
|
|
a.Name = name
|
|
|
|
a.Text = name
|
2023-03-23 12:35:12 -05:00
|
|
|
a.B = b
|
|
|
|
newaction(&a, newNode, n)
|
2023-03-12 08:47:16 -05:00
|
|
|
|
|
|
|
return newNode
|
|
|
|
}
|