1 --[[-----------------------------------------------------------------------------
2 BlizOptionsGroup Container
3 Simple container widget for the integration of AceGUI into the Blizzard Interface Options
4 -------------------------------------------------------------------------------]]
5 local Type, Version = "BlizOptionsGroup", 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 = CreateFrame
15 --[[-----------------------------------------------------------------------------
17 -------------------------------------------------------------------------------]]
19 local function OnShow(frame)
20 frame.obj:Fire("OnShow")
23 local function OnHide(frame)
24 frame.obj:Fire("OnHide")
27 --[[-----------------------------------------------------------------------------
29 -------------------------------------------------------------------------------]]
31 local function okay(frame)
32 frame.obj:Fire("okay")
35 local function cancel(frame)
36 frame.obj:Fire("cancel")
39 local function default(frame)
40 frame.obj:Fire("default")
43 local function refresh(frame)
44 frame.obj:Fire("refresh")
47 --[[-----------------------------------------------------------------------------
49 -------------------------------------------------------------------------------]]
52 ["OnAcquire"] = function(self)
57 -- ["OnRelease"] = nil,
59 ["OnWidthSet"] = function(self, width)
60 local content = self.content
61 local contentwidth = width - 63
62 if contentwidth < 0 then
65 content:SetWidth(contentwidth)
66 content.width = contentwidth
69 ["OnHeightSet"] = function(self, height)
70 local content = self.content
71 local contentheight = height - 26
72 if contentheight < 0 then
75 content:SetHeight(contentheight)
76 content.height = contentheight
79 ["SetName"] = function(self, name, parent)
80 self.frame.name = name
81 self.frame.parent = parent
84 ["SetTitle"] = function(self, title)
85 local content = self.content
86 content:ClearAllPoints()
87 if not title or title == "" then
88 content:SetPoint("TOPLEFT", 10, -10)
89 self.label:SetText("")
91 content:SetPoint("TOPLEFT", 10, -40)
92 self.label:SetText(title)
94 content:SetPoint("BOTTOMRIGHT", -10, 10)
98 --[[-----------------------------------------------------------------------------
100 -------------------------------------------------------------------------------]]
101 local function Constructor()
102 local frame = CreateFrame("Frame")
105 -- support functions for the Blizzard Interface Options
107 frame.cancel = cancel
108 frame.default = default
109 frame.refresh = refresh
111 frame:SetScript("OnHide", OnHide)
112 frame:SetScript("OnShow", OnShow)
114 local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
115 label:SetPoint("TOPLEFT", 10, -15)
116 label:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 10, -45)
117 label:SetJustifyH("LEFT")
118 label:SetJustifyV("TOP")
121 local content = CreateFrame("Frame", nil, frame)
122 content:SetPoint("TOPLEFT", 10, -10)
123 content:SetPoint("BOTTOMRIGHT", -10, 10)
131 for method, func in pairs(methods) do
132 widget[method] = func
135 return AceGUI:RegisterAsContainer(widget)
138 AceGUI:RegisterWidgetType(Type, Constructor, Version)