Quantcast

Added visibility state option for UI Buttons. This closes #286

Darthpred [08-20-16 - 15:19]
Added visibility state option for UI Buttons. This closes #286
Filename
ElvUI_SLE/libs/LibElv-UIButtons-1.0/LibElv-UIButtons-1.0.lua
ElvUI_SLE/options/uibuttons_c.lua
diff --git a/ElvUI_SLE/libs/LibElv-UIButtons-1.0/LibElv-UIButtons-1.0.lua b/ElvUI_SLE/libs/LibElv-UIButtons-1.0/LibElv-UIButtons-1.0.lua
index a691a56..fdf8acc 100644
--- a/ElvUI_SLE/libs/LibElv-UIButtons-1.0/LibElv-UIButtons-1.0.lua
+++ b/ElvUI_SLE/libs/LibElv-UIButtons-1.0/LibElv-UIButtons-1.0.lua
@@ -324,11 +324,13 @@ local function ToggleShow(menu)
 	if not menu.db.enable then
 		menu:Hide()
 		E:DisableMover(menu.mover:GetName())
+		UnregisterStateDriver(menu, "visibility")
 	else
 		menu:Show()
 		menu:UpdateMouseOverSetting()
 		menu:UpdateBackdrop()
 		E:EnableMover(menu.mover:GetName())
+		if menu.db.visibility then RegisterStateDriver(menu, "visibility", menu.db.visibility) end
 	end
 end

diff --git a/ElvUI_SLE/options/uibuttons_c.lua b/ElvUI_SLE/options/uibuttons_c.lua
index 722e074..f6c59b3 100644
--- a/ElvUI_SLE/options/uibuttons_c.lua
+++ b/ElvUI_SLE/options/uibuttons_c.lua
@@ -218,8 +218,17 @@ local function configTable()
 				get = function(info) return E.db.sle.uibuttons.customroll.max end,
 				set = function(info, value) E.db.sle.uibuttons.customroll.max = value; end,
 			},
-			Config = {
+			visibility = {
 				order = 19,
+				type = 'input',
+				width = 'full',
+				name = L["Visibility State"],
+				disabled = function() return not E.db.sle.uibuttons.enable end,
+				get = function(info) return E.db.sle.uibuttons.visibility end,
+				set = function(info, value) E.db.sle.uibuttons.visibility = value; Bar:ToggleShow() end,
+			},
+			Config = {
+				order = 30,
 				name = "\"C\" "..L["Quick Action"],
 				type = "group",
 				guiInline = true,
@@ -250,7 +259,7 @@ local function configTable()
 				},
 			},
 			Addon = {
-				order = 20,
+				order = 31,
 				name = "\"A\" "..L["Quick Action"],
 				type = "group",
 				guiInline = true,
@@ -278,7 +287,7 @@ local function configTable()
 				},
 			},
 			Status = {
-				order = 21,
+				order = 32,
 				name = "\"S\" "..L["Quick Action"],
 				type = "group",
 				guiInline = true,
@@ -307,7 +316,7 @@ local function configTable()
 				},
 			},
 			Roll = {
-				order = 22,
+				order = 33,
 				name = "\"R\" "..L["Quick Action"],
 				type = "group",
 				guiInline = true,