better colors on labels and checkboxes
This commit is contained in:
parent
e3c874cd69
commit
d6f2fd983e
|
@ -23,7 +23,7 @@ func setChecked(n *tree.Node, b bool) {
|
|||
tk.labelN = "X " + tk.node.State.Label
|
||||
} else {
|
||||
log.Log(WARN, "setCheckbox() got false", tk.node.State.Checked)
|
||||
tk.labelN = " " + tk.node.State.Label
|
||||
tk.labelN = "_ " + tk.node.State.Label
|
||||
}
|
||||
|
||||
tk.Hide()
|
||||
|
@ -45,7 +45,7 @@ func (w *guiWidget) setCheckbox() {
|
|||
// w.changed = true
|
||||
} else {
|
||||
log.Log(WARN, "setCheckbox() got false", w.node.State.Checked)
|
||||
w.labelN = " " + w.node.State.Label
|
||||
w.labelN = "_ " + w.node.State.Label
|
||||
// w.changed = true
|
||||
}
|
||||
// t := len(w.labelN) + 3
|
||||
|
|
4
color.go
4
color.go
|
@ -76,7 +76,7 @@ var colorLabel colorT = colorT{
|
|||
frame: gocui.ColorWhite,
|
||||
fg: none,
|
||||
bg: none,
|
||||
selFg: gocui.ColorWhite,
|
||||
selFg: none,
|
||||
selBg: none,
|
||||
name: "normal label",
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ var colorCheckbox colorT = colorT{
|
|||
fg: none,
|
||||
bg: none,
|
||||
selFg: gocui.ColorRed,
|
||||
selBg: gocui.ColorBlack,
|
||||
selBg: gocui.ColorWhite,
|
||||
name: "normal checkbox",
|
||||
}
|
||||
|
||||
|
|
|
@ -13,27 +13,6 @@ import (
|
|||
"go.wit.com/widget"
|
||||
)
|
||||
|
||||
// event triggers when you push down on a mouse button
|
||||
func msgDown(g *gocui.Gui, v *gocui.View) error {
|
||||
initialMouseX, initialMouseY = g.MousePosition()
|
||||
|
||||
w := initialMouseX
|
||||
h := initialMouseY
|
||||
|
||||
for _, tk := range findByXY(w, h) {
|
||||
tk.dumpWidget("msgDown()")
|
||||
}
|
||||
|
||||
vx, vy, _, _, err := g.ViewPosition("msg")
|
||||
if err == nil {
|
||||
xOffset = initialMouseX - vx
|
||||
yOffset = initialMouseY - vy
|
||||
}
|
||||
log.Info("setting mousedown to true")
|
||||
msgMouseDown = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func mouseUp(g *gocui.Gui, v *gocui.View) error {
|
||||
w, h := g.MousePosition()
|
||||
|
||||
|
@ -75,6 +54,11 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
|||
tk.doWidgetClick(mx, my)
|
||||
return nil
|
||||
}
|
||||
if tk.node.WidgetType == widget.Checkbox {
|
||||
log.Info("SENDING CLICK TO Checkbox")
|
||||
tk.doWidgetClick(mx, my)
|
||||
return nil
|
||||
}
|
||||
/*
|
||||
if tk.node.WidgetType == widget.Label {
|
||||
log.Info("SENDING CLICK TO Label")
|
||||
|
@ -122,3 +106,25 @@ func mouseDown(g *gocui.Gui, v *gocui.View) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// this needs to go
|
||||
// event triggers when you push down on a mouse button
|
||||
func msgDown(g *gocui.Gui, v *gocui.View) error {
|
||||
initialMouseX, initialMouseY = g.MousePosition()
|
||||
|
||||
w := initialMouseX
|
||||
h := initialMouseY
|
||||
|
||||
for _, tk := range findByXY(w, h) {
|
||||
tk.dumpWidget("msgDown()")
|
||||
}
|
||||
|
||||
vx, vy, _, _, err := g.ViewPosition("msg")
|
||||
if err == nil {
|
||||
xOffset = initialMouseX - vx
|
||||
yOffset = initialMouseY - vy
|
||||
}
|
||||
log.Info("setting mousedown to true")
|
||||
msgMouseDown = true
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -49,7 +49,10 @@ func mouseMove(g *gocui.Gui) {
|
|||
}
|
||||
}
|
||||
|
||||
if createStdout(g) {
|
||||
if widgetView, _ := g.View("msg"); widgetView == nil {
|
||||
if createStdout(g) {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -72,14 +75,12 @@ func (tk *guiWidget) moveNew(g *gocui.Gui) {
|
|||
}
|
||||
|
||||
func createStdout(g *gocui.Gui) bool {
|
||||
if widgetView, _ := g.View("msg"); widgetView == nil {
|
||||
makeOutputWidget(g, "this is a create before a mouse click")
|
||||
if me.logStdout != nil {
|
||||
msg := fmt.Sprintf("test out gocuiEvent() %d\n", me.ecount)
|
||||
me.logStdout.Write([]byte(msg))
|
||||
log.Log(NOW, "logStdout test out")
|
||||
}
|
||||
return true
|
||||
makeOutputWidget(g, "this is a create before a mouse click")
|
||||
if me.logStdout != nil {
|
||||
msg := fmt.Sprintf("test out gocuiEvent() %d\n", me.ecount)
|
||||
// me.logStdout.v.Write([]byte(msg))
|
||||
me.logStdout.Write([]byte(msg))
|
||||
log.Log(NOW, "logStdout test out")
|
||||
}
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -69,9 +69,6 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
|||
log.Log(NOW, "makeoutputwindow() msg != nil. WTF now? err =", err)
|
||||
}
|
||||
|
||||
// help, err := g.SetView("help", maxX-32, 0, maxX-1, 13, 0)
|
||||
// v, err = g.SetView("msg", 3, 3, 30, 30, 0)
|
||||
|
||||
if me.startOutputW == 0 {
|
||||
me.startOutputW = maxX - 132
|
||||
}
|
||||
|
@ -79,7 +76,6 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
|||
me.startOutputH = maxY / 2
|
||||
}
|
||||
|
||||
// v, err = g.SetView("msg", maxX-32, maxY/2, maxX/2+outputW, maxY/2+outputH, 0)
|
||||
v, err = g.SetView("msg", me.startOutputW, me.startOutputH, maxX/2+outputW, maxY/2+outputH, 0)
|
||||
if errors.Is(err, gocui.ErrUnknownView) {
|
||||
log.Log(NOW, "makeoutputwindow() this is supposed to happen?", err)
|
||||
|
@ -102,7 +98,8 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
|||
v.SelFgColor = gocui.ColorBlack
|
||||
fmt.Fprintln(v, "figure out how to capture STDOUT to here\n"+stringFromMouseClick)
|
||||
g.SetViewOnBottom("msg")
|
||||
// g.SetViewOnBottom(v.Name())
|
||||
me.logStdout.DrawAt(50, 50)
|
||||
|
||||
me.logStdout.v = v
|
||||
me.logStdout.DrawAt(10, 10)
|
||||
return v
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue