Mercurial > wow > reaction
comparison Bar.lua @ 103:890e4c4ab143
- added alpha settings (base and stateful)
- added scale settings (stateful only)
- updated overlay to work with stateful anchor/scale (though when in a state with scale, the button size/spacing can't be manipulated)
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Thu, 06 Nov 2008 01:28:07 +0000 |
parents | 39265b16d208 |
children | b2fb8f7dc780 |
comparison
equal
deleted
inserted
replaced
102:ad49739d110d | 103:890e4c4ab143 |
---|---|
36 local f = CreateFrame("Button", name and format("ReAction-%s",name), parent, | 36 local f = CreateFrame("Button", name and format("ReAction-%s",name), parent, |
37 "SecureHandlerStateTemplate, SecureHandlerClickTemplate") | 37 "SecureHandlerStateTemplate, SecureHandlerClickTemplate") |
38 f:SetFrameStrata("MEDIUM") | 38 f:SetFrameStrata("MEDIUM") |
39 f:SetWidth(self.width) | 39 f:SetWidth(self.width) |
40 f:SetWidth(self.height) | 40 f:SetWidth(self.height) |
41 f:SetAlpha(config.alpha or 1.0) | |
41 f:Show() | 42 f:Show() |
42 f:EnableMouse(false) | 43 f:EnableMouse(false) |
43 f:SetClampedToScreen(true) | 44 f:SetClampedToScreen(true) |
44 | 45 |
45 -- Override the default frame accessor to provide strict read-only access | 46 -- Override the default frame accessor to provide strict read-only access |
93 end | 94 end |
94 | 95 |
95 function Bar:SetAnchor(point, frame, relativePoint, x, y) | 96 function Bar:SetAnchor(point, frame, relativePoint, x, y) |
96 local c = self.config | 97 local c = self.config |
97 c.point = point or c.point | 98 c.point = point or c.point |
98 c.anchor = frame and frame:GetName() or c.anchor | 99 c.anchor = frame or c.anchor |
99 c.relpoint = relativePoint or c.relpoint | 100 c.relpoint = relativePoint or c.relpoint |
100 c.x = x or c.x | 101 c.x = x or c.x |
101 c.y = y or c.y | 102 c.y = y or c.y |
102 self:ApplyAnchor() | 103 self:ApplyAnchor() |
104 ReAction:RefreshBar(self) | |
103 end | 105 end |
104 | 106 |
105 function Bar:GetAnchor() | 107 function Bar:GetAnchor() |
106 local c = self.config | 108 local c = self.config |
107 return (c.point or "CENTER"), | 109 return (c.point or "CENTER"), |
184 -- only ReAction:RenameBar() should call this function. Calling from any other | 186 -- only ReAction:RenameBar() should call this function. Calling from any other |
185 -- context will desync the bar list in the ReAction class. | 187 -- context will desync the bar list in the ReAction class. |
186 function Bar:SetName(name) | 188 function Bar:SetName(name) |
187 self.name = name | 189 self.name = name |
188 self:SetLabel(self.name) -- Bar:SetLabel() defined in Overlay.lua | 190 self:SetLabel(self.name) -- Bar:SetLabel() defined in Overlay.lua |
191 end | |
192 | |
193 function Bar:GetAlpha() | |
194 return self.config.alpha or 1.0 | |
195 end | |
196 | |
197 function Bar:SetAlpha(value) | |
198 self.config.alpha = value | |
199 self:GetFrame():SetAlpha(value or 1.0) | |
200 ReAction:RefreshBar(self) | |
189 end | 201 end |
190 | 202 |
191 function Bar:AddButton(idx, button) | 203 function Bar:AddButton(idx, button) |
192 local f = self:GetFrame() | 204 local f = self:GetFrame() |
193 | 205 |