mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-25 05:20:49 +00:00
skin: make all default frames movable
This commit is contained in:
+51
@@ -101,6 +101,57 @@ function pfUI.api.CreateGoldString(money)
|
|||||||
return string
|
return string
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- [ Enable Movable ]
|
||||||
|
-- Set all necessary functions to make a already existing frame movable.
|
||||||
|
-- 'name' [string] Name of the Frame that should be movable
|
||||||
|
-- 'addon' [string] Addon that must be loaded before being able to access the frame
|
||||||
|
-- 'blacklist' [table] A list of frames that should be deactivated for mouse usage
|
||||||
|
function pfUI.api.EnableMovable(name, addon, blacklist)
|
||||||
|
if addon then
|
||||||
|
local scan = CreateFrame("Frame")
|
||||||
|
scan:RegisterEvent("ADDON_LOADED")
|
||||||
|
scan:SetScript("OnEvent", function()
|
||||||
|
if arg1 == addon then
|
||||||
|
local frame = _G[name]
|
||||||
|
|
||||||
|
if blacklist then
|
||||||
|
for _, disable in pairs(blacklist) do
|
||||||
|
_G[disable]:EnableMouse(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
frame:SetMovable(true)
|
||||||
|
frame:EnableMouse(true)
|
||||||
|
frame:SetScript("OnMouseDown",function()
|
||||||
|
this:StartMoving()
|
||||||
|
end)
|
||||||
|
|
||||||
|
frame:SetScript("OnMouseUp",function()
|
||||||
|
this:StopMovingOrSizing()
|
||||||
|
end)
|
||||||
|
this:UnregisterAllEvents()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
if blacklist then
|
||||||
|
for _, disable in pairs(blacklist) do
|
||||||
|
_G[disable]:EnableMouse(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local frame = _G[name]
|
||||||
|
frame:SetMovable(true)
|
||||||
|
frame:EnableMouse(true)
|
||||||
|
frame:SetScript("OnMouseDown",function()
|
||||||
|
this:StartMoving()
|
||||||
|
end)
|
||||||
|
|
||||||
|
frame:SetScript("OnMouseUp",function()
|
||||||
|
this:StopMovingOrSizing()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- [ Copy Table ]
|
-- [ Copy Table ]
|
||||||
-- By default a table assignment only will be a reference instead of a copy.
|
-- By default a table assignment only will be a reference instead of a copy.
|
||||||
-- This is used to create a replicate of the actual table.
|
-- This is used to create a replicate of the actual table.
|
||||||
|
|||||||
@@ -3,6 +3,23 @@ pfUI:RegisterModule("skin", function ()
|
|||||||
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight()-20)
|
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight()-20)
|
||||||
GameMenuFrame:SetWidth(GameMenuFrame:GetWidth()-30)
|
GameMenuFrame:SetWidth(GameMenuFrame:GetWidth()-30)
|
||||||
|
|
||||||
|
-- movable default frames
|
||||||
|
EnableMovable("CharacterFrame", nil, { "PaperDollFrame",
|
||||||
|
"PetPaperDollFrame", "ReputationFrame", "SkillFrame", "HonorFrame" } )
|
||||||
|
|
||||||
|
EnableMovable("QuestLogFrame")
|
||||||
|
EnableMovable("FriendsFrame")
|
||||||
|
EnableMovable("SpellBookFrame")
|
||||||
|
EnableMovable("GossipFrame")
|
||||||
|
EnableMovable("TradeFrame")
|
||||||
|
EnableMovable("MerchantFrame")
|
||||||
|
EnableMovable("DressUpFrame")
|
||||||
|
|
||||||
|
EnableMovable("TalentFrame", "Blizzard_TalentUI")
|
||||||
|
EnableMovable("TradeSkillFrame", "Blizzard_TradeSkillUI")
|
||||||
|
EnableMovable("ClassTrainerFrame", "Blizzard_TrainerUI")
|
||||||
|
EnableMovable("InspectFrame", "Blizzard_InspectUI", { "InspectHonorFrame" })
|
||||||
|
|
||||||
_, class = UnitClass("player")
|
_, class = UnitClass("player")
|
||||||
local color = RAID_CLASS_COLORS[class]
|
local color = RAID_CLASS_COLORS[class]
|
||||||
local cr, cg, cb = color.r , color.g, color.b
|
local cr, cg, cb = color.r , color.g, color.b
|
||||||
|
|||||||
Reference in New Issue
Block a user