annotate Libs/AceGUI-3.0/widgets/AceGUIContainer-SimpleGroup.lua @ 23:52973d00a183

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