annotate Libs/AceGUI-3.0/widgets/AceGUIContainer-SimpleGroup.lua @ 15:21cefa363c73 tip

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