annotate Libs/AceGUI-3.0/widgets/AceGUIContainer-SimpleGroup.lua @ 201:3447634f0388 tip

Added tag v97 for changeset 6e8838b231d4
author Yellowfive
date Wed, 13 Jan 2021 13:12:13 -0600
parents 01b63b8ed811
children
rev   line source
yellowfive@57 1 --[[-----------------------------------------------------------------------------
yellowfive@57 2 SimpleGroup Container
yellowfive@57 3 Simple container widget that just groups widgets.
yellowfive@57 4 -------------------------------------------------------------------------------]]
yellowfive@57 5 local Type, Version = "SimpleGroup", 20
yellowfive@57 6 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
yellowfive@57 7 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
yellowfive@57 8
yellowfive@57 9 -- Lua APIs
yellowfive@57 10 local pairs = pairs
yellowfive@57 11
yellowfive@57 12 -- WoW APIs
yellowfive@57 13 local CreateFrame, UIParent = CreateFrame, UIParent
yellowfive@57 14
yellowfive@57 15
yellowfive@57 16 --[[-----------------------------------------------------------------------------
yellowfive@57 17 Methods
yellowfive@57 18 -------------------------------------------------------------------------------]]
yellowfive@57 19 local methods = {
yellowfive@57 20 ["OnAcquire"] = function(self)
yellowfive@57 21 self:SetWidth(300)
yellowfive@57 22 self:SetHeight(100)
yellowfive@57 23 end,
yellowfive@57 24
yellowfive@57 25 -- ["OnRelease"] = nil,
yellowfive@57 26
yellowfive@57 27 ["LayoutFinished"] = function(self, width, height)
yellowfive@57 28 if self.noAutoHeight then return end
yellowfive@57 29 self:SetHeight(height or 0)
yellowfive@57 30 end,
yellowfive@57 31
yellowfive@57 32 ["OnWidthSet"] = function(self, width)
yellowfive@57 33 local content = self.content
yellowfive@57 34 content:SetWidth(width)
yellowfive@57 35 content.width = width
yellowfive@57 36 end,
yellowfive@57 37
yellowfive@57 38 ["OnHeightSet"] = function(self, height)
yellowfive@57 39 local content = self.content
yellowfive@57 40 content:SetHeight(height)
yellowfive@57 41 content.height = height
yellowfive@57 42 end
yellowfive@57 43 }
yellowfive@57 44
yellowfive@57 45 --[[-----------------------------------------------------------------------------
yellowfive@57 46 Constructor
yellowfive@57 47 -------------------------------------------------------------------------------]]
yellowfive@57 48 local function Constructor()
yellowfive@57 49 local frame = CreateFrame("Frame", nil, UIParent)
yellowfive@57 50 frame:SetFrameStrata("FULLSCREEN_DIALOG")
yellowfive@57 51
yellowfive@57 52 --Container Support
yellowfive@57 53 local content = CreateFrame("Frame", nil, frame)
yellowfive@57 54 content:SetPoint("TOPLEFT")
yellowfive@57 55 content:SetPoint("BOTTOMRIGHT")
yellowfive@57 56
yellowfive@57 57 local widget = {
yellowfive@57 58 frame = frame,
yellowfive@57 59 content = content,
yellowfive@57 60 type = Type
yellowfive@57 61 }
yellowfive@57 62 for method, func in pairs(methods) do
yellowfive@57 63 widget[method] = func
yellowfive@57 64 end
yellowfive@57 65
yellowfive@57 66 return AceGUI:RegisterAsContainer(widget)
yellowfive@57 67 end
yellowfive@57 68
yellowfive@57 69 AceGUI:RegisterWidgetType(Type, Constructor, Version)