1 --[[-----------------------------------------------------------------------------
3 Simple container widget that creates a visible "box" with an optional title.
4 -------------------------------------------------------------------------------]]
5 local Type, Version = "InlineGroup", 21
6 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
7 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
13 local CreateFrame, UIParent = CreateFrame, UIParent
15 --[[-----------------------------------------------------------------------------
17 -------------------------------------------------------------------------------]]
19 ["OnAcquire"] = function(self)
25 -- ["OnRelease"] = nil,
27 ["SetTitle"] = function(self,title)
28 self.titletext:SetText(title)
32 ["LayoutFinished"] = function(self, width, height)
33 if self.noAutoHeight then return end
34 self:SetHeight((height or 0) + 40)
37 ["OnWidthSet"] = function(self, width)
38 local content = self.content
39 local contentwidth = width - 20
40 if contentwidth < 0 then
43 content:SetWidth(contentwidth)
44 content.width = contentwidth
47 ["OnHeightSet"] = function(self, height)
48 local content = self.content
49 local contentheight = height - 20
50 if contentheight < 0 then
53 content:SetHeight(contentheight)
54 content.height = contentheight
58 --[[-----------------------------------------------------------------------------
60 -------------------------------------------------------------------------------]]
61 local PaneBackdrop = {
62 bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
63 edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
64 tile = true, tileSize = 16, edgeSize = 16,
65 insets = { left = 3, right = 3, top = 5, bottom = 3 }
68 local function Constructor()
69 local frame = CreateFrame("Frame", nil, UIParent)
70 frame:SetFrameStrata("FULLSCREEN_DIALOG")
72 local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
73 titletext:SetPoint("TOPLEFT", 14, 0)
74 titletext:SetPoint("TOPRIGHT", -14, 0)
75 titletext:SetJustifyH("LEFT")
76 titletext:SetHeight(18)
78 local border = CreateFrame("Frame", nil, frame)
79 border:SetPoint("TOPLEFT", 0, -17)
80 border:SetPoint("BOTTOMRIGHT", -1, 3)
81 border:SetBackdrop(PaneBackdrop)
82 border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
83 border:SetBackdropBorderColor(0.4, 0.4, 0.4)
86 local content = CreateFrame("Frame", nil, border)
87 content:SetPoint("TOPLEFT", 10, -10)
88 content:SetPoint("BOTTOMRIGHT", -10, 10)
93 titletext = titletext,
96 for method, func in pairs(methods) do
100 return AceGUI:RegisterAsContainer(widget)
103 AceGUI:RegisterWidgetType(Type, Constructor, Version)