Mercurial > wow > reaction
diff Bar.lua @ 51:c964fb84560c
added anchor controls
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Tue, 22 Apr 2008 21:33:37 +0000 |
parents | c3c64e2def50 |
children | c9df7866ff31 |
line wrap: on
line diff
--- a/Bar.lua Tue Apr 22 20:37:44 2008 +0000 +++ b/Bar.lua Tue Apr 22 21:33:37 2008 +0000 @@ -60,6 +60,7 @@ f:SetWidth(config.width) f:SetHeight(config.height) local anchor = config.anchor + f:ClearAllPoints() if anchor then local anchorTo if config.anchorTo then @@ -71,6 +72,21 @@ end end +function Bar:SetAnchor(point, frame, relativePoint, x, y) + local c = self.config + c.anchor = point or c.anchor + c.anchorTo = frame and frame:GetName() or c.anchorTo + c.relativePoint = relativePoint or c.relativePoint + c.x = x or c.x + c.y = y or c.y + self:ApplyAnchor() +end + +function Bar:GetAnchor() + local c = self.config + return (c.anchor or "CENTER"), (c.anchorTo or self.frame:GetParent():GetName()), (c.relativePoint or c.anchor or "CENTER"), (c.x or 0), (c.y or 0) +end + function Bar:GetFrame() return self.frame end @@ -234,6 +250,7 @@ -- via frame nesting, hence good old foo's appearance here. local foo = CreateFrame("Frame",nil,f) foo:SetAllPoints() + foo:SetClampedToScreen(true) local control = CreateFrame("Button", nil, foo) control:EnableMouse(true)