diff --git a/ElvUI_CoA.toc b/ElvUI_CoA.toc index 010c84b..ab95f63 100644 --- a/ElvUI_CoA.toc +++ b/ElvUI_CoA.toc @@ -8,3 +8,4 @@ core.lua Modules\ExtraActionBar.lua +Modules\LayerPicker.lua diff --git a/Modules/LayerPicker.lua b/Modules/LayerPicker.lua new file mode 100644 index 0000000..efec6c1 --- /dev/null +++ b/Modules/LayerPicker.lua @@ -0,0 +1,41 @@ +local E, L, V, P, G = unpack(ElvUI) +local CoA = E:GetModule("CoA") + +local BUTTON_NAME = "LayerPickerFrame" + +local function SkinButton(button) + if button.CoASkinned then return end + button.CoASkinned = true + + local name = button:GetName() + local text = _G[name.."Text"] + + button:StripTextures(true) + button:CreateBackdrop("Default") + button:StyleButton() + + if text then + text:FontTemplate() + end +end + +local function TryHook() + local button = _G[BUTTON_NAME] + + if button and E.private.CoA.instance then + SkinButton(button) + end + + return button ~= nil +end + +function CoA:InitializeLayerPicker() + if TryHook() then return end + + self.layerPickerTimer = self:ScheduleRepeatingTimer(function() + if TryHook() then + self:CancelTimer(self.layerPickerTimer) + self.layerPickerTimer = nil + end + end, 0.5) +end diff --git a/core.lua b/core.lua index 6aa8616..8c30cb4 100644 --- a/core.lua +++ b/core.lua @@ -8,6 +8,7 @@ E.CoA = CoA V.CoA = { extraActionBar = true, + instance = true, } local function getOptions() @@ -38,6 +39,12 @@ local function getOptions() name = "Extra Action Bar", desc = "Skin the ExtraActionBar frame.", }, + instance = { + order = 3, + type = "toggle", + name = "Instance", + desc = "Skin the LayerPickerFrame button.", + }, }, }, }, @@ -52,6 +59,10 @@ function CoA:Initialize() if self.InitializeExtraActionBar then self:InitializeExtraActionBar() end + + if self.InitializeLayerPicker then + self:InitializeLayerPicker() + end end local function InitializeCallback()