local menuButtons = {PlayerPowerBarAlt} 

local DPPBA = Dominos:NewModule('PlayerPowerBarAlt')
local PPBA = Dominos:CreateClass('Frame', Dominos.Frame)

function DPPBA:Load()
	self.frame = PPBA:New()
	self.frame:SetFrameStrata('MEDIUM')
end

function DPPBA:Unload()
	self.frame:Free()
end

function PPBA:New()
	local f = self.super.New(self, 'alt power')
	if not f.value then
		f:SetFrameStrata('DIALOG')
		f:LoadButtons()
	end
	return f
end

function PPBA:GetDefaults()
	return {
		scale = 1,
		point = 'CENTER',
		y = 0,
		x = 0,
	}
end

function PPBA:NumButtons()
	return #menuButtons
end

local w, h
function PPBA:AddButton()
	self:RegisterEvent("UNIT_POWER_BAR_SHOW");
	self:RegisterEvent("UNIT_POWER_BAR_HIDE");
	self:RegisterEvent("PLAYER_ENTERING_WORLD");

	self:SetScript("OnEvent", function(self, event)
		if event == "UNIT_POWER_BAR_SHOW" then
			w, h = PlayerPowerBarAlt:GetSize()
			self:SetWidth(w)
			self:SetHeight(h)
		else
			self:SetWidth(30)
			self:SetHeight(30)
		end
	end)

	PlayerPowerBarAlt:SetParent(self)
	PlayerPowerBarAlt:SetScript("OnUpdate", function() self:Layout() end)
	self.buttons[1] = PlayerPowerBarAlt
	self:Layout()
end