rendered paste body-- bit from OnInitialize
self:CreateAnchor("Default", "Timer bars will appear here.")
self:CreateAnchor("Cooldown", "Cooldown bars will appear here".)
self:CreateAnchor("Cast", "Casting bars will appear here".)
self:CreateAnchor("Buff", "Buff bars will appear here".)
function HostelBar:CreateAnchor(name, text)
local id = "anchor"..name
self[id] = CreateFrame("Button")
self[id].owner = self
self[id]:ClearAllPoints()
self[id]:SetWidth(200)
self[id]:SetHeight(25)
if self.db.profile[id.."x"] and self.db.profile[id.."y"] then
self[id]:SetPoint("TOPLEFT", UIParent, "TOPLEFT", self.db.profile[id.."x"], self.db.profile[id.."y"])
else
self[id]:SetPoint("TOP", UIErrorsFrame, "BOTTOM", 0, 0)
end
self[id]:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = false, tileSize = 16, edgeSize = 16,
insets = { left = 5, right =5, top = 5, bottom = 5 }})
self[id]:SetBackdropColor(1,0,0,.6)
self[id]:SetMovable(true)
self[id]:RegisterForDrag("LeftButton")
self[id]:SetScript("OnDragStart", function() this.owner[id]:StartMoving() end )
self[id]:SetScript("OnDragStop",
function()
this.owner[id]:StopMovingOrSizing()
local _,_,_,x,y = this:GetPoint("CENTER")
this.owner.db.profile[id.."x"] = x
this.owner.db.profile[id.."y"] = y
end
)
self[id]["text"] = self[id]:CreateFontString(nil, "OVERLAY")
self[id]["text"].owner = self
self[id]["text"]:SetFontObject(GameFontNormalSmall)
self[id]["text"]:ClearAllPoints()
self[id]["text"]:SetTextColor(1, 1, 1, 1)
self[id]["text"]:SetWidth(200)
self[id]["text"]:SetHeight(25)
self[id]["text"]:SetPoint("TOPLEFT", self[id], "TOPLEFT")
self[id]["text"]:SetJustifyH("CENTER")
self[id]["text"]:SetJustifyV("MIDDLE")
self[id]["text"]:SetText(text)
self[id]:Hide()
end