--[[
	OverrideBar.lua
		A Dominos vehicle bar
--]]

--[[ Vehicle Bar ]]--

local OverrideBar = Dominos:CreateClass('Frame', Dominos.Frame)
Dominos.OverrideBar  = OverrideBar

local L = LibStub('AceLocale-3.0'):GetLocale('Dominos')
local MAX_ALT_SPELLBUTTONS = 6

function OverrideBar:New()
	local f = self.super.New(self, 'override', L.TipVehicleBar)
	f:LoadButtons()
	f:Layout()

	return f
end

function OverrideBar:GetDefaults()
	return {
		point = 'CENTER',
		x = -244,
		y = 0,
		numButtons = MAX_ALT_SPELLBUTTONS
	}
end

function OverrideBar:AddButton(i)
	local buttonName = string.format('OverrideActionBarButton%d', i)
	local b = _G[buttonName]
	
	if b then
		b:ClearAllPoints()
		b:SetParent(self.header)
		b:Show()

		self.buttons[i] = b
	else
		print([[Couldn't find button named ]] .. buttonName)
	end
end

function OverrideBar:RemoveButton(i)
	local b = self.buttons[i]	
	if b then
		b:SetParent(nil)
		b:Hide()
		self.buttons[i] = nil
	end
end

function OverrideBar:GetShowStates()
	return '[vehicleui]show;hide'
end