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