Tercio@23: --[[----------------------------------------------------------------------------- Tercio@23: SimpleGroup Container Tercio@23: Simple container widget that just groups widgets. Tercio@23: -------------------------------------------------------------------------------]] Tercio@23: local Type, Version = "SimpleGroup", 20 Tercio@23: local AceGUI = LibStub and LibStub("AceGUI-3.0", true) Tercio@23: if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end Tercio@23: Tercio@23: -- Lua APIs Tercio@23: local pairs = pairs Tercio@23: Tercio@23: -- WoW APIs Tercio@23: local CreateFrame, UIParent = CreateFrame, UIParent Tercio@23: Tercio@23: Tercio@23: --[[----------------------------------------------------------------------------- Tercio@23: Methods Tercio@23: -------------------------------------------------------------------------------]] Tercio@23: local methods = { Tercio@23: ["OnAcquire"] = function(self) Tercio@23: self:SetWidth(300) Tercio@23: self:SetHeight(100) Tercio@23: end, Tercio@23: Tercio@23: -- ["OnRelease"] = nil, Tercio@23: Tercio@23: ["LayoutFinished"] = function(self, width, height) Tercio@23: if self.noAutoHeight then return end Tercio@23: self:SetHeight(height or 0) Tercio@23: end, Tercio@23: Tercio@23: ["OnWidthSet"] = function(self, width) Tercio@23: local content = self.content Tercio@23: content:SetWidth(width) Tercio@23: content.width = width Tercio@23: end, Tercio@23: Tercio@23: ["OnHeightSet"] = function(self, height) Tercio@23: local content = self.content Tercio@23: content:SetHeight(height) Tercio@23: content.height = height Tercio@23: end Tercio@23: } Tercio@23: Tercio@23: --[[----------------------------------------------------------------------------- Tercio@23: Constructor Tercio@23: -------------------------------------------------------------------------------]] Tercio@23: local function Constructor() Tercio@23: local frame = CreateFrame("Frame", nil, UIParent) Tercio@23: frame:SetFrameStrata("FULLSCREEN_DIALOG") Tercio@23: Tercio@23: --Container Support Tercio@23: local content = CreateFrame("Frame", nil, frame) Tercio@23: content:SetPoint("TOPLEFT") Tercio@23: content:SetPoint("BOTTOMRIGHT") Tercio@23: Tercio@23: local widget = { Tercio@23: frame = frame, Tercio@23: content = content, Tercio@23: type = Type Tercio@23: } Tercio@23: for method, func in pairs(methods) do Tercio@23: widget[method] = func Tercio@23: end Tercio@23: Tercio@23: return AceGUI:RegisterAsContainer(widget) Tercio@23: end Tercio@23: Tercio@23: AceGUI:RegisterWidgetType(Type, Constructor, Version)