9405379 - Add focus frame
[wowui.git] / OmaRF / RaidFrame.lua
index 461d4dc..1f4bc87 100644 (file)
@@ -96,6 +96,7 @@ local function frameShow(frame)
     frame:RegisterEvent("READY_CHECK");
     frame:RegisterEvent("READY_CHECK_CONFIRM");
     frame:RegisterEvent("READY_CHECK_FINISHED");
     frame:RegisterEvent("READY_CHECK");
     frame:RegisterEvent("READY_CHECK_CONFIRM");
     frame:RegisterEvent("READY_CHECK_FINISHED");
+    if frame.unit == "focus" then frame:RegisterEvent("PLAYER_FOCUS_CHANGED") end
     registerEvents(frame);
     frame:SetScript("OnUpdate", unitUpdate);
     unitEvent(frame, "UPDATE_ALL_BARS", frame.displayed);
     registerEvents(frame);
     frame:SetScript("OnUpdate", unitUpdate);
     unitEvent(frame, "UPDATE_ALL_BARS", frame.displayed);
@@ -306,12 +307,27 @@ local function initializeRaid(parent)
     end
 end
 
     end
 end
 
+local function initializeFocus(parent)
+    local secure = CreateFrame("Button", "OmaFocusSecure", parent, inheritedFrames);
+    local frame = CreateFrame("Frame", "OmaFocus", parent);
+    local unit = "focus";
+    secure:SetPoint("BOTTOMLEFT", parent, "TOPLEFT");
+    frame:SetPoint("BOTTOMLEFT", parent, "TOPLEFT");
+    setupFrame(frame, secure, unit);
+    RegisterUnitWatch(frame);
+    RegisterUnitWatch(secure);
+    local vehicle = format("[@%s,unithasvehicleui] vehicle; no", unit);
+    RegisterStateDriver(secure, "vehicleui", vehicle);
+    secure:SetAttribute("_onstate-vehicleui", vehicletoggle);
+end
+
 local function initialize()
     CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY);
     CFrame:SetHeight((height+2)*8);
     CFrame:SetWidth((width+2)*5+1);
     initializeParty(CFrame);
     initializeRaid(CFrame);
 local function initialize()
     CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY);
     CFrame:SetHeight((height+2)*8);
     CFrame:SetWidth((width+2)*5+1);
     initializeParty(CFrame);
     initializeRaid(CFrame);
+    initializeFocus(CFrame);
 end
 
 local function loadCharSettings()
 end
 
 local function loadCharSettings()