comparison 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
comparison
equal deleted inserted replaced
50:c3c64e2def50 51:c964fb84560c
5 --]] 5 --]]
6 6
7 -- local imports 7 -- local imports
8 local ReAction = ReAction 8 local ReAction = ReAction
9 local L = ReAction.L 9 local L = ReAction.L
10 local _G = _G
10 local AceConfigReg = LibStub("AceConfigRegistry-3.0") 11 local AceConfigReg = LibStub("AceConfigRegistry-3.0")
11 local AceConfigDialog = LibStub("AceConfigDialog-3.0") 12 local AceConfigDialog = LibStub("AceConfigDialog-3.0")
13
14 -- some constants
15 local pointTable = {
16 CENTER = L["Center"],
17 LEFT = L["Left"],
18 RIGHT = L["Right"],
19 TOP = L["Top"],
20 BOTTOM = L["Bottom"],
21 TOPLEFT = L["Top Left"],
22 TOPRIGHT = L["Top Right"],
23 BOTTOMLEFT = L["Bottom Left"],
24 BOTTOMRIGHT = L["Bottom Right"],
25 }
12 26
13 -- module declaration 27 -- module declaration
14 local moduleID = "ConfigUI" 28 local moduleID = "ConfigUI"
15 local module = ReAction:NewModule( moduleID, 29 local module = ReAction:NewModule( moduleID,
16 "AceEvent-3.0" 30 "AceEvent-3.0"
83 type = "execute", 97 type = "execute",
84 name = L["Delete Bar"], 98 name = L["Delete Bar"],
85 desc = function() return bar:GetName() end, 99 desc = function() return bar:GetName() end,
86 confirm = true, 100 confirm = true,
87 func = function() ReAction:EraseBar(bar) end, 101 func = function() ReAction:EraseBar(bar) end,
88 order = -1 102 order = 2
89 }, 103 },
90 104 anchor = {
91 } 105 type = "group",
106 name = L["Anchor"],
107 inline = true,
108 args = {
109 frame = {
110 type = "input",
111 name = L["Frame"],
112 desc = L["The frame that the bar is anchored to"],
113 get = function() local _, f = bar:GetAnchor(); return f end,
114 set = function(info, val) bar:SetAnchor(nil,val) end,
115 validate = function(info, name)
116 if name then
117 local f = ReAction:GetBar(name)
118 if f then
119 return true
120 else
121 f = _G[name]
122 if f and type(f) == "table" and f.IsObjectType and f:IsObjectType("Frame") then
123 return true
124 end
125 end
126 end
127 return false
128 end,
129 width = "double",
130 order = 1
131 },
132 point = {
133 type = "select",
134 name = L["Point"],
135 desc = L["Anchor point on the bar frame"],
136 style = "dropdown",
137 get = function() return bar:GetAnchor() end,
138 set = function(info, val) bar:SetAnchor(val) end,
139 values = pointTable,
140 order = 2,
141 },
142 relativePoint = {
143 type = "select",
144 name = L["Relative Point"],
145 desc = L["Anchor point on the target frame"],
146 style = "dropdown",
147 get = function() local p,f,r = bar:GetAnchor(); return r end,
148 set = function(info, val) bar:SetAnchor(nil,nil,val) end,
149 values = pointTable,
150 order = 3,
151 },
152 x = {
153 type = "input",
154 pattern = "\-?%d+",
155 name = L["X offset"],
156 get = function() local p,f,r,x = bar:GetAnchor(); return x end,
157 set = function(info,val) bar:SetAnchor(nil,nil,nil,val) end,
158 order = 4
159 },
160 y = {
161 type = "input",
162 pattern = "\-?%d+",
163 name = L["Y offset"],
164 get = function() local p,f,r,x,y = bar:GetAnchor(); return y end,
165 set = function(info,val) bar:SetAnchor(nil,nil,nil,nil,val) end,
166 order = 5
167 },
168 },
169 order = 3
170 },
171 },
92 }, 172 },
93 }, 173 },
94 174
95 } 175 }
96 end 176 end