flickerstreak@28: --[[ Flick@234: ReAction Pet Action button options module flickerstreak@28: --]] flickerstreak@28: flickerstreak@28: -- local imports flickerstreak@175: local addonName, addonTable = ... flickerstreak@175: local ReAction = addonTable.ReAction flickerstreak@28: local L = ReAction.L flickerstreak@28: local _G = _G flickerstreak@53: local CreateFrame = CreateFrame flickerstreak@95: local format = string.format flickerstreak@28: flickerstreak@28: -- module declaration flickerstreak@28: local moduleID = "PetAction" flickerstreak@28: local module = ReAction:NewModule( moduleID ) flickerstreak@28: flickerstreak@130: -- Button class flickerstreak@130: local Button = ReAction.Button.PetAction flickerstreak@77: flickerstreak@102: flickerstreak@28: -- module methods flickerstreak@28: function module:OnInitialize() flickerstreak@63: ReAction:RegisterBarOptionGenerator(self, "GetBarOptions") flickerstreak@28: end flickerstreak@28: flickerstreak@53: flickerstreak@53: flickerstreak@53: flickerstreak@60: ---- Options ---- flickerstreak@102: local Handler = { } flickerstreak@102: local meta = { __index = Handler } flickerstreak@102: flickerstreak@102: function Handler:New(bar) flickerstreak@102: return setmetatable( flickerstreak@102: { flickerstreak@102: bar = bar, flickerstreak@102: config = bar.config flickerstreak@102: }, meta) flickerstreak@102: end flickerstreak@102: flickerstreak@102: function Handler:GetLockButtons() flickerstreak@130: return self.config.lockButtons flickerstreak@102: end flickerstreak@102: flickerstreak@102: function Handler:SetLockButtons(info, value) flickerstreak@102: self.config.lockButtons = value Flick@234: Button:UpdateButtonLock(self.bar) flickerstreak@102: end flickerstreak@102: flickerstreak@102: function Handler:GetLockButtonsCombat() flickerstreak@102: return self.config.lockButtonsCombat flickerstreak@102: end flickerstreak@102: flickerstreak@102: function Handler:SetLockButtonsCombat(info, value) flickerstreak@102: self.config.lockButtonsCombat = value Flick@234: Button:UpdateButtonLock(self.bar) flickerstreak@102: end flickerstreak@102: flickerstreak@102: function Handler:LockButtonsCombatDisabled() flickerstreak@130: return not self.config.lockButtons flickerstreak@102: end flickerstreak@102: flickerstreak@102: flickerstreak@60: function module:GetBarOptions(bar) flickerstreak@91: if bar.config.type == moduleID then flickerstreak@91: return { flickerstreak@91: type = "group", flickerstreak@91: name = L["Pet Buttons"], flickerstreak@102: handler = Handler:New(bar), flickerstreak@91: args = { flickerstreak@102: lockButtons = { flickerstreak@102: name = L["Lock Buttons"], flickerstreak@147: desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"], flickerstreak@102: order = 2, flickerstreak@102: type = "toggle", flickerstreak@102: get = "GetLockButtons", flickerstreak@102: set = "SetLockButtons", flickerstreak@102: }, flickerstreak@102: lockOnlyCombat = { flickerstreak@102: name = L["Only in Combat"], flickerstreak@102: desc = L["Only lock the buttons when in combat"], flickerstreak@102: order = 3, flickerstreak@102: type = "toggle", flickerstreak@102: disabled = "LockButtonsCombatDisabled", flickerstreak@102: get = "GetLockButtonsCombat", flickerstreak@102: set = "SetLockButtonsCombat", flickerstreak@102: }, flickerstreak@91: } flickerstreak@60: } flickerstreak@91: end flickerstreak@59: end flickerstreak@59: flickerstreak@53: