WT.Gadget.RegisterFactory

From Riftui Wiki

Jump to: navigation, search

Declared in Library: wtLibGadget

Registers a Gadget Factory with the Gadgets framework. This adds a new item to the list of Gadgets a user can create.

WT.Gadget.RegisterFactory(id, configuration) -> void

Arguments

Returns

No return values

Example Usage

local dialog = false

local function CreateGadget(configuration)
    local txtHello = UI.CreateFrame("Text", "txtHello", WT.Context)
    txtHello:SetText("Hello, Telara!")
    return txtHello
end

local function ConfigDialog(container)	
    dialog = WT.Dialog(container)
        :Label("Hello Telara has no configuration options")
        :Label("This is just an example dialog.")	
end

local function GetConfiguration()
    return dialog:GetValues()
end

local function SetConfiguration(config)
    dialog:SetValues(config)
end

WT.Gadget.RegisterFactory("HelloTelara",
{
    name="Hello Telara",
    description="Hello world for Rift",
    author="Wildtide",
    version="1.0.0",
    ["Create"] = CreateGadget,
    ["ConfigDialog"] = ConfigDialog,
    ["GetConfiguration"] = GetConfiguration, 
    ["SetConfiguration"] = SetConfiguration, 

})
Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox