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