Mercurial > wow > reaction
diff modules/ReAction_ConfigUI/ReAction_ConfigUI.lua @ 51:c964fb84560c
added anchor controls
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Tue, 22 Apr 2008 21:33:37 +0000 |
parents | c3c64e2def50 |
children | c9df7866ff31 |
line wrap: on
line diff
--- a/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Tue Apr 22 20:37:44 2008 +0000 +++ b/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Tue Apr 22 21:33:37 2008 +0000 @@ -7,9 +7,23 @@ -- local imports local ReAction = ReAction local L = ReAction.L +local _G = _G local AceConfigReg = LibStub("AceConfigRegistry-3.0") local AceConfigDialog = LibStub("AceConfigDialog-3.0") +-- some constants +local pointTable = { + CENTER = L["Center"], + LEFT = L["Left"], + RIGHT = L["Right"], + TOP = L["Top"], + BOTTOM = L["Bottom"], + TOPLEFT = L["Top Left"], + TOPRIGHT = L["Top Right"], + BOTTOMLEFT = L["Bottom Left"], + BOTTOMRIGHT = L["Bottom Right"], +} + -- module declaration local moduleID = "ConfigUI" local module = ReAction:NewModule( moduleID, @@ -85,10 +99,76 @@ desc = function() return bar:GetName() end, confirm = true, func = function() ReAction:EraseBar(bar) end, - order = -1 + order = 2 }, - - } + anchor = { + type = "group", + name = L["Anchor"], + inline = true, + args = { + frame = { + type = "input", + name = L["Frame"], + desc = L["The frame that the bar is anchored to"], + get = function() local _, f = bar:GetAnchor(); return f end, + set = function(info, val) bar:SetAnchor(nil,val) end, + validate = function(info, name) + if name then + local f = ReAction:GetBar(name) + if f then + return true + else + f = _G[name] + if f and type(f) == "table" and f.IsObjectType and f:IsObjectType("Frame") then + return true + end + end + end + return false + end, + width = "double", + order = 1 + }, + point = { + type = "select", + name = L["Point"], + desc = L["Anchor point on the bar frame"], + style = "dropdown", + get = function() return bar:GetAnchor() end, + set = function(info, val) bar:SetAnchor(val) end, + values = pointTable, + order = 2, + }, + relativePoint = { + type = "select", + name = L["Relative Point"], + desc = L["Anchor point on the target frame"], + style = "dropdown", + get = function() local p,f,r = bar:GetAnchor(); return r end, + set = function(info, val) bar:SetAnchor(nil,nil,val) end, + values = pointTable, + order = 3, + }, + x = { + type = "input", + pattern = "\-?%d+", + name = L["X offset"], + get = function() local p,f,r,x = bar:GetAnchor(); return x end, + set = function(info,val) bar:SetAnchor(nil,nil,nil,val) end, + order = 4 + }, + y = { + type = "input", + pattern = "\-?%d+", + name = L["Y offset"], + get = function() local p,f,r,x,y = bar:GetAnchor(); return y end, + set = function(info,val) bar:SetAnchor(nil,nil,nil,nil,val) end, + order = 5 + }, + }, + order = 3 + }, + }, }, },