local _,rematch = ... local C = rematch.constants --[[ Wrapper for Blizzard's recently expanded ScrollBox control with support for expanding/collapsing headers, different templates (can be different heights) in the same list, and searching. autoScrollBox:Setup(definition) -- sets up an autoScrollBox from a definition table (see below) autoScrollBox:Update() -- repopulates and updates the autoScrollBox autoScrollBox:Refresh() -- just updates the already-displayed buttons for minor changes autoScrollBox:SetCompactMode(true/false) -- changes from normal to compact mode (switches templates) autoScrollBox:GetCompactMode() -- returns true/false if in compact mode autoScrollBox:ToggleHeader(data) -- for expandable lists, expand/collapse header with data value autoScrollBox:ToggleAllHeaders(data) -- for expandable lists, expand/collapse all headers autoScrollBox:CollapseAllHeaders() -- for expandable lists, collapses all headers autoScrollBox:CollapseAllButData(data) -- for expandable lists, collapses all headers except the one for data autoScrollBox:IsHeaderExpanded(data) -- returns true if the header at data is expanded autoScrollBox:IsAnyExpanded() -- returns true if any header is expanded autoScrollBox:IsSearching() -- returns true if a search is happening (searchMask has a value) autoScrollBox:Select(name,data) -- selects the listbutton that contains data with the named select (or unselects if data nil) autoScrollBox:GetSelected(name) -- returns the currently selected data for the named select autoScrollBox:ScrollToTop() -- scrolls to top of the list autoScrollBox:ScrollDataToTop(data) -- scrolls data to the top of the list autoScrollBox:ScrollHeaderIntoView(data) -- scrolls header(data) into view and as much of its contents if expanded autoScrollBox:ScrollDataIntoView(data) -- scrolls data into view, expanding header it's within if needed autoScrollBox:BlingData(data) -- flashes frame that contains data, scrolling it into view if needed autoScrollBox:LockHeader() -- locks headers so they can't be expanded/collapsed autoScrollBox:UnlockHeaders() -- unlocks headers so they can be expanded/collapsed autoScrollBox:IsHeadersLocked() -- true if headers are locked definition passed in Setup() defines the templates, callbacks and behavior of the autoScrollBox: definition = { allData = {}, -- (required) ordered list of data/id's that has meaning to the calling panel normalTemplate = "", -- (required) list button template for normal stuff normalFill = function(button,data) end, -- (required) fill function for normal stuff normalHeight = 0, -- (required) pixel height of a normal list button -- all the following are optional (unless their functionality needed) isCompact = true/false, -- whether this starts as a compact-mode list compactTemplate = "", -- list button template for compact stuff compactFill = function(button,data) end, -- fill function for compact stuff compactHeight = 0, -- pixel height of a compact list button headerTemplate = "", -- header button template headerFill = function(button,data) end, -- fill function for headers headerCriteria = function(self,data) end, -- returns true if data is a header headerHeight = 0, -- pixel height of a header list button placeholderTemplate = "", -- placeholder button template placeholderFill = function(button,data) end, -- fill function for placeholders placeholderCriteria = function(self,data) end, -- returns true if data is a placeholder placeholderHeight = 0, -- pixel height of a placeholder list button allButton =