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()
|
||||
}
|
||||
|
||||
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() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
|
|
|
@ -109,6 +109,14 @@ func doMouseClick(w int, h int) {
|
|||
case widget.Textbox:
|
||||
tk.prepTextbox()
|
||||
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:
|
||||
// TODO: enable the GUI debugger in gocui
|
||||
// tk.dumpWidget("undef click()") // enable this to debug widget clicks
|
||||
|
|
18
widgetAdd.go
18
widgetAdd.go
|
@ -41,17 +41,14 @@ func addWidget(n *tree.Node) {
|
|||
switch n.WidgetType {
|
||||
case widget.Root:
|
||||
log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.String())
|
||||
// tk.color = &colorRoot
|
||||
setFake(n)
|
||||
return
|
||||
case widget.Flag:
|
||||
// tk.color = &colorFlag
|
||||
setFake(n)
|
||||
return
|
||||
case widget.Window:
|
||||
tk.frame = false
|
||||
tk.labelN = tk.GetText() + " X"
|
||||
// tk.setColor(&colorWindow)
|
||||
me.newWindowTrigger <- tk
|
||||
redoWindows(0, 0)
|
||||
return
|
||||
|
@ -62,7 +59,6 @@ func addWidget(n *tree.Node) {
|
|||
tk.isFake = true
|
||||
return
|
||||
case widget.Tab:
|
||||
// tk.color = &colorTab
|
||||
return
|
||||
case widget.Button:
|
||||
tk.setColorButton()
|
||||
|
@ -81,20 +77,16 @@ func addWidget(n *tree.Node) {
|
|||
case widget.Textbox:
|
||||
n.State.Label = ""
|
||||
tk.labelN = " "
|
||||
// tk.color = &colorDropdown
|
||||
tk.setColorInput()
|
||||
return
|
||||
case widget.Combobox:
|
||||
// tk.color = &colorCombobox
|
||||
tk.setColorInput()
|
||||
return
|
||||
case widget.Box:
|
||||
// tk.color = &colorBox
|
||||
tk.isFake = true
|
||||
setFake(n)
|
||||
return
|
||||
case widget.Grid:
|
||||
// tk.color = &colorGrid
|
||||
tk.isFake = true
|
||||
setFake(n)
|
||||
return
|
||||
|
@ -103,7 +95,17 @@ func addWidget(n *tree.Node) {
|
|||
tk.frame = false
|
||||
return
|
||||
case widget.Label:
|
||||
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
|
||||
return
|
||||
default:
|
||||
|
|
|
@ -223,17 +223,12 @@ func (tk *guiWidget) drawView() {
|
|||
log.Log(INFO, "drawView() END")
|
||||
}
|
||||
|
||||
// redraw the widget tree starting at this location
|
||||
func (w *guiWidget) DrawAt(offsetW, offsetH int) {
|
||||
// w.setColor(&colorActiveW)
|
||||
w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget
|
||||
// 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
|
||||
func (w *guiWidget) drawTree(draw bool) {
|
||||
if w == nil {
|
||||
|
|
Loading…
Reference in New Issue