tercio@0: --[[----------------------------------------------------------------------------- tercio@0: TreeGroup Container tercio@0: Container that uses a tree control to switch between groups. tercio@0: -------------------------------------------------------------------------------]] Tercio@11: local Type, Version = "TreeGroup", 40 tercio@0: local AceGUI = LibStub and LibStub("AceGUI-3.0", true) tercio@0: if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end tercio@0: tercio@0: -- Lua APIs tercio@0: local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type tercio@0: local math_min, math_max, floor = math.min, math.max, floor tercio@0: local select, tremove, unpack, tconcat = select, table.remove, unpack, table.concat tercio@0: tercio@0: -- WoW APIs tercio@0: local CreateFrame, UIParent = CreateFrame, UIParent tercio@0: tercio@0: -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded tercio@0: -- List them here for Mikk's FindGlobals script tercio@0: -- GLOBALS: GameTooltip, FONT_COLOR_CODE_CLOSE tercio@0: tercio@0: -- Recycling functions tercio@0: local new, del tercio@0: do tercio@0: local pool = setmetatable({},{__mode='k'}) tercio@0: function new() tercio@0: local t = next(pool) tercio@0: if t then tercio@0: pool[t] = nil tercio@0: return t tercio@0: else tercio@0: return {} tercio@0: end tercio@0: end tercio@0: function del(t) tercio@0: for k in pairs(t) do tercio@0: t[k] = nil tercio@0: end tercio@0: pool[t] = true tercio@0: end tercio@0: end tercio@0: tercio@0: local DEFAULT_TREE_WIDTH = 175 tercio@0: local DEFAULT_TREE_SIZABLE = true tercio@0: tercio@0: --[[----------------------------------------------------------------------------- tercio@0: Support functions tercio@0: -------------------------------------------------------------------------------]] tercio@0: local function GetButtonUniqueValue(line) tercio@0: local parent = line.parent tercio@0: if parent and parent.value then tercio@0: return GetButtonUniqueValue(parent).."\001"..line.value tercio@0: else tercio@0: return line.value tercio@0: end tercio@0: end tercio@0: tercio@0: local function UpdateButton(button, treeline, selected, canExpand, isExpanded) tercio@0: local self = button.obj tercio@0: local toggle = button.toggle tercio@0: local frame = self.frame tercio@0: local text = treeline.text or "" tercio@0: local icon = treeline.icon tercio@0: local iconCoords = treeline.iconCoords tercio@0: local level = treeline.level tercio@0: local value = treeline.value tercio@0: local uniquevalue = treeline.uniquevalue tercio@0: local disabled = treeline.disabled tercio@0: tercio@0: button.treeline = treeline tercio@0: button.value = value tercio@0: button.uniquevalue = uniquevalue tercio@0: if selected then tercio@0: button:LockHighlight() tercio@0: button.selected = true tercio@0: else tercio@0: button:UnlockHighlight() tercio@0: button.selected = false tercio@0: end tercio@0: local normalTexture = button:GetNormalTexture() tercio@0: local line = button.line tercio@0: button.level = level tercio@0: if ( level == 1 ) then tercio@0: button:SetNormalFontObject("GameFontNormal") tercio@0: button:SetHighlightFontObject("GameFontHighlight") tercio@0: button.text:SetPoint("LEFT", (icon and 16 or 0) + 8, 2) tercio@0: else tercio@0: button:SetNormalFontObject("GameFontHighlightSmall") tercio@0: button:SetHighlightFontObject("GameFontHighlightSmall") tercio@0: button.text:SetPoint("LEFT", (icon and 16 or 0) + 8 * level, 2) tercio@0: end tercio@0: tercio@0: if disabled then tercio@0: button:EnableMouse(false) tercio@0: button.text:SetText("|cff808080"..text..FONT_COLOR_CODE_CLOSE) tercio@0: else tercio@0: button.text:SetText(text) tercio@0: button:EnableMouse(true) tercio@0: end tercio@0: tercio@0: if icon then tercio@0: button.icon:SetTexture(icon) tercio@0: button.icon:SetPoint("LEFT", 8 * level, (level == 1) and 0 or 1) tercio@0: else tercio@0: button.icon:SetTexture(nil) tercio@0: end tercio@0: tercio@0: if iconCoords then tercio@0: button.icon:SetTexCoord(unpack(iconCoords)) tercio@0: else tercio@0: button.icon:SetTexCoord(0, 1, 0, 1) tercio@0: end tercio@0: tercio@0: if canExpand then tercio@0: if not isExpanded then tercio@0: toggle:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-UP") tercio@0: toggle:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-DOWN") tercio@0: else tercio@0: toggle:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-UP") tercio@0: toggle:SetPushedTexture("Interface\\Buttons\\UI-MinusButton-DOWN") tercio@0: end tercio@0: toggle:Show() tercio@0: else tercio@0: toggle:Hide() tercio@0: end tercio@0: end tercio@0: tercio@0: local function ShouldDisplayLevel(tree) tercio@0: local result = false tercio@0: for k, v in ipairs(tree) do tercio@0: if v.children == nil and v.visible ~= false then tercio@0: result = true tercio@0: elseif v.children then tercio@0: result = result or ShouldDisplayLevel(v.children) tercio@0: end tercio@0: if result then return result end tercio@0: end tercio@0: return false tercio@0: end tercio@0: tercio@0: local function addLine(self, v, tree, level, parent) tercio@0: local line = new() tercio@0: line.value = v.value tercio@0: line.text = v.text tercio@0: line.icon = v.icon tercio@0: line.iconCoords = v.iconCoords tercio@0: line.disabled = v.disabled tercio@0: line.tree = tree tercio@0: line.level = level tercio@0: line.parent = parent tercio@0: line.visible = v.visible tercio@0: line.uniquevalue = GetButtonUniqueValue(line) tercio@0: if v.children then tercio@0: line.hasChildren = true tercio@0: else tercio@0: line.hasChildren = nil tercio@0: end tercio@0: self.lines[#self.lines+1] = line tercio@0: return line tercio@0: end tercio@0: tercio@0: --fire an update after one frame to catch the treeframes height tercio@0: local function FirstFrameUpdate(frame) tercio@0: local self = frame.obj tercio@0: frame:SetScript("OnUpdate", nil) tercio@0: self:RefreshTree() tercio@0: end tercio@0: tercio@0: local function BuildUniqueValue(...) tercio@0: local n = select('#', ...) tercio@0: if n == 1 then tercio@0: return ... tercio@0: else tercio@0: return (...).."\001"..BuildUniqueValue(select(2,...)) tercio@0: end tercio@0: end tercio@0: tercio@0: --[[----------------------------------------------------------------------------- tercio@0: Scripts tercio@0: -------------------------------------------------------------------------------]] tercio@0: local function Expand_OnClick(frame) tercio@0: local button = frame.button tercio@0: local self = button.obj tercio@0: local status = (self.status or self.localstatus).groups tercio@0: status[button.uniquevalue] = not status[button.uniquevalue] tercio@0: self:RefreshTree() tercio@0: end tercio@0: tercio@0: local function Button_OnClick(frame) tercio@0: local self = frame.obj tercio@0: self:Fire("OnClick", frame.uniquevalue, frame.selected) tercio@0: if not frame.selected then tercio@0: self:SetSelected(frame.uniquevalue) tercio@0: frame.selected = true tercio@0: frame:LockHighlight() tercio@0: self:RefreshTree() tercio@0: end tercio@0: AceGUI:ClearFocus() tercio@0: end tercio@0: tercio@0: local function Button_OnDoubleClick(button) tercio@0: local self = button.obj tercio@0: local status = self.status or self.localstatus tercio@0: local status = (self.status or self.localstatus).groups tercio@0: status[button.uniquevalue] = not status[button.uniquevalue] tercio@0: self:RefreshTree() tercio@0: end tercio@0: tercio@0: local function Button_OnEnter(frame) tercio@0: local self = frame.obj tercio@0: self:Fire("OnButtonEnter", frame.uniquevalue, frame) tercio@0: tercio@0: if self.enabletooltips then tercio@0: GameTooltip:SetOwner(frame, "ANCHOR_NONE") tercio@0: GameTooltip:SetPoint("LEFT",frame,"RIGHT") tercio@5: GameTooltip:SetText(frame.text:GetText() or "", 1, .82, 0, true) tercio@0: tercio@0: GameTooltip:Show() tercio@0: end tercio@0: end tercio@0: tercio@0: local function Button_OnLeave(frame) tercio@0: local self = frame.obj tercio@0: self:Fire("OnButtonLeave", frame.uniquevalue, frame) tercio@0: tercio@0: if self.enabletooltips then tercio@0: GameTooltip:Hide() tercio@0: end tercio@0: end tercio@0: tercio@0: local function OnScrollValueChanged(frame, value) tercio@0: if frame.obj.noupdate then return end tercio@0: local self = frame.obj tercio@0: local status = self.status or self.localstatus tercio@0: status.scrollvalue = floor(value + 0.5) tercio@0: self:RefreshTree() tercio@0: AceGUI:ClearFocus() tercio@0: end tercio@0: tercio@0: local function Tree_OnSizeChanged(frame) tercio@0: frame.obj:RefreshTree() tercio@0: end tercio@0: tercio@0: local function Tree_OnMouseWheel(frame, delta) tercio@0: local self = frame.obj tercio@0: if self.showscroll then tercio@0: local scrollbar = self.scrollbar tercio@0: local min, max = scrollbar:GetMinMaxValues() tercio@0: local value = scrollbar:GetValue() tercio@0: local newvalue = math_min(max,math_max(min,value - delta)) tercio@0: if value ~= newvalue then tercio@0: scrollbar:SetValue(newvalue) tercio@0: end tercio@0: end tercio@0: end tercio@0: tercio@0: local function Dragger_OnLeave(frame) tercio@0: frame:SetBackdropColor(1, 1, 1, 0) tercio@0: end tercio@0: tercio@0: local function Dragger_OnEnter(frame) tercio@0: frame:SetBackdropColor(1, 1, 1, 0.8) tercio@0: end tercio@0: tercio@0: local function Dragger_OnMouseDown(frame) tercio@0: local treeframe = frame:GetParent() tercio@0: treeframe:StartSizing("RIGHT") tercio@0: end tercio@0: tercio@0: local function Dragger_OnMouseUp(frame) tercio@0: local treeframe = frame:GetParent() tercio@0: local self = treeframe.obj tercio@0: local frame = treeframe:GetParent() tercio@0: treeframe:StopMovingOrSizing() tercio@0: --treeframe:SetScript("OnUpdate", nil) tercio@0: treeframe:SetUserPlaced(false) tercio@0: --Without this :GetHeight will get stuck on the current height, causing the tree contents to not resize tercio@0: treeframe:SetHeight(0) tercio@0: treeframe:SetPoint("TOPLEFT", frame, "TOPLEFT",0,0) tercio@0: treeframe:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT",0,0) tercio@0: tercio@0: local status = self.status or self.localstatus tercio@0: status.treewidth = treeframe:GetWidth() tercio@0: tercio@0: treeframe.obj:Fire("OnTreeResize",treeframe:GetWidth()) tercio@0: -- recalculate the content width tercio@0: treeframe.obj:OnWidthSet(status.fullwidth) tercio@0: -- update the layout of the content tercio@0: treeframe.obj:DoLayout() tercio@0: end tercio@0: tercio@0: --[[----------------------------------------------------------------------------- tercio@0: Methods tercio@0: -------------------------------------------------------------------------------]] tercio@0: local methods = { tercio@0: ["OnAcquire"] = function(self) tercio@0: self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE) tercio@0: self:EnableButtonTooltips(true) Tercio@11: self.frame:SetScript("OnUpdate", FirstFrameUpdate) tercio@0: end, tercio@0: tercio@0: ["OnRelease"] = function(self) tercio@0: self.status = nil tercio@0: for k, v in pairs(self.localstatus) do tercio@0: if k == "groups" then tercio@0: for k2 in pairs(v) do tercio@0: v[k2] = nil tercio@0: end tercio@0: else tercio@0: self.localstatus[k] = nil tercio@0: end tercio@0: end tercio@0: self.localstatus.scrollvalue = 0 tercio@0: self.localstatus.treewidth = DEFAULT_TREE_WIDTH tercio@0: self.localstatus.treesizable = DEFAULT_TREE_SIZABLE tercio@0: end, tercio@0: tercio@0: ["EnableButtonTooltips"] = function(self, enable) tercio@0: self.enabletooltips = enable tercio@0: end, tercio@0: tercio@0: ["CreateButton"] = function(self) tercio@0: local num = AceGUI:GetNextWidgetNum("TreeGroupButton") tercio@0: local button = CreateFrame("Button", ("AceGUI30TreeButton%d"):format(num), self.treeframe, "OptionsListButtonTemplate") tercio@0: button.obj = self tercio@0: tercio@0: local icon = button:CreateTexture(nil, "OVERLAY") tercio@0: icon:SetWidth(14) tercio@0: icon:SetHeight(14) tercio@0: button.icon = icon tercio@0: tercio@0: button:SetScript("OnClick",Button_OnClick) tercio@0: button:SetScript("OnDoubleClick", Button_OnDoubleClick) tercio@0: button:SetScript("OnEnter",Button_OnEnter) tercio@0: button:SetScript("OnLeave",Button_OnLeave) tercio@0: tercio@0: button.toggle.button = button tercio@0: button.toggle:SetScript("OnClick",Expand_OnClick) tercio@0: Tercio@11: button.text:SetHeight(14) -- Prevents text wrapping Tercio@11: tercio@0: return button tercio@0: end, tercio@0: tercio@0: ["SetStatusTable"] = function(self, status) tercio@0: assert(type(status) == "table") tercio@0: self.status = status tercio@0: if not status.groups then tercio@0: status.groups = {} tercio@0: end tercio@0: if not status.scrollvalue then tercio@0: status.scrollvalue = 0 tercio@0: end tercio@0: if not status.treewidth then tercio@0: status.treewidth = DEFAULT_TREE_WIDTH tercio@0: end tercio@0: if status.treesizable == nil then tercio@0: status.treesizable = DEFAULT_TREE_SIZABLE tercio@0: end tercio@0: self:SetTreeWidth(status.treewidth,status.treesizable) tercio@0: self:RefreshTree() tercio@0: end, tercio@0: tercio@0: --sets the tree to be displayed tercio@0: ["SetTree"] = function(self, tree, filter) tercio@0: self.filter = filter tercio@0: if tree then tercio@0: assert(type(tree) == "table") tercio@0: end tercio@0: self.tree = tree tercio@0: self:RefreshTree() tercio@0: end, tercio@0: tercio@0: ["BuildLevel"] = function(self, tree, level, parent) tercio@0: local groups = (self.status or self.localstatus).groups tercio@0: local hasChildren = self.hasChildren tercio@0: tercio@0: for i, v in ipairs(tree) do tercio@0: if v.children then tercio@0: if not self.filter or ShouldDisplayLevel(v.children) then tercio@0: local line = addLine(self, v, tree, level, parent) tercio@0: if groups[line.uniquevalue] then tercio@0: self:BuildLevel(v.children, level+1, line) tercio@0: end tercio@0: end tercio@0: elseif v.visible ~= false or not self.filter then tercio@0: addLine(self, v, tree, level, parent) tercio@0: end tercio@0: end tercio@0: end, tercio@0: tercio@0: ["RefreshTree"] = function(self,scrollToSelection) tercio@0: local buttons = self.buttons tercio@0: local lines = self.lines tercio@0: tercio@0: for i, v in ipairs(buttons) do tercio@0: v:Hide() tercio@0: end tercio@0: while lines[1] do tercio@0: local t = tremove(lines) tercio@0: for k in pairs(t) do tercio@0: t[k] = nil tercio@0: end tercio@0: del(t) tercio@0: end tercio@0: tercio@0: if not self.tree then return end tercio@0: --Build the list of visible entries from the tree and status tables tercio@0: local status = self.status or self.localstatus tercio@0: local groupstatus = status.groups tercio@0: local tree = self.tree tercio@0: tercio@0: local treeframe = self.treeframe tercio@0: tercio@0: status.scrollToSelection = status.scrollToSelection or scrollToSelection -- needs to be cached in case the control hasn't been drawn yet (code bails out below) tercio@0: tercio@0: self:BuildLevel(tree, 1) tercio@0: tercio@0: local numlines = #lines tercio@0: tercio@0: local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18)) tercio@0: if maxlines <= 0 then return end tercio@0: tercio@0: local first, last tercio@0: tercio@0: scrollToSelection = status.scrollToSelection tercio@0: status.scrollToSelection = nil tercio@0: tercio@0: if numlines <= maxlines then tercio@0: --the whole tree fits in the frame tercio@0: status.scrollvalue = 0 tercio@0: self:ShowScroll(false) tercio@0: first, last = 1, numlines tercio@0: else tercio@0: self:ShowScroll(true) tercio@0: --scrolling will be needed tercio@0: self.noupdate = true tercio@0: self.scrollbar:SetMinMaxValues(0, numlines - maxlines) tercio@0: --check if we are scrolled down too far tercio@0: if numlines - status.scrollvalue < maxlines then tercio@0: status.scrollvalue = numlines - maxlines tercio@0: end tercio@0: self.noupdate = nil tercio@0: first, last = status.scrollvalue+1, status.scrollvalue + maxlines tercio@0: --show selection? tercio@0: if scrollToSelection and status.selected then tercio@0: local show tercio@0: for i,line in ipairs(lines) do -- find the line number tercio@0: if line.uniquevalue==status.selected then tercio@0: show=i tercio@0: end tercio@0: end tercio@0: if not show then tercio@0: -- selection was deleted or something? tercio@0: elseif show>=first and show<=last then tercio@0: -- all good tercio@0: else tercio@0: -- scrolling needed! tercio@0: if show 100 and status.treewidth > maxtreewidth then tercio@0: self:SetTreeWidth(maxtreewidth, status.treesizable) tercio@0: end tercio@0: treeframe:SetMaxResize(maxtreewidth, 1600) tercio@0: end, tercio@0: tercio@0: ["OnHeightSet"] = function(self, height) tercio@0: local content = self.content tercio@0: local contentheight = height - 20 tercio@0: if contentheight < 0 then tercio@0: contentheight = 0 tercio@0: end tercio@0: content:SetHeight(contentheight) tercio@0: content.height = contentheight tercio@0: end, tercio@0: tercio@0: ["SetTreeWidth"] = function(self, treewidth, resizable) tercio@0: if not resizable then tercio@0: if type(treewidth) == 'number' then tercio@0: resizable = false tercio@0: elseif type(treewidth) == 'boolean' then tercio@0: resizable = treewidth tercio@0: treewidth = DEFAULT_TREE_WIDTH tercio@0: else tercio@0: resizable = false tercio@0: treewidth = DEFAULT_TREE_WIDTH tercio@0: end tercio@0: end tercio@0: self.treeframe:SetWidth(treewidth) tercio@0: self.dragger:EnableMouse(resizable) tercio@0: tercio@0: local status = self.status or self.localstatus tercio@0: status.treewidth = treewidth tercio@0: status.treesizable = resizable tercio@0: tercio@0: -- recalculate the content width tercio@0: if status.fullwidth then tercio@0: self:OnWidthSet(status.fullwidth) tercio@0: end tercio@0: end, tercio@0: tercio@0: ["GetTreeWidth"] = function(self) tercio@0: local status = self.status or self.localstatus tercio@0: return status.treewidth or DEFAULT_TREE_WIDTH tercio@0: end, tercio@0: tercio@0: ["LayoutFinished"] = function(self, width, height) tercio@0: if self.noAutoHeight then return end tercio@0: self:SetHeight((height or 0) + 20) tercio@0: end tercio@0: } tercio@0: tercio@0: --[[----------------------------------------------------------------------------- tercio@0: Constructor tercio@0: -------------------------------------------------------------------------------]] tercio@0: local PaneBackdrop = { tercio@0: bgFile = "Interface\\ChatFrame\\ChatFrameBackground", tercio@0: edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tercio@0: tile = true, tileSize = 16, edgeSize = 16, tercio@0: insets = { left = 3, right = 3, top = 5, bottom = 3 } tercio@0: } tercio@0: tercio@0: local DraggerBackdrop = { tercio@0: bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tercio@0: edgeFile = nil, tercio@0: tile = true, tileSize = 16, edgeSize = 0, tercio@0: insets = { left = 3, right = 3, top = 7, bottom = 7 } tercio@0: } tercio@0: tercio@0: local function Constructor() tercio@0: local num = AceGUI:GetNextWidgetNum(Type) tercio@0: local frame = CreateFrame("Frame", nil, UIParent) tercio@0: tercio@0: local treeframe = CreateFrame("Frame", nil, frame) tercio@0: treeframe:SetPoint("TOPLEFT") tercio@0: treeframe:SetPoint("BOTTOMLEFT") tercio@0: treeframe:SetWidth(DEFAULT_TREE_WIDTH) tercio@0: treeframe:EnableMouseWheel(true) tercio@0: treeframe:SetBackdrop(PaneBackdrop) tercio@0: treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5) tercio@0: treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4) tercio@0: treeframe:SetResizable(true) tercio@0: treeframe:SetMinResize(100, 1) tercio@0: treeframe:SetMaxResize(400, 1600) tercio@0: treeframe:SetScript("OnUpdate", FirstFrameUpdate) tercio@0: treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged) tercio@0: treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel) tercio@0: tercio@0: local dragger = CreateFrame("Frame", nil, treeframe) tercio@0: dragger:SetWidth(8) tercio@0: dragger:SetPoint("TOP", treeframe, "TOPRIGHT") tercio@0: dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT") tercio@0: dragger:SetBackdrop(DraggerBackdrop) tercio@0: dragger:SetBackdropColor(1, 1, 1, 0) tercio@0: dragger:SetScript("OnEnter", Dragger_OnEnter) tercio@0: dragger:SetScript("OnLeave", Dragger_OnLeave) tercio@0: dragger:SetScript("OnMouseDown", Dragger_OnMouseDown) tercio@0: dragger:SetScript("OnMouseUp", Dragger_OnMouseUp) tercio@0: tercio@0: local scrollbar = CreateFrame("Slider", ("AceConfigDialogTreeGroup%dScrollBar"):format(num), treeframe, "UIPanelScrollBarTemplate") tercio@0: scrollbar:SetScript("OnValueChanged", nil) tercio@0: scrollbar:SetPoint("TOPRIGHT", -10, -26) tercio@0: scrollbar:SetPoint("BOTTOMRIGHT", -10, 26) tercio@0: scrollbar:SetMinMaxValues(0,0) tercio@0: scrollbar:SetValueStep(1) tercio@0: scrollbar:SetValue(0) tercio@0: scrollbar:SetWidth(16) tercio@0: scrollbar:SetScript("OnValueChanged", OnScrollValueChanged) tercio@0: tercio@0: local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND") tercio@0: scrollbg:SetAllPoints(scrollbar) Tercio@17: scrollbg:SetColorTexture(0,0,0,0.4) tercio@0: tercio@0: local border = CreateFrame("Frame",nil,frame) tercio@0: border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT") tercio@0: border:SetPoint("BOTTOMRIGHT") tercio@0: border:SetBackdrop(PaneBackdrop) tercio@0: border:SetBackdropColor(0.1, 0.1, 0.1, 0.5) tercio@0: border:SetBackdropBorderColor(0.4, 0.4, 0.4) tercio@0: tercio@0: --Container Support tercio@0: local content = CreateFrame("Frame", nil, border) tercio@0: content:SetPoint("TOPLEFT", 10, -10) tercio@0: content:SetPoint("BOTTOMRIGHT", -10, 10) tercio@0: tercio@0: local widget = { tercio@0: frame = frame, tercio@0: lines = {}, tercio@0: levels = {}, tercio@0: buttons = {}, tercio@0: hasChildren = {}, tercio@0: localstatus = { groups = {}, scrollvalue = 0 }, tercio@0: filter = false, tercio@0: treeframe = treeframe, tercio@0: dragger = dragger, tercio@0: scrollbar = scrollbar, tercio@0: border = border, tercio@0: content = content, tercio@0: type = Type tercio@0: } tercio@0: for method, func in pairs(methods) do tercio@0: widget[method] = func tercio@0: end tercio@0: treeframe.obj, dragger.obj, scrollbar.obj = widget, widget, widget tercio@0: tercio@0: return AceGUI:RegisterAsContainer(widget) tercio@0: end tercio@0: tercio@0: AceGUI:RegisterWidgetType(Type, Constructor, Version)