Mercurial > wow > reaction
comparison classes/GridProxy.lua @ 122:a2d2f23137c8
- Rearranged and consolidated some files in modules directory
- Added 'classes' directory, moved Bar and Overlay there
- Added Button, ActionButton, and GridProxy classes, not in use yet
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Mon, 23 Feb 2009 18:56:57 +0000 |
parents | |
children | 729232aeeb5e |
comparison
equal
deleted
inserted
replaced
121:fb6c3a642ae3 | 122:a2d2f23137c8 |
---|---|
1 -- | |
2 -- A hack for a ShowGrid secure handler, using a bastardized Blizzard ActionBarButton. | |
3 -- | |
4 local gridProxy = { } | |
5 ReAction.gridProxy = gridProxy | |
6 | |
7 local f = CreateFrame("CheckButton",nil,UIParent,"ActionBarButtonTemplate, SecureHandlerAttributeTemplate") | |
8 -- SecureHandlerAttributeTemplate overwrites the onAttributeChanged handler, as it's last in the list | |
9 f:UnregisterAllEvents() | |
10 f:SetScript("OnEnter",nil) | |
11 f:SetScript("OnLeave",nil) | |
12 f:SetScript("PostClick",nil) | |
13 f:SetScript("OnDragStart",nil) | |
14 f:SetScript("OnReceiveDrag",nil) | |
15 f:SetScript("OnUpdate",nil) | |
16 f:EnableMouse(false) | |
17 for _, child in ipairs({f:GetChildren()}) do | |
18 child:Hide() | |
19 end | |
20 for _, region in ipairs({f:GetRegions()}) do | |
21 region:Hide() | |
22 end | |
23 f:SetPoint("TOPLEFT") | |
24 f:Hide() | |
25 | |
26 -- The existing onEvent handler will set the 'showgrid' attribute | |
27 -- on this frame. Re-register for those events, but don't touch the | |
28 -- onEvent handler, to keep it secure. | |
29 f:RegisterEvent("ACTIONBAR_SHOWGRID"); | |
30 f:RegisterEvent("ACTIONBAR_HIDEGRID"); | |
31 | |
32 f:Execute( | |
33 [[ | |
34 frames = newtable() | |
35 ]]) | |
36 | |
37 -- shuttle 'showgrid' to the registered frames via state-showgrid attribute | |
38 f:SetAttribute("_onattributechanged", | |
39 -- function _onattributechanged(self,name,value) | |
40 [[ | |
41 if name == "showgrid" then | |
42 for _, f in pairs(frames) do | |
43 f:SetAttribute("state-showgrid",value) | |
44 end | |
45 end | |
46 ]]) | |
47 | |
48 function gridProxy:AddFrame(frame) | |
49 f:SetFrameRef("add",frame) | |
50 f:SetAttribute("frame-add-id",frame:GetName()) | |
51 f:Execute( | |
52 [[ | |
53 frames[self:GetAttribute("frame-add-id")] = self:GetFrameRef("add") | |
54 ]]) | |
55 end | |
56 | |
57 function gridProxy:RemoveFrame(frame) | |
58 f:SetAttribute("frame-remove-id",frame:GetName()) | |
59 f:Execute( | |
60 [[ | |
61 frames[self:GetAttribute("frame-remove-id")] = nil | |
62 ]]) | |
63 end | |
64 | |
65 |