summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-09 04:53:49 -0600
committerJeff Carr <[email protected]>2025-02-09 04:53:49 -0600
commit58eff2a9e261335e656f7f5a2311801660b3afc6 (patch)
treee7c274277dfb5de60b1eb156ef8931344ad0934c
parentc00084bf3fe773bfeee538dcb7f8ee2a85865d29 (diff)
disable enable is starting to display
-rw-r--r--color.go8
-rw-r--r--colorNew.go32
-rw-r--r--plugin.go2
-rw-r--r--structs.go1
4 files changed, 38 insertions, 5 deletions
diff --git a/color.go b/color.go
index 5b57035..52cdd8e 100644
--- a/color.go
+++ b/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 {
diff --git a/colorNew.go b/colorNew.go
index 0300293..66661e3 100644
--- a/colorNew.go
+++ b/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()
+}
diff --git a/plugin.go b/plugin.go
index e7782cc..d758aca 100644
--- a/plugin.go
+++ b/plugin.go
@@ -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
diff --git a/structs.go b/structs.go
index 4a424b6..841a87e 100644
--- a/structs.go
+++ b/structs.go
@@ -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
}