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 colorLabel colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal label"}
|
||||||
// var colorGroup colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal group"}
|
// var colorGroup colorT = colorT{none, none, superLightGrey, none, superLightGrey, "normal group"}
|
||||||
|
|
||||||
|
/*
|
||||||
var colorDisabled colorT = colorT{
|
var colorDisabled colorT = colorT{
|
||||||
frame: superLightGrey,
|
frame: superLightGrey,
|
||||||
fg: superLightGrey,
|
fg: superLightGrey,
|
||||||
|
@ -75,6 +76,7 @@ var colorDisabled colorT = colorT{
|
||||||
selBg: gocui.ColorBlack,
|
selBg: gocui.ColorBlack,
|
||||||
name: "disabled widget",
|
name: "disabled widget",
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
var colorLabel colorT = colorT{
|
var colorLabel colorT = colorT{
|
||||||
frame: gocui.ColorWhite,
|
frame: gocui.ColorWhite,
|
||||||
|
@ -172,16 +174,14 @@ func (tk *guiWidget) setColor(newColor *colorT) {
|
||||||
tk.Show()
|
tk.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (w *guiWidget) disableColor() {
|
func (w *guiWidget) disableColor() {
|
||||||
if w.color != &colorDisabled {
|
if w.color != &colorDisabled {
|
||||||
w.defaultColor = w.color
|
w.defaultColor = w.color
|
||||||
}
|
}
|
||||||
w.setColor(&colorDisabled)
|
w.setColor(&colorDisabled)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
func (w *guiWidget) enableColor() {
|
|
||||||
w.setColor(w.defaultColor)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *guiWidget) setDefaultHighlight() {
|
func (w *guiWidget) setDefaultHighlight() {
|
||||||
if w.v == nil {
|
if w.v == nil {
|
||||||
|
|
32
colorNew.go
32
colorNew.go
|
@ -9,6 +9,19 @@ import (
|
||||||
"github.com/awesome-gocui/gocui"
|
"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() {
|
func (tk *guiWidget) updateColor() {
|
||||||
if tk.v == nil {
|
if tk.v == nil {
|
||||||
return
|
return
|
||||||
|
@ -216,3 +229,22 @@ func (tk *guiWidget) setColorModal() {
|
||||||
tk.color.selBg = gocui.ColorWhite
|
tk.color.selBg = gocui.ColorWhite
|
||||||
tk.updateColor()
|
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()
|
w.enableColor()
|
||||||
case widget.Disable:
|
case widget.Disable:
|
||||||
w.enable = false
|
w.enable = false
|
||||||
w.disableColor()
|
w.setColorDisable()
|
||||||
case widget.Delete:
|
case widget.Delete:
|
||||||
if w == nil {
|
if w == nil {
|
||||||
return
|
return
|
||||||
|
|
|
@ -204,6 +204,7 @@ type guiWidget struct {
|
||||||
frame bool // ?
|
frame bool // ?
|
||||||
selectedTab *tree.Node // for a window, this is currently selected tab
|
selectedTab *tree.Node // for a window, this is currently selected tab
|
||||||
color *colorT // what color to use
|
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
|
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
|
isBG bool // means this is the background widget. There is only one of these
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue