table headers identified. ready for sorting
This commit is contained in:
parent
36514cbb68
commit
aaebb4c5d9
21
color.go
21
color.go
|
@ -186,6 +186,27 @@ func (tk *guiWidget) setColorLabel() {
|
||||||
tk.updateColor()
|
tk.updateColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tk *guiWidget) setColorLabelTable() {
|
||||||
|
if tk.color == nil {
|
||||||
|
tk.color = new(colorT)
|
||||||
|
}
|
||||||
|
if me.dark {
|
||||||
|
tk.color.frame = gocui.AttrNone
|
||||||
|
tk.color.fg = gocui.ColorWhite
|
||||||
|
tk.color.bg = gocui.ColorBlack
|
||||||
|
tk.color.selFg = gocui.ColorWhite
|
||||||
|
tk.color.selBg = gocui.AttrNone
|
||||||
|
} else {
|
||||||
|
tk.color.frame = gocui.AttrNone
|
||||||
|
tk.color.fg = gocui.ColorBlack
|
||||||
|
tk.color.bg = gocui.AttrNone
|
||||||
|
tk.color.selFg = gocui.AttrNone
|
||||||
|
tk.color.selBg = gocui.ColorGreen
|
||||||
|
}
|
||||||
|
|
||||||
|
tk.updateColor()
|
||||||
|
}
|
||||||
|
|
||||||
func (tk *guiWidget) setColorButtonDense() {
|
func (tk *guiWidget) setColorButtonDense() {
|
||||||
if tk.color == nil {
|
if tk.color == nil {
|
||||||
tk.color = new(colorT)
|
tk.color = new(colorT)
|
||||||
|
|
|
@ -109,6 +109,14 @@ func doMouseClick(w int, h int) {
|
||||||
case widget.Textbox:
|
case widget.Textbox:
|
||||||
tk.prepTextbox()
|
tk.prepTextbox()
|
||||||
return
|
return
|
||||||
|
case widget.Label:
|
||||||
|
if tk.node.InTable() {
|
||||||
|
if tk.node.State.AtH == 0 {
|
||||||
|
log.Log(NOW, "todo: sort by column here")
|
||||||
|
tk.dumpWidget("sort")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
default:
|
default:
|
||||||
// TODO: enable the GUI debugger in gocui
|
// TODO: enable the GUI debugger in gocui
|
||||||
// tk.dumpWidget("undef click()") // enable this to debug widget clicks
|
// tk.dumpWidget("undef click()") // enable this to debug widget clicks
|
||||||
|
|
20
widgetAdd.go
20
widgetAdd.go
|
@ -41,17 +41,14 @@ func addWidget(n *tree.Node) {
|
||||||
switch n.WidgetType {
|
switch n.WidgetType {
|
||||||
case widget.Root:
|
case widget.Root:
|
||||||
log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.String())
|
log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.String())
|
||||||
// tk.color = &colorRoot
|
|
||||||
setFake(n)
|
setFake(n)
|
||||||
return
|
return
|
||||||
case widget.Flag:
|
case widget.Flag:
|
||||||
// tk.color = &colorFlag
|
|
||||||
setFake(n)
|
setFake(n)
|
||||||
return
|
return
|
||||||
case widget.Window:
|
case widget.Window:
|
||||||
tk.frame = false
|
tk.frame = false
|
||||||
tk.labelN = tk.GetText() + " X"
|
tk.labelN = tk.GetText() + " X"
|
||||||
// tk.setColor(&colorWindow)
|
|
||||||
me.newWindowTrigger <- tk
|
me.newWindowTrigger <- tk
|
||||||
redoWindows(0, 0)
|
redoWindows(0, 0)
|
||||||
return
|
return
|
||||||
|
@ -62,7 +59,6 @@ func addWidget(n *tree.Node) {
|
||||||
tk.isFake = true
|
tk.isFake = true
|
||||||
return
|
return
|
||||||
case widget.Tab:
|
case widget.Tab:
|
||||||
// tk.color = &colorTab
|
|
||||||
return
|
return
|
||||||
case widget.Button:
|
case widget.Button:
|
||||||
tk.setColorButton()
|
tk.setColorButton()
|
||||||
|
@ -81,20 +77,16 @@ func addWidget(n *tree.Node) {
|
||||||
case widget.Textbox:
|
case widget.Textbox:
|
||||||
n.State.Label = ""
|
n.State.Label = ""
|
||||||
tk.labelN = " "
|
tk.labelN = " "
|
||||||
// tk.color = &colorDropdown
|
|
||||||
tk.setColorInput()
|
tk.setColorInput()
|
||||||
return
|
return
|
||||||
case widget.Combobox:
|
case widget.Combobox:
|
||||||
// tk.color = &colorCombobox
|
|
||||||
tk.setColorInput()
|
tk.setColorInput()
|
||||||
return
|
return
|
||||||
case widget.Box:
|
case widget.Box:
|
||||||
// tk.color = &colorBox
|
|
||||||
tk.isFake = true
|
tk.isFake = true
|
||||||
setFake(n)
|
setFake(n)
|
||||||
return
|
return
|
||||||
case widget.Grid:
|
case widget.Grid:
|
||||||
// tk.color = &colorGrid
|
|
||||||
tk.isFake = true
|
tk.isFake = true
|
||||||
setFake(n)
|
setFake(n)
|
||||||
return
|
return
|
||||||
|
@ -103,7 +95,17 @@ func addWidget(n *tree.Node) {
|
||||||
tk.frame = false
|
tk.frame = false
|
||||||
return
|
return
|
||||||
case widget.Label:
|
case widget.Label:
|
||||||
tk.setColorLabel()
|
if tk.node.InTable() {
|
||||||
|
if tk.node.State.AtH == 0 {
|
||||||
|
// this is the table header
|
||||||
|
tk.setColorLabelTable()
|
||||||
|
} else {
|
||||||
|
// todo: highlight the whole table row
|
||||||
|
tk.setColorLabel()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tk.setColorLabel()
|
||||||
|
}
|
||||||
tk.frame = false
|
tk.frame = false
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -223,17 +223,12 @@ func (tk *guiWidget) drawView() {
|
||||||
log.Log(INFO, "drawView() END")
|
log.Log(INFO, "drawView() END")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// redraw the widget tree starting at this location
|
||||||
func (w *guiWidget) DrawAt(offsetW, offsetH int) {
|
func (w *guiWidget) DrawAt(offsetW, offsetH int) {
|
||||||
// w.setColor(&colorActiveW)
|
|
||||||
w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget
|
w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget
|
||||||
// w.dumpWidget(fmt.Sprintf("DrawAt(%d,%d)", offsetW, offsetH))
|
// w.dumpWidget(fmt.Sprintf("DrawAt(%d,%d)", offsetW, offsetH))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *guiWidget) simpleDrawAt(offsetW, offsetH int) {
|
|
||||||
// w.setColor(&colorActiveW)
|
|
||||||
w.dumpWidget("simpleDrawAt()")
|
|
||||||
}
|
|
||||||
|
|
||||||
// display the widgets in the binary tree
|
// display the widgets in the binary tree
|
||||||
func (w *guiWidget) drawTree(draw bool) {
|
func (w *guiWidget) drawTree(draw bool) {
|
||||||
if w == nil {
|
if w == nil {
|
||||||
|
|
Loading…
Reference in New Issue