Waterfall-1.0

From WowAce Wiki
Jump to: navigation, search

Waterfall-1.0 is a library to provide an easy-to-implement configuration GUI.

Example

local waterfall = AceLibrary("Waterfall-1.0")

waterfall:Register('Example', 
 'aceOptions',self.opts,
 'title','Example Waterfall')
waterfall:Open('Example')



API Documentation

:Register(id, ...)

Registers a waterfall frame with the given id, the rest of the arguments describe the contents of the frame.

Args

id
ID of the frame, must be a string.
...
'title' - The title of the waterfall, if this is not given the id will be used
'aceOptions' - an AceOptions data table to be used to create the waterfall
'treeLevels' - when 'aceOptions' is specified, the number of levels of options to place on the tree. Deeper levels will become headings in the right pane
'hideTreeRoot' - when 'aceOptions is specified, this will hide the root options group from the tree.
'tree' - a table that defines the treeview, see example for the structure of this tree
'children' - a function that defines the contents of the pane, it will be called with the id of the tree item that is selected and should return the title of the shown pane
'colorR', 'colorG', 'colorB' - A custom color for the title bar of the waterfall frame
'treeType' - either 'TREE' or 'SECTIONS', defaults to 'TREE' :- 'SECTIONS' implies 'treeLevels' = 3 and 'hideTreeRoot' = true


:UnRegister(id)

UnRegisters a waterfall frame with the given id

Args

id
ID of the frame, must be a string


:IsRegistered(id)

Returns true if a waterfall frame with the given id is currently registered.

Args

id
ID of the frame, must be a string


:Open(id)

Open the registered waterfall frame with the specified ID, an error message is shown if the specified frame does not exist.

Args

id
ID of the frame, must be a string


:IsOpen(id)

Returns true if a waterfall frame with the given id is currently open.

Args

id
ID of the frame, must be a string


:Refresh(id)

Refreshes the specified waterfall frame.

Args

id
ID of the frame, must be a string


:SetSize(id, width, height)

Sets the size of the specified waterfall frame

Args

id
ID of the frame, must be a string
width
The new width of the frame
height
The new height of the frame


:AddControl(...)

Adds a control to the parent of a child frame. Must be called from within a children function.


:FeedAceOptionsTable(root, path, maxLevels)

Feeds an ace options table into the right pane, must be called within a "children" function.

Args

root
the root of the options table, this is important if any methods are used for resolving the handler.
path
the path into the table seperated by "." e.g. "Items.Compress" to feed the table given by root.args.Items.args.Compress
maxLevels
how many sub groups to feed as well, 1 is only the current level 2 will feed sub groups etc. nil assumes no limit.


:Close(id)

Closes the specified waterfall frame.

Args

id
ID of the frame, must be a string


CloseAll()

Closes all open waterfall windows.


Remarks

Either provide 'aceOptions' to fully define the waterfall from an AceOptions table or provide 'tree' and 'children' to define the tree and pane contents yourself

When 'treeType' = 'SECTIONS'.
Your Options table should have the first 2 levels of groups not contain options since the root is hidden and the level after that is used to create the section title and aren't selectable.

'treeLevels' is forced to 3 and 'hideTreeRoot' is forced to true, setting these options will have no effect

Example

waterfall:Register('Example',
 'aceOptions', self.opts,
 'title','Example Waterfall')
waterfall:Register('Example',
 'title','Example Waterfall',
 'tree', 
 {
   {
     text = "Config",
     id = "Config",
     isOpen = true,
     {
       text = "SubSection",
       id = "Sub",
     },
   },
   {
     text = "More Config",
     id = "More"
   }
 },
 'children', function(id)
   if id == 'Config' then
      waterfall:AddControl(<...>)
      return 'Config Heading'
   elseif id == "SubSection" then
     <...>
   end
 end )