HousingAuthority



HousingAuthority is a library used to make easy configurations that go into OptionHouse.

frameData
You only need to pass the frame if you're doing some sort of custom modification to it, otherwise you can just skip it and it'll handle everything.
 * Fields
 * Remarks

If you do pass a frame, do not rely on it being the one you should register with OptionHouse if your widgets are going to overlap off the OptionHouse display frame we wrap it a scroll frame around it.

widgetData
All HousingAuthority widgets (input, color, dropdown, slider, checkbox, button) accept these by default as fields so aren't listed.


 * Fields

Grouping
 * Remarks

Grouping is a way to break up configuration so it doesn't look like a single mass of options, if one widget has the group field passed all of them must, the value should be the text that you want displayed, for example the below will show an input and color widget inside a frame labeled "Frame" and a check inside a frame labeled "General".

{ { type = "input", group = "Frame", }  { type = "color", group = "Frame", }  { type = "check", group = "General", } }

Callbacks These are how the callback functions are handled along with arguments used.

No handlers passed

set(var, value) onSet(var, value) validate(var, value) get(var)

Handler passed

handler[set](handler, var, value) handler[onSet](handler, var, value) handler[validate](handler, var, value) handler[get](handler, var)

HA:RegisterFrame([frameData])

 * Returns

HA:CreateConfiguration(widgets[, frameData])

 * Args
 * Returns

List of widget types that can be used
 * Types

Most of the time, all you want is to call this and just pass the table with all the configuratiions, if you need more flexability you can use the below HAObject API's.
 * Remarks

Tables should look like this,

{ { type = "input", },  { type = "dropdown", }, }

and so on.

HAObj:GetFrame

 * Returns

Once you call this, you can no longer call any of the widget creation functions, if the total height of all the widgets is creater then 280 then we wrap the passed frame around a ScrollFrame and return the ScrollFrame instead.
 * Remarks

HAObj:GetObject(frame)
Returns the HAObj that created the frame that was passed in.


 * Args


 * Returns

HAObj:CreateGroup(data)

 * Data fields

This is a way to configure how your group frames will look, not required if you're using grouping due to the defaults, you should pass the tables formatted as { r = #, g = #, b = # } for both background and border.
 * Remarks

HAObj:CreateDropdown(data)
Dropdown for selecting a list of options, useful when you don't want them to be able to enter anytihng like in an input


 * Data fields


 * Returns

HAObj:UpdateDropdown(data)
Allows you to update an already created dropdown with a new default and list


 * Data fields

You should only call this when you know the dropdown is hidden, meanning either OnShow for the frame or in response to set/onSet, if you try and call it with it open then it'll show the old rows followed by the new ones.
 * Remarks

var is used for identify the dropdown, if the dropdown is a table then the values of each must match 100%, if you have multiple dropdowns with the same var then it'll update the first it finds.

HAObj:CreateLabel(data)
Adds a simple text that can be used to break up configuration to prevent them all looking clustered together, can be used in place or grouping or with it if need be.


 * Data fields


 * Returns

HAObj:CreateColorPicker(data)
Creates a small button that can be used for setting colors, the middle of the button is the currnet color used


 * Data fields


 * Returns

When calling set and onSet we call return the value as { r = #, g = #, b = # }, get must return it in this same format.
 * Remarks

HAObj:CreateButton(data)
Simple button that lets you respond when it's clicked


 * Data fields

This only responds to the set and onSet fields from widgetData, no value will be passed to them.
 * Remarks


 * Returns

HAObj:CreateCheckBox(data)
Simple check box


 * Data fields


 * Returns

HAObj:CreateInput(data)
Text or number inputt field


 * Data fields

Validate allows you to restrict thats considered acceptable, if it returns nil then it's considered rejected and a red "[!]" will appear using the message you provided from the error field, once validate returns anything except nil then set/onSet is called.
 * Remarks

An example of how this works would be only allowing numeric input.

local function validateInput(var, value) return tonumber(value) end

If the user enters abc then nil is returned because no numbers can be found in it, if he entered ab10 then it would return 10 and thats what would be passed to the set and onSet functions.


 * Returns

HAObj:CreateSlider(data)
Slider for things like opacity or scale


 * Data fields


 * Returns