starting the table window
This commit is contained in:
parent
57b6efd831
commit
ad34230d67
|
@ -4,9 +4,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// if you include more than just this import
|
|
||||||
// then your plugin might be doing something un-ideal (just a guess from 2023/02/27)
|
|
||||||
|
|
||||||
"github.com/awesome-gocui/gocui"
|
"github.com/awesome-gocui/gocui"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/toolkits/tree"
|
"go.wit.com/toolkits/tree"
|
||||||
|
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"go.wit.com/lib/protobuf/guipb"
|
"go.wit.com/lib/protobuf/guipb"
|
||||||
log "go.wit.com/log"
|
log "go.wit.com/log"
|
||||||
"go.wit.com/toolkits/tree"
|
"go.wit.com/toolkits/tree"
|
||||||
|
"go.wit.com/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
var initOnce sync.Once // run initPlugin() only once
|
var initOnce sync.Once // run initPlugin() only once
|
||||||
|
@ -188,6 +189,7 @@ type guiWidget struct {
|
||||||
children []*guiWidget // mirrors the binary node tree
|
children []*guiWidget // mirrors the binary node tree
|
||||||
node *tree.Node // the pointer back to the tree
|
node *tree.Node // the pointer back to the tree
|
||||||
pb *guipb.Widget // the guipb Widget
|
pb *guipb.Widget // the guipb Widget
|
||||||
|
wtype widget.WidgetType // used for Tables for now. todo: fix this correctly
|
||||||
windowFrame *guiWidget // this is the frame for a window widget
|
windowFrame *guiWidget // this is the frame for a window widget
|
||||||
internal bool // indicates the widget is internal to gocui and should be treated differently
|
internal bool // indicates the widget is internal to gocui and should be treated differently
|
||||||
hasTabs bool // does the window have tabs?
|
hasTabs bool // does the window have tabs?
|
||||||
|
|
37
table.go
37
table.go
|
@ -4,6 +4,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"go.wit.com/lib/protobuf/guipb"
|
"go.wit.com/lib/protobuf/guipb"
|
||||||
|
@ -12,12 +13,48 @@ import (
|
||||||
"go.wit.com/widget"
|
"go.wit.com/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func initWindowPB(pb *guipb.Widget) *guiWidget {
|
||||||
|
var w *guiWidget
|
||||||
|
w = new(guiWidget)
|
||||||
|
|
||||||
|
w.pb = pb
|
||||||
|
w.parent = me.treeRoot.TK.(*guiWidget)
|
||||||
|
w.wtype = widget.Window
|
||||||
|
w.cuiName = fmt.Sprintf("%d %s", pb.Id, "TK")
|
||||||
|
w.labelN = pb.Name
|
||||||
|
return w
|
||||||
|
}
|
||||||
|
|
||||||
|
func initGridPB(pb *guipb.Widget) *guiWidget {
|
||||||
|
var w *guiWidget
|
||||||
|
w = new(guiWidget)
|
||||||
|
|
||||||
|
w.pb = pb
|
||||||
|
w.wtype = widget.Grid
|
||||||
|
w.cuiName = fmt.Sprintf("%d %s", pb.Id, "TK")
|
||||||
|
w.labelN = pb.Name
|
||||||
|
return w
|
||||||
|
}
|
||||||
|
|
||||||
func showTable(t *guipb.Table) {
|
func showTable(t *guipb.Table) {
|
||||||
log.Info("gocui: should show table here")
|
log.Info("gocui: should show table here")
|
||||||
if t == nil {
|
if t == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("gocui: table.Title", t.Title)
|
log.Info("gocui: table.Title", t.Title)
|
||||||
|
if t.Window == nil {
|
||||||
|
log.Info("gocui: missing window widget. tree plugin error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Info("gocui: need to add window here id =", t.Window.Id, t.Window.Name)
|
||||||
|
if t.Grid == nil {
|
||||||
|
log.Info("gocui: missing grid widget. tree plugin error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Info("gocui: need to add grid here id =", t.Grid.Id)
|
||||||
|
win := initWindowPB(t.Window)
|
||||||
|
grid := initWindowPB(t.Window)
|
||||||
|
grid.parent = win
|
||||||
}
|
}
|
||||||
|
|
||||||
func enableWidget(n *tree.Node) {
|
func enableWidget(n *tree.Node) {
|
||||||
|
|
Loading…
Reference in New Issue