local x,w="\066\108\105\122\079\112\116\105\111\110\115\071\114\111\117\112",26 local v=LibStub and LibStub("\065\099\101\071\085\073-\051\046\048",true)if not v or(v:GetWidgetVersion(x)or 0)>=w then return end local N=pairs local l=CreateFrame local function e(x)x.obj:Fire("\079\110\083\104\111\119")end local function z(x)x.obj:Fire("\079\110\072\105\100\101")end local function i(x)x.obj:Fire("\111\107\097\121")end local function A(x)x.obj:Fire("\099\097\110\099\101\108")end local function n(x)x.obj:Fire("\100\101\102\097\117\108\116")end local function L(x)x.obj:Fire("\114\101\102\114\101\115\104")end local c={OnAcquire=function(x)x:SetName()x:SetTitle()end,OnWidthSet=function(x,w)local v=x.content local N=w-63 if N<0 then N=0 end v:SetWidth(N)v.width=N end;OnHeightSet=function(x,w)local v=x.content local N=w-26 if N<0 then N=0 end v:SetHeight(N)v.height=N end;SetName=function(x,w,v)x.frame.name=w x.frame.parent=v end,SetTitle=function(x,w)local v=x.content v:ClearAllPoints()if not w or w==""then v:SetPoint("\084\079\080\076\069\070\084",10,-10)x.label:SetText("")else v:SetPoint("\084\079\080\076\069\070\084",10,-40)x.label:SetText(w)end v:SetPoint("\066\079\084\084\079\077\082\073\071\072\084",-10,10)end}local function f()local w=l("\070\114\097\109\101",nil,InterfaceOptionsFramePanelContainer)w:Hide()w.okay=i w.cancel=A w.default=n w.refresh=L w.OnCommit=i w.OnDefault=n w.OnRefresh=L w:SetScript("\079\110\072\105\100\101",z)w:SetScript("\079\110\083\104\111\119",e)local f=w:CreateFontString(nil,"\079\086\069\082\076\065\089","\071\097\109\101\070\111\110\116\078\111\114\109\097\108\076\097\114\103\101")f:SetPoint("\084\079\080\076\069\070\084",10,-15)f:SetPoint("\066\079\084\084\079\077\082\073\071\072\084",w,"\084\079\080\082\073\071\072\084",10,-45)f:SetJustifyH("\076\069\070\084")f:SetJustifyV("\084\079\080")local o=l("\070\114\097\109\101",nil,w)o:SetPoint("\084\079\080\076\069\070\084",10,-10)o:SetPoint("\066\079\084\084\079\077\082\073\071\072\084",-10,10)local u={label=f,frame=w,content=o,type=x}for x,w in N(c)do u[x]=w end return v:RegisterAsContainer(u)end v:RegisterWidgetType(x,f,w)
--[[-----------------------------------------------------------------------------
BlizOptionsGroup Container
Simple container widget for the integration of AceGUI into the Blizzard Interface Options
-------------------------------------------------------------------------------]]
local Type, Version = "BlizOptionsGroup", 26
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end

-- Lua APIs
local pairs = pairs

-- WoW APIs
local CreateFrame = CreateFrame

--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]

local function OnShow(frame)
	frame.obj:Fire("OnShow")
end

local function OnHide(frame)
	frame.obj:Fire("OnHide")
end

--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]

local function okay(frame)
	frame.obj:Fire("okay")
end

local function cancel(frame)
	frame.obj:Fire("cancel")
end

local function default(frame)
	frame.obj:Fire("default")
end

local function refresh(frame)
	frame.obj:Fire("refresh")
end

--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]

local methods = {
	["OnAcquire"] = function(self)
		self:SetName()
		self:SetTitle()
	end,

	-- ["OnRelease"] = nil,

	["OnWidthSet"] = function(self, width)
		local content = self.content
		local contentwidth = width - 63
		if contentwidth < 0 then
			contentwidth = 0
		end
		content:SetWidth(contentwidth)
		content.width = contentwidth
	end,

	["OnHeightSet"] = function(self, height)
		local content = self.content
		local contentheight = height - 26
		if contentheight < 0 then
			contentheight = 0
		end
		content:SetHeight(contentheight)
		content.height = contentheight
	end,

	["SetName"] = function(self, name, parent)
		self.frame.name = name
		self.frame.parent = parent
	end,

	["SetTitle"] = function(self, title)
		local content = self.content
		content:ClearAllPoints()
		if not title or title == "" then
			content:SetPoint("TOPLEFT", 10, -10)
			self.label:SetText("")
		else
			content:SetPoint("TOPLEFT", 10, -40)
			self.label:SetText(title)
		end
		content:SetPoint("BOTTOMRIGHT", -10, 10)
	end
}

--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
	local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
	frame:Hide()

	-- support functions for the Blizzard Interface Options
	frame.okay = okay
	frame.cancel = cancel
	frame.default = default
	frame.refresh = refresh

	-- 10.0 support function aliases (cancel has been removed)
	frame.OnCommit = okay
	frame.OnDefault = default
	frame.OnRefresh = refresh

	frame:SetScript("OnHide", OnHide)
	frame:SetScript("OnShow", OnShow)

	local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
	label:SetPoint("TOPLEFT", 10, -15)
	label:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 10, -45)
	label:SetJustifyH("LEFT")
	label:SetJustifyV("TOP")

	--Container Support
	local content = CreateFrame("Frame", nil, frame)
	content:SetPoint("TOPLEFT", 10, -10)
	content:SetPoint("BOTTOMRIGHT", -10, 10)

	local widget = {
		label   = label,
		frame   = frame,
		content = content,
		type    = Type
	}
	for method, func in pairs(methods) do
		widget[method] = func
	end

	return AceGUI:RegisterAsContainer(widget)
end

AceGUI:RegisterWidgetType(Type, Constructor, Version)
