Titan Logo

 Menu

 Developer

LDBToTitan.lua


LibDataBrokerToTitan.lua
A "bridge" module to ensure proper registration and communication of LDB plugins with Titan Panel


Titan LDB overview
Titan will automatically convert a LDB type addon to a Titan plugin.
Only LDB types listed in the LDB 1.1 spec are supported. Custom types are not supported.

Supported
- "launcher" become "icon" plugins
icon* - always shown
OnClick* -
label^ -
right side^ - default
tooltip
- "data source" become "combo" plugins with icon; a tooltip/Click; and optional label
icon^ -
OnClick -
text*^ - or value & suffix
label^ -
OnEnter -
OnLeave -
tooltip
OnTooltipShow -

* required by LDB spec
^ user controlled show / hide


LDBToTitan:TitanLDBSetOwnerPosition
Properly anchor tooltips of the Titan (LDB) plugin

Inputs
parent
anchorPoint
relativeToFrame
relativePoint
xOffset
yOffset
frame


LDBToTitan:TitanLDBSetTooltip
Fill in the tooltip for the Titan (LDB) plugin

Inputs
name - Titan id of the plugin
frame - tooltip frame
func - tooltip function to be run

Outputs
None


LDBToTitan:TitanLDBHandleScripts
Script Handler for the Titan (LDB) plugin

Inputs
event - event to process
name - id of the plugin
_ - not used
func - function to be run
obj - LDB object

Outputs
None

Notes
- This implementation will work fine for a static tooltip but may have implications for dynamic ones so for now, we'll only set it once (no callback) and see what happens


LDBToTitan:TitanLDBTextUpdate
Text callback for the Titan (LDB) plugin when the LDB addon changes display text of the LDB object

Inputs
_ - not used
name - id of the plugin
event - event to process
attr - LDB obj attribute (field) that changed
value - new value of attr
dataobj - LDB object

Outputs
None


TitanLDBShowText
Text callback for the Titan (LDB) plugin when the LDB addon changes display text

Inputs
name - id of the plugin

Outputs
None

Notes
- One interpretation of 1.1 spec to show text is either
1) use .text or use .value & .suffix (Titan implements)
2) always use .text but .value & .suffix are parts if needed


LDBToTitan:TitanLDBTextUpdate
Icon callback for the Titan (LDB) plugin when the LDB addon changes the icon of the LDB object

Inputs
_ - not used
name - id of the plugin
attr - LDB obj attribute (field) that changed
value - new value of attr
dataobj - LDB object

Outputs
None


TitanLDBRefreshButton
Refresh all text & icon for LDB addons that were successfully registered

Inputs
None

Outputs
None

Notes
- Ensure all the LDB buttons are updated.
- This is called once x seconds after PEW. This helps close the gap where LDB addons set their text on their PEW event


LDBToTitan:TitanLDBCreateObject
New DO (Data Object) gets created here

Inputs
_ - not used
name - id of the plugin
obj - LDB object

Outputs
None

Notes
- This is the heart of the LDB to Titan. It reads the LDB DO (Data Object)and creates a Titan plugin.
- This takes a stricter interpretation of the LDB 1.1 spec rather than guessing what LDB addon developers intended.


LDBToTitan:SetScript
OnEvent handler for LDBToTitan

Inputs
event - string
function

Outputs
None

Notes
- PLAYER_LOGIN - Read through all the LDB object created so far and create cooresponding Titan plugins.
- PLAYER_ENTERING_WORLD - Create a one time timer. This helps ensure the latest values are displayed on the plugin. Some LDB addons create their objects then update the addon values. Titan could have missed the updates as it created & registered the Titan plugin.