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