disable enable is starting to display
This commit is contained in:
parent
c00084bf3f
commit
58eff2a9e2
8
color.go
8
color.go
|
@ -67,6 +67,7 @@ var colorActiveT colorT = colorT{gocui.ColorBlue, none, powdererBlue, none, powd
|
|||
// var colorLabel colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal label"}
|
||||
// var colorGroup colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal group"}
|
||||
|
||||
/*
|
||||
var colorDisabled colorT = colorT{
|
||||
frame: superLightGrey,
|
||||
fg: superLightGrey,
|
||||
|
@ -75,6 +76,7 @@ var colorDisabled colorT = colorT{
|
|||
selBg: gocui.ColorBlack,
|
||||
name: "disabled widget",
|
||||
}
|
||||
*/
|
||||
|
||||
var colorLabel colorT = colorT{
|
||||
frame: gocui.ColorWhite,
|
||||
|
@ -172,16 +174,14 @@ func (tk *guiWidget) setColor(newColor *colorT) {
|
|||
tk.Show()
|
||||
}
|
||||
|
||||
/*
|
||||
func (w *guiWidget) disableColor() {
|
||||
if w.color != &colorDisabled {
|
||||
w.defaultColor = w.color
|
||||
}
|
||||
w.setColor(&colorDisabled)
|
||||
}
|
||||
|
||||
func (w *guiWidget) enableColor() {
|
||||
w.setColor(w.defaultColor)
|
||||
}
|
||||
*/
|
||||
|
||||
func (w *guiWidget) setDefaultHighlight() {
|
||||
if w.v == nil {
|
||||
|
|
32
colorNew.go
32
colorNew.go
|
@ -9,6 +9,19 @@ import (
|
|||
"github.com/awesome-gocui/gocui"
|
||||
)
|
||||
|
||||
func (tk *guiWidget) enableColor() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
tk.color.frame = tk.colorLast.frame
|
||||
tk.color.fg = tk.colorLast.fg
|
||||
tk.color.bg = tk.colorLast.bg
|
||||
tk.color.selFg = tk.colorLast.selFg
|
||||
tk.color.selBg = tk.colorLast.selBg
|
||||
|
||||
tk.updateColor()
|
||||
}
|
||||
|
||||
func (tk *guiWidget) updateColor() {
|
||||
if tk.v == nil {
|
||||
return
|
||||
|
@ -216,3 +229,22 @@ func (tk *guiWidget) setColorModal() {
|
|||
tk.color.selBg = gocui.ColorWhite
|
||||
tk.updateColor()
|
||||
}
|
||||
|
||||
// makes the button look disabled
|
||||
func (tk *guiWidget) setColorDisable() {
|
||||
// save the current color
|
||||
if tk.color != nil {
|
||||
tk.colorLast.frame = tk.color.frame
|
||||
tk.colorLast.fg = tk.color.fg
|
||||
tk.colorLast.bg = tk.color.bg
|
||||
tk.colorLast.selFg = tk.color.selFg
|
||||
tk.colorLast.selBg = tk.color.selBg
|
||||
}
|
||||
|
||||
tk.color.frame = superLightGrey
|
||||
tk.color.fg = gocui.ColorBlack
|
||||
tk.color.bg = superLightGrey
|
||||
tk.color.selFg = superLightGrey
|
||||
tk.color.selBg = superLightGrey
|
||||
tk.updateColor()
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ func newaction(n *tree.Node, atype widget.ActionType) {
|
|||
w.enableColor()
|
||||
case widget.Disable:
|
||||
w.enable = false
|
||||
w.disableColor()
|
||||
w.setColorDisable()
|
||||
case widget.Delete:
|
||||
if w == nil {
|
||||
return
|
||||
|
|
|
@ -204,6 +204,7 @@ type guiWidget struct {
|
|||
frame bool // ?
|
||||
selectedTab *tree.Node // for a window, this is currently selected tab
|
||||
color *colorT // what color to use
|
||||
colorLast colorT // the last color the widget had
|
||||
defaultColor *colorT // the default colors // TODO: make a function for this instead
|
||||
isBG bool // means this is the background widget. There is only one of these
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue