I checked ElvUi since his and TukUi always have some nice code pieces to look at.
When building the new rABS for MoP I stepped aways from bar paging because I had no clue how to apply the bar state to protected children (buttons). Actually thats the reason why I had to keep the default OverrideActionBar alive.
But there is a solution for this:
Lua Code:
control:ChildUpdate("snippetid", message)
executes the contents of "_childupdate-snippetid" (or, if that attribute is nil/false, "_childupdate"), on all protected children (and children of children) of the restricted environment owner with (self, scriptid, message) arguments.
The interesting code snippets of Elv UI are
Lua Code:
AB["barDefaults"] = {
["bar1"] = {
['visibility'] = "[petbattle] hide; show", --[petbattle][overridebar][vehicleui] hide; show
['page'] = 1,
['conditions'] = string.format("[vehicleui] %d; [possessbar] %d; [overridebar] %d; [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6;", GetVehicleBarIndex(), GetVehicleBarIndex(), GetOverrideBarIndex()),
},
}
RegisterStateDriver(bar, "page", self:GetPage(barName, self['barDefaults'][barName].page, self['barDefaults'][barName].conditions));
--basically returns this: [vehicleui] GetVehicleBarIndex(); [possessbar] GetVehicleBarIndex(); [overridebar] GetOverrideBarIndex(); [bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; 1"
RegisterStateDriver(bar, "visibility", self['barDefaults'][barName].visibility)
bar:SetAttribute("_onstate-page", [[
self:SetAttribute("state", newstate)
control:ChildUpdate("state", newstate)
]])
The problem that we have when building an actionbar on our own is to reproduce this function in the ActionBarController. It handles the actionpage swap on conditions.
Lua Code:
function ActionBarController_UpdateAll()
PossessBar_Update();
StanceBar_Update();
CURRENT_ACTION_BAR_STATE = LE_ACTIONBAR_STATE_MAIN;
-- If we have a skinned vehicle bar or skinned override bar, display the OverrideActionBar
if ((HasVehicleActionBar() and UnitVehicleSkin("player") and UnitVehicleSkin("player") ~= "")
or (HasOverrideActionBar() and GetOverrideBarSkin() and GetOverrideBarSkin() ~= "")) then
-- For now, a vehicle has precedence over override bars (hopefully designers make it so these never conflict)
if (HasVehicleActionBar()) then
OverrideActionBar_Setup(UnitVehicleSkin("player"), GetVehicleBarIndex());
else
OverrideActionBar_Setup(GetOverrideBarSkin(), GetOverrideBarIndex());
end
CURRENT_ACTION_BAR_STATE = LE_ACTIONBAR_STATE_OVERRIDE;
-- If we have a non-skinned override bar of some sort, use the MainMenuBarArtFrame
elseif ( HasBonusActionBar() or HasOverrideActionBar() or HasVehicleActionBar() or HasTempShapeshiftActionBar() or C_PetBattles.IsInBattle() ) then
if (HasVehicleActionBar()) then
MainMenuBarArtFrame:SetAttribute("actionpage", GetVehicleBarIndex());
elseif (HasOverrideActionBar()) then
MainMenuBarArtFrame:SetAttribute("actionpage", GetOverrideBarIndex());
elseif (HasTempShapeshiftActionBar()) then
MainMenuBarArtFrame:SetAttribute("actionpage", GetTempShapeshiftBarIndex());
elseif (HasBonusActionBar() and GetActionBarPage() == 1) then
MainMenuBarArtFrame:SetAttribute("actionpage", GetBonusBarIndex());
else
MainMenuBarArtFrame:SetAttribute("actionpage", GetActionBarPage());
end
for i=1, NUM_ACTIONBAR_BUTTONS do
local button = _G["ActionButton"..i];
ActionButton_UpdateAction(button);
end
else
-- Otherwise, display the normal action bar
ActionBarController_ResetToDefault();
end
ValidateActionBarTransition();
end
In vehicle and possess state ElvUI uses the ID from GetVehicleBarIndex().
In overridebar state ElvUI uses the ID from GetOverrideBarIndex().
There is no state for temp shapeshift and bonusbar.
So basically what ElvUi does is creating an actionbar on its own using LibActionButton-1.0.
On page-state the bar state swaps and additionally all children swap aswell.
Regarding rABS. I have no clue why the bar should not show up.
The only reason I could think of is the [overridebar] firing without actually loading the OverrideActionbar and instead loading the override actionbuttons into the main actionbar. This would result in me removing the main actionbar and showing an probably empty (?!) overridebar. No clue.