local addonName,addonData = ...
local actionBarFrame = CreateFrame("Frame","XUI_ActionBar_Frame",UIParent,"SecureHandlerStateTemplate,SecureHandlerAttributeTemplate,SecureHandlerShowHideTemplate")
local eventFrame = CreateFrame("Frame","XUI_ActionBar_Events")
local function CheckEvents(self,event,...)
local args = { ... }
if ( event == "ADDON_LOADED" and args[1] == addonName ) then
actionBarFrame:SetPoint("CENTER",UIParent,"CENTER",0,0)
actionBarFrame:SetAttribute( "XUI_ActionType","ACTIONBUTTON" )
-- As a standalone Action Bar
actionBarFrame:SetAttribute( "actionpage", GetTempShapeshiftBarIndex() );
-- As a page on the Main Action Bar
--actionBarFrame:SetAttribute( "actionpage", 1 );
actionBarFrame.Buttons = { }
local lastButton = nil
for i = 1,12 do
actionBarFrame.Buttons[i] = CreateFrame("CheckButton","$parent_Button_"..i,actionBarFrame,"SecureActionButtonTemplate,ActionBarButtonTemplate")
actionBarFrame.Buttons[i]:SetID(i)
actionBarFrame.Buttons[i]:SetAttribute("action", i );
actionBarFrame.Buttons[i]:Show()
if ( lastButton ) then
actionBarFrame.Buttons[i]:SetPoint("TOPLEFT",actionBarFrame.Buttons[i-1],"TOPRIGHT",1,0)
else
actionBarFrame.Buttons[i]:SetPoint("TOPLEFT",actionBarFrame,"TOPLEFT",1,0)
end
lastButton = actionBarFrame.Buttons[i]
ActionButton_UpdateAction(lastButton);
end
-- As a standalone Action Bar
RegisterStateDriver( actionBarFrame, "visibility", "[petbattle] hide; [shapeshift] show" );
-- As a page on the Main Action Bar
--RegisterStateDriver( actionBarFrame, "visibility", "[petbattle] hide; show" );
actionBarFrame:Execute(
[[
ChildList = newtable( self:GetChildren() );
ActionButtons = newtable();
actionType = self:GetAttribute( "XUI_ActionType" );
local j = 1;
for i, child in ipairs( ChildList ) do
if child:GetAttribute( "XUI_ActionType" ) then
ActionButtons[j] = child;
j = j+1;
end
end
]]
);
-- As a page on the Main Action Bar
--RegisterStateDriver(actionBarFrame, "page", "[vehicleui] GetVehicleBarIndex(); [shapeshift] GetTempShapeshiftBarIndex(); [extrabar] GetExtraBarIndex(); [overridebar] GetOverrideBarIndex(); [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; [bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10; [bonusbar:5] 11;1" );
actionBarFrame:Show()
end
end
eventFrame:RegisterEvent("ACTIONBAR_UPDATE_STATE")
eventFrame:RegisterEvent("ADDON_LOADED")
eventFrame:RegisterEvent("ACTIONBAR_PAGE_CHANGED")
eventFrame:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
eventFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")
eventFrame:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR")
eventFrame:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
eventFrame:RegisterEvent("UPDATE_POSSESS_BAR")
eventFrame:RegisterEvent("UPDATE_EXTRA_ACTIONBAR")
eventFrame:SetScript("OnEvent",CheckEvents)