rename to drawView()
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
a907a4418a
commit
a15aea03ea
2
color.go
2
color.go
|
@ -131,7 +131,7 @@ func (tk *guiWidget) setColor(newColor *colorT) {
|
||||||
tk.color = &colorNone
|
tk.color = &colorNone
|
||||||
}
|
}
|
||||||
log.Log(NOW, "Set the node to color =", tk.color.name)
|
log.Log(NOW, "Set the node to color =", tk.color.name)
|
||||||
tk.recreateView()
|
tk.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *guiWidget) disableColor() {
|
func (w *guiWidget) disableColor() {
|
||||||
|
|
22
draw.go
22
draw.go
|
@ -47,22 +47,20 @@ func (w *guiWidget) drawTree(draw bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// display's the text of the widget in gocui
|
// display's the text of the widget in gocui
|
||||||
// create or recreate the gocui widget visible
|
|
||||||
// will create a new gocui view if there isn't one or if it has been moved
|
|
||||||
// deletes the old view if it exists and recreates it
|
// deletes the old view if it exists and recreates it
|
||||||
func (w *guiWidget) recreateView() {
|
func (w *guiWidget) drawView() {
|
||||||
var err error
|
var err error
|
||||||
log.Log(INFO, "recreateView() START", w.WidgetType, w.String())
|
log.Log(INFO, "drawView() START", w.WidgetType, w.String())
|
||||||
if me.baseGui == nil {
|
if me.baseGui == nil {
|
||||||
log.Log(ERROR, "recreateView() ERROR: me.baseGui == nil", w)
|
log.Log(ERROR, "drawView() ERROR: me.baseGui == nil", w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if w.cuiName == "" {
|
if w.cuiName == "" {
|
||||||
log.Log(ERROR, "recreateView() w.cuiName was not set for widget", w)
|
log.Log(ERROR, "drawView() w.cuiName was not set for widget", w)
|
||||||
w.cuiName = strconv.Itoa(w.node.WidgetId) + " TK"
|
w.cuiName = strconv.Itoa(w.node.WidgetId) + " TK"
|
||||||
}
|
}
|
||||||
log.Log(INFO, "recreateView() labelN =", w.labelN)
|
log.Log(INFO, "drawView() labelN =", w.labelN)
|
||||||
|
|
||||||
// this deletes the button from gocui
|
// this deletes the button from gocui
|
||||||
me.baseGui.DeleteView(w.cuiName)
|
me.baseGui.DeleteView(w.cuiName)
|
||||||
|
@ -76,13 +74,13 @@ func (w *guiWidget) recreateView() {
|
||||||
|
|
||||||
w.v, err = me.baseGui.SetView(w.cuiName, a, b, c, d, 0)
|
w.v, err = me.baseGui.SetView(w.cuiName, a, b, c, d, 0)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
w.showWidgetPlacement("recreateView()")
|
w.showWidgetPlacement("drawView()")
|
||||||
log.Log(ERROR, "recreateView() internal plugin error err = nil")
|
log.Log(ERROR, "drawView() internal plugin error err = nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !errors.Is(err, gocui.ErrUnknownView) {
|
if !errors.Is(err, gocui.ErrUnknownView) {
|
||||||
w.showWidgetPlacement("recreateView()")
|
w.showWidgetPlacement("drawView()")
|
||||||
log.Log(ERROR, "recreateView() internal plugin error error.IS()", err)
|
log.Log(ERROR, "drawView() internal plugin error error.IS()", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,5 +108,5 @@ func (w *guiWidget) recreateView() {
|
||||||
w.v.SelFgColor = w.color.selFg
|
w.v.SelFgColor = w.color.selFg
|
||||||
w.v.SelBgColor = w.color.selBg
|
w.v.SelBgColor = w.color.selBg
|
||||||
}
|
}
|
||||||
log.Log(INFO, "recreateView() END")
|
log.Log(INFO, "drawView() END")
|
||||||
}
|
}
|
||||||
|
|
4
view.go
4
view.go
|
@ -83,9 +83,11 @@ func (w *guiWidget) hideFake() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// shows the 'fake' widgets for widgets that
|
||||||
|
// are not normally displayed (like a grid widget)
|
||||||
func (w *guiWidget) showFake() {
|
func (w *guiWidget) showFake() {
|
||||||
if w.isFake {
|
if w.isFake {
|
||||||
w.recreateView()
|
w.drawView()
|
||||||
w.showWidgetPlacement("showFake:")
|
w.showWidgetPlacement("showFake:")
|
||||||
}
|
}
|
||||||
for _, child := range w.children {
|
for _, child := range w.children {
|
||||||
|
|
|
@ -104,7 +104,7 @@ func (tk *guiWidget) Visible() bool {
|
||||||
func (w *guiWidget) Show() {
|
func (w *guiWidget) Show() {
|
||||||
// always should the dropdown widget
|
// always should the dropdown widget
|
||||||
if w == me.dropdownV {
|
if w == me.dropdownV {
|
||||||
me.dropdownV.recreateView()
|
me.dropdownV.drawView()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,13 +116,13 @@ func (w *guiWidget) Show() {
|
||||||
// if this isn't in the binary tree
|
// if this isn't in the binary tree
|
||||||
// it's some internal widget so always display those
|
// it's some internal widget so always display those
|
||||||
if w.node == nil {
|
if w.node == nil {
|
||||||
w.recreateView()
|
w.drawView()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// always show window titles
|
// always show window titles
|
||||||
if w.node.WidgetType != widget.Window {
|
if w.node.WidgetType != widget.Window {
|
||||||
w.recreateView()
|
w.drawView()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ func (w *guiWidget) Show() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// okay, if you made it this far, then display the widget
|
// okay, if you made it this far, then display the widget
|
||||||
w.recreateView()
|
w.drawView()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tk *guiWidget) Hide() {
|
func (tk *guiWidget) Hide() {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"go.wit.com/widget"
|
"go.wit.com/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// re-draws the buttons for each of the windows
|
||||||
func (w *guiWidget) redoWindows(nextW int, nextH int) {
|
func (w *guiWidget) redoWindows(nextW int, nextH int) {
|
||||||
var startW int = nextW
|
var startW int = nextW
|
||||||
var startH int = nextH
|
var startH int = nextH
|
||||||
|
@ -19,9 +20,7 @@ func (w *guiWidget) redoWindows(nextW int, nextH int) {
|
||||||
child.gocuiSetWH(nextW, nextH)
|
child.gocuiSetWH(nextW, nextH)
|
||||||
child.Hide()
|
child.Hide()
|
||||||
|
|
||||||
// use the direct method recreateView() to
|
child.drawView()
|
||||||
// bypass sanity checks here (fix this?)
|
|
||||||
child.recreateView()
|
|
||||||
sizeW := child.gocuiSize.Width()
|
sizeW := child.gocuiSize.Width()
|
||||||
nextW += sizeW + 4
|
nextW += sizeW + 4
|
||||||
child.redoWindows(startW+3, startH+2)
|
child.redoWindows(startW+3, startH+2)
|
||||||
|
|
Loading…
Reference in New Issue