Mercurial > wow > reaction
diff ReBar.lua @ 2:8e0ff8ae4c08
Version 0.2
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Tue, 20 Mar 2007 21:08:31 +0000 |
parents | c11ca1d8ed91 |
children |
line wrap: on
line diff
--- a/ReBar.lua Tue Mar 20 21:03:57 2007 +0000 +++ b/ReBar.lua Tue Mar 20 21:08:31 2007 +0000 @@ -2,7 +2,6 @@ -- private constants local insideFrame = 1 local outsideFrame = 2 -local _G = getfenv(0) -- global variable table local pointFindTable = { BOTTOMLEFT = function(f) return f:GetLeft(), f:GetBottom() end, @@ -26,6 +25,9 @@ LEFT = "RIGHT" } +local anchoredLabelColor = { r =0.6, g = 0.2, b = 1.0 } +local nonAnchoredLabelColor = { r = 1.0, g = 0.82, b = 0.0 } + -- private variables local stickyTargets = { [UIParent] = insideFrame, @@ -40,7 +42,7 @@ function ReBar.prototype:init( config, id ) ReBar.super.prototype.init(self) - local buttonClass = config and config.btnConfig and config.btnConfig.type and _G[config.btnConfig.type] + local buttonClass = config and config.btnConfig and config.btnConfig.type and getglobal(config.btnConfig.type) self.config = config self.barID = id self.class = { button = buttonClass } @@ -48,11 +50,13 @@ -- create the bar and control widgets self.barFrame = CreateFrame("Frame", "ReBar_"..self.barID, UIParent, "ReBarTemplate") - self.controlFrame = _G[self.barFrame:GetName().."Controls"] + self.controlFrame = getglobal(self.barFrame:GetName().."Controls") self.controlFrame.reBar = self + self.barFrame:SetClampedToScreen(true) -- set the text label on the control widget - _G[self.controlFrame:GetName().."LabelString"]:SetText(id) + self.labelString = getglobal(self.controlFrame:GetName().."LabelString") + self.labelString:SetText(id) -- initialize the bar layout self:ApplySize() @@ -68,7 +72,6 @@ dewdrop:FeedAceOptionsTable(ReActionGlobalMenuOptions) dewdrop:FeedAceOptionsTable(GenerateReActionBarOptions(self)) dewdrop:FeedAceOptionsTable(GenerateReActionButtonOptions(self)) - dewdrop:FeedAceOptionsTable(ReActionProfileMenuOptions) end, 'cursorX', true, 'cursorY', true @@ -82,9 +85,11 @@ dewdrop:Unregister(self.barFrame) end + self:HideControls() self.barFrame:Hide() self.barFrame:ClearAllPoints() self.barFrame:SetParent(nil) + self.barFrame:SetPoint("BOTTOMRIGHT", UIParent, "TOPLEFT", 0, 0) -- need to keep around self.config for dewdrop menus in the process of deleting self @@ -107,6 +112,9 @@ -- show/hide the control frame function ReBar.prototype:ShowControls() self.controlFrame:Show() + for _, b in ipairs(self.buttons) do + b:BarUnlocked() + end end function ReBar.prototype:HideControls() @@ -119,6 +127,9 @@ if self.barFrame == dewdrop:GetOpenedParent() then dewdrop:Close() end + for _, b in ipairs(self.buttons) do + b:BarLocked() + end self.controlFrame:Hide() end @@ -165,8 +176,15 @@ function ReBar.prototype:ApplyAnchor() local a = self.config.anchor local f = self.barFrame - f:ClearAllPoints() - f:SetPoint(a.point,getglobal(a.to),a.relPoint,a.x,a.y) + if a then + f:ClearAllPoints() + f:SetPoint(a.point,getglobal(a.to),a.relPoint,a.x,a.y) + local color = anchoredLabelColor + if a.to == "UIParent" or a.to == "WorldFrame" then + color = nonAnchoredLabelColor + end + self.labelString:SetTextColor(color.r, color.g, color.b) + end end function ReBar.prototype:ApplyVisibility()