This commit is contained in:
Bunny67
2018-06-10 16:40:27 +03:00
parent 5bb1121ea1
commit efd6ee12e2
12 changed files with 544 additions and 89 deletions
-42
View File
@@ -16,46 +16,4 @@
<Cooldown name="oUF_CooldownFrameTemplate" inherits="CooldownFrameTemplate" drawEdge="true" virtual="true"/>
Sub-object as a child of the parent unit frame:
<Button name="oUF_HeaderTargetTemplate" inherits="SecureUnitButtonTemplate" virtual="true">
<Frames>
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
<Attributes>
<Attribute name="unitsuffix" type="string" value="target"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
</Attributes>
</Button>
</Frames>
</Button>
Separate unit template example:
<Button name="oUF_HeaderSeparateSubOjectsTemplate" inherits="SecureUnitButtonTemplate" virtual="true">
<Attributes>
<Attribute name="oUF-onlyProcessChildren" type="boolean" value="true"/>
</Attributes>
<Frames>
<Button name="$parentUnit" inherits="SecureUnitButtonTemplate">
<Attributes>
<Attribute name="useparent-unit" type="boolean" value="true"/>
</Attributes>
</Button>
<Button name="$parentPet" inherits="SecureUnitButtonTemplate">
<Attributes>
<Attribute name="unitsuffix" type="string" value="pet"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
</Attributes>
</Button>
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
<Attributes>
<Attribute name="unitsuffix" type="string" value="target"/>
<Attribute name="useparent-unit" type="boolean" value="true"/>
</Attributes>
</Button>
</Frames>
</Button>
</Ui>
+17 -19
View File
@@ -282,7 +282,7 @@ local function initObject(unit, style, styleFunc, header, ...)
for i = 1, num do
local object = arg[i]
local objectUnit = object.guessUnit or unit
local suffix = match(objectUnit or unit, "%w+target")
local suffix = objectUnit and match(objectUnit or unit, "%w+target")
object.__elements = {}
object.__registeredEvents = {}
@@ -331,7 +331,6 @@ local function initObject(unit, style, styleFunc, header, ...)
styleFunc(object, objectUnit, not header)
object:SetScript("OnAttributeChanged", onAttributeChanged)
object:SetScript("OnShow", function() onShow(this) end)
activeElements[object] = {}
@@ -359,7 +358,6 @@ local function walkObject(object, unit)
-- Check if we should leave the main frame blank.
if(object.onlyProcessChildren) then
object.hasChildren = true
object:SetScript("OnAttributeChanged", onAttributeChanged)
return initObject(unit, style, styleFunc, header, object:GetChildren())
end
@@ -542,8 +540,8 @@ do
end
self.menu = togglemenu
self:SetAttribute("type1", "target")
self:SetAttribute("type2", "menu")
--self:SetAttribute("type1", "target")
--self:SetAttribute("type2", "menu")
self.guessUnit = unit
self.unit = "player"
-- self.onlyProcessChildren =true
@@ -552,18 +550,18 @@ do
styleProxy(nil, self:GetName())
end
-- local setAttribute = function(self, name, value)
-- if self.attributes[name] ~= value then
-- self.attributes[name] = value
local setAttribute = function(self, name, value)
if self.attributes[name] ~= value then
self.attributes[name] = value
-- if self:IsVisible() then
-- SecureGroupHeader_Update(self)
-- end
-- end
-- end
-- local getAttribute = function(self, name)
-- return self.attributes[name]
-- end
if self:IsVisible() then
SecureGroupHeader_Update(self)
end
end
end
local getAttribute = function(self, name)
return self.attributes[name]
end
--[[ oUF:SpawnHeader(overrideName, template, visibility, ...)
Used to create a group header and apply the currently active style to it.
@@ -594,10 +592,10 @@ do
header:Hide()
header.attributes = {}
-- header.SetAttribute = SetAttribute
-- header.GetAttribute = GetAttribute
header.SetAttribute = setAttribute
header.GetAttribute = getAttribute
header:SetAttribute("template", "SecureUnitButtonTemplate")
--header:SetAttribute("template", "SecureUnitButtonTemplate")
for i = 1, getn(arg), 2 do
local att, val = select(i, unpack(arg))
if(not att) then break end
+4 -3
View File
@@ -1,5 +1,6 @@
local pairs = pairs
local ipairs = ipairs
local upper = string.upper
local unitExistsWatchers = {}
local unitExistsCache = setmetatable({},{
@@ -94,7 +95,7 @@ end
-- Given a point return the opposite point and which axes the point
-- depends on.
local function getRelativePointAnchor(point)
point = strupper(point)
point = upper(point)
if point == "TOP" then
return "BOTTOM", 0, -1
elseif point == "BOTTOM" then
@@ -139,7 +140,7 @@ local function fillTable(tbl, ...)
for key in pairs(tbl) do
tbl[key] = nil
end
for i = 1, getn(arg), 1 do
for i = 1, arg.n, 1 do
local key = arg[i]
key = tonumber(key) or key
tbl[key] = true
@@ -150,7 +151,7 @@ end
-- the array portion of the table in order
local function doubleFillTable(tbl, ...)
fillTable(tbl, unpack(arg))
for i = 1, getn(arg), 1 do
for i = 1, arg.n, 1 do
tbl[i] = arg[i]
end
end