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