Framework update

This commit is contained in:
Tercio Jose
2023-09-05 10:43:11 -03:00
parent d208be1fcc
commit 7e19b3071f
7 changed files with 562 additions and 49 deletions
+40 -10
View File
@@ -1,6 +1,6 @@
local dversion = 460
local dversion = 463
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -233,8 +233,8 @@ end
---return the role of the unit, this is safe to use for all versions of wow
---@param unitId string
---@param bUseSupport boolean
---@param specId number
---@param bUseSupport boolean?
---@param specId number?
---@return string
function DF.UnitGroupRolesAssigned(unitId, bUseSupport, specId)
if (not DF.IsTimewalkWoW()) then --Was function exist check. TBC has function, returns NONE. -Flamanis 5/16/2022
@@ -1501,6 +1501,11 @@ function DF:CheckPoints(point1, point2, point3, point4, point5, object)
return point1 or "topleft", point2, point3 or "topleft", point4 or 0, point5 or 0
end
---@class df_anchor : table
---@field side number 1-8: topleft to top (clockwise); 9: center; 10-13: inside left right top bottom; 14-17: inside topleft, bottomleft bottomright topright
---@field x number
---@field y number
local anchoringFunctions = {
function(frame, anchorTo, offSetX, offSetY) --1 TOP LEFT
frame:ClearAllPoints()
@@ -1547,30 +1552,54 @@ local anchoringFunctions = {
frame:SetPoint("center", anchorTo, "center", offSetX, offSetY)
end,
function(frame, anchorTo, offSetX, offSetY) --10
function(frame, anchorTo, offSetX, offSetY) --10 INSIDE LEFT
frame:ClearAllPoints()
frame:SetPoint("left", anchorTo, "left", offSetX, offSetY)
end,
function(frame, anchorTo, offSetX, offSetY) --11
function(frame, anchorTo, offSetX, offSetY) --11 INSIDE RIGHT
frame:ClearAllPoints()
frame:SetPoint("right", anchorTo, "right", offSetX, offSetY)
end,
function(frame, anchorTo, offSetX, offSetY) --12
function(frame, anchorTo, offSetX, offSetY) --12 INSIDE TOP
frame:ClearAllPoints()
frame:SetPoint("top", anchorTo, "top", offSetX, offSetY)
end,
function(frame, anchorTo, offSetX, offSetY) --13
function(frame, anchorTo, offSetX, offSetY) --13 INSIDE BOTTOM
frame:ClearAllPoints()
frame:SetPoint("bottom", anchorTo, "bottom", offSetX, offSetY)
end
end,
function(frame, anchorTo, offSetX, offSetY) --14 INSIDE TOPLEFT to TOPLEFT
frame:ClearAllPoints()
frame:SetPoint("topleft", anchorTo, "topleft", offSetX, offSetY)
end,
function(frame, anchorTo, offSetX, offSetY) --15 INSIDE BOTTOMLEFT to BOTTOMLEFT
frame:ClearAllPoints()
frame:SetPoint("bottomleft", anchorTo, "bottomleft", offSetX, offSetY)
end,
function(frame, anchorTo, offSetX, offSetY) --16 INSIDE BOTTOMRIGHT to BOTTOMRIGHT
frame:ClearAllPoints()
frame:SetPoint("bottomright", anchorTo, "bottomright", offSetX, offSetY)
end,
function(frame, anchorTo, offSetX, offSetY) --17 INSIDE TOPRIGHT to TOPRIGHT
frame:ClearAllPoints()
frame:SetPoint("topright", anchorTo, "topright", offSetX, offSetY)
end,
}
function DF:SetAnchor(widget, config, anchorTo)
---set the anchor point using a df_anchor table
---@param widget uiobject
---@param anchorTable df_anchor
---@param anchorTo uiobject
function DF:SetAnchor(widget, anchorTable, anchorTo)
anchorTo = anchorTo or widget:GetParent()
anchoringFunctions[config.side](widget, anchorTo, config.x, config.y)
anchoringFunctions[anchorTable.side](widget, anchorTo, anchorTable.x, anchorTable.y)
end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -2762,6 +2791,7 @@ end
elseif (widgetTable.type == "textentry") then
local textentry = DF:CreateTextEntry(parent, widgetTable.func or widgetTable.set, 120, 18, nil, "$parentWidget" .. index, nil, buttonTemplate)
textentry.align = widgetTable.align or "left"
local descPhraseId = getDescripttionPhraseID(widgetTable, languageAddonId, languageTable)
DetailsFramework.Language.RegisterTableKeyWithDefault(languageAddonId, textentry, "have_tooltip", descPhraseId, widgetTable.desc)