-
Notifications
You must be signed in to change notification settings - Fork 3
GeminiGUI is a WildStar addon library designed to allow addon developers the ability to create UI windows and components in-game with a Lua table. This allows the developer to remove the need to request UI definitions from the Houston XML form file.
First you will need to copy the GeminiGUI.lua file into your addon's folder. Following this you will need to add a reference to GeminiGUI.lua in your addon's toc.xml file.
<Script Name="GeminiGUI.lua"/>Now that you have added GeminiGUI to your addon and referenced it in your toc.xml, it is time to pull a local reference of the GeminiGUI library in your addon's code.
GeminiGUI = Apollo.GetPackage("Gemini:GUI-1.0").tPackageLet's create a window that is centered in the middle of the screen with a button in the center of it. This button will close the window using an inline event handler when clicked.
-- Retrieve the GeminiGUI library from Apollo's package system
local GeminiGUI = Apollo.GetPackage("Gemini:GUI-1.0").tPackage
-- Setup the table definition for the window
local tWindowDefinition = {
Name = "MyExampleWindow",
Template = "CRB_TooltipSimple",
UseTemplateBG = true,
Picture = true,
Border = true,
AnchorCenter = { 500, 300 },
Children = {
{
WidgetType = "PushButton",
Base = "CRB_UIKitSprites:btn_square_LARGE_Red",
Text = "Close Parent",
TextThemeColor = "ffffffff", -- sets normal, flyby, pressed, pressedflyby, disabled to a color
AnchorCenter = { 150, 40 },
Events = {
ButtonSignal = function(self, wndHandler, wndControl)
wndControl:GetParent():Close()
end
},
},
},
}
-- Create the GeminiGUI window prototype object
local tWindow = GeminiGUI:Create(tWindowDefinition)
-- Create the instance of the window
local wndInstance = tWindow:GetInstance()You can also chain the GeminiGUI prototype object and instance creation into a single line
local wndInstance = GeminiGUI:Create(tWindowDefinition):GetInstance()Creates a GeminiGUI window prototype object with the tWindowDefinition given.
strWidgetType is an optional parameter. If this parameter is not provided, GeminiGUI will look at tWindowDefintion.WidgetType for a value. Defaults to Window if missing.
Register a widget constructor that will return a new prototype of the widget. strWidgetName will be used to retrieve the widget from the widget registry.
Return the version of the currently registered widget type
Returns a window object equivalent to Apollo.LoadForm().
tEventHandler is the table used for event callbacks. In most cases, self or the addon table should be passed as this parameter. If nil is passed, a new table will be created and used.
wndParent is the parent Window and nil can be passed for a top-level Window. Alternatively, a string containing the name of the desired strata level could be used. Apollo.GetStrata() provides a list of possible strata options, at the time of writing they are: TooltipStratum, DefaultStratum, FixedHudStratumHigh, FixedHudStratum, FixedHudStratumLow, and InWorldHudStratum.
Sets luaData as the data to be assigned to the window object when tPrototypeObject:GetInstance() is called.
Add an event handler with strName as the event name to the widget prototype.
If a string is passed as the second parameter, a function with strFunctionName will be called when the event is fired. However if a function is passed, fnInline will be called when the event is fired.
Note: fnInline will be added to the tEventHandler table that is passed to tPrototypeObject:GetInstance()
Add a child window definition to the widget prototype.
Add a pixie to the widget prototype.
Add or modify window definition attributes set on the prototype object. tOptions is a key/value pair style table.
Add or modify a single window definition attribute set on the prototype object.
The window definition table can use several special attributes that are provided by GeminiGUI.
| Name | Type | Description |
|---|---|---|
| AnchorPoints | table |
{ left, top, right, bottom } array form for passing anchor points |
| AnchorPoints | string | Alternatively a string can be passed that translates to a common anchor point |
| AnchorOffsets | table |
{ left, top, right, bottom } array form for passing anchor offsets |
| WhiteFillMe | boolean | If true the widget's sprite will be set to ClientSprites:WhiteFill, Picture to true and BGColor to white |
| IncludeEdgeAnchors | boolean or string | If true will set the left, top, right, bottom EdgeControlAnchor to [widgetName]_[side]. If a string is passed, it will be used instead of widgetName
|
| AnchorCenter | table | An { width, height } array will be used to center the widget in it's parent. This will set AnchorPoints and AnchorOffsets
|
| AnchorFill | boolean or number | Will set the widget to fill the parent. This will set AnchorPoints and AnchorOffsets. If a number is passed, a margin of number pixels is set for the fill. |
| PosSize | table | An { left, top, width, height } array will be used to position and size the widget in it's parent. This will set AnchorPoints and AnchorOffsets
|
| UserData | value | This value will be assigned to the widget when tPrototypeObject:GetInstance() is called |
| LuaData | value | Alias for UserData |
| Events | table | Table containing a dictionary of events and their handlers |
| Pixies | table | Table containing an array of pixie definitions |
| Children | table | Table Containing an array of child window definitions |
For widget specific attributes and events, check out the following pages: