Embedded Textures in FontStrings
A new feature in 2.4 is the ability to embed textures inside FontStrings. This functionality works similar to embedding a hyperlink, and should allow AddOn authors a great deal more flexibility in using textures in conjunction with FontStrings.
The format for placing a texture inside a FontString is as follows:
If the height argument is omitted, the width will be used, resulting in a square texture.
ChatFrame1:AddMessage(?\124TInterface\\Icons\\Spell_Holy_WordFortitude:64\124t is the icon for Power Word: Fortitude?);
This will add a message to ChatFrame1 with a 64x64 texture for Power Word: Fortitude, along with the text ? is the icon for Power Word: Fortitude?.
At this time, to prevent potential abuse, raw texture links cannot be sent to other players. In order to allow players to send each other textures, we have added support for texture tags to ChatFrames and the Raid Warning frame. Texture tags are parsed out of messages added to these frames and replaced with appropriate textures.
Texture tags use the following format:
Currently there are only texture tags for raid icons. We may add more texture tags in the future.
The new Interface Options frames allows authors to place their configuration
frames (aka "panels") alongside the panels for modifying the default UI.
Adding a new panel to the Interface Options frame is a fairly straightforward process.
Any frame can be used as a panel as long as it implements the required values and methods.
Once a frame is ready to be used as a panel, it must be registered using the function
InterfaceOptions_AddCategory, i.e. InterfaceOptions_AddCategory(panel)
Panels can be designated as sub-categories of existing options. These panels are listed
with smaller text, offset, and tied to parent categories. The parent categories can be expanded
or collapsed to toggle display of their sub-categories.
When players select a category of options from the Interface Options frame, the panel associated
with that category will be anchored to the right hand side of the Interface Options frame and shown.
The following members and methods are used by the Interface Options frame to display and organize panels.
panel.name - string (required)
The name of the AddOn or group of configuration options. This is the text that will display in the AddOn options list.
panel.parent - string (optional)
Name of the parent of the AddOn or group of configuration options. This identifies "panel" as the child of another category.
If the parent category doesn't exist, "panel" will be displayed as a regular category.
panel.okay - function (optional)
This method will run when the player clicks "okay" in the Interface Options.
panel.cancel - function (optional)
This method will run when the player clicks "cancel" in the Interface Options. Use this to revert their changes.
panel.default - function (optional)
This method will run when the player clicks "defaults". Use this to revert their changes to your defaults.
EXAMPLE -- Use XML to create a frame, and through its OnLoad function, make the frame a panel.
function ExamplePanel_OnLoad (panel)
panel.name = "My AddOn"
EXAMPLE -- Dynamically create a frame and use it as a subcategory for "My AddOn".
local panel = CreateFrame("FRAME", "ExampleSubCategory");
panel.name = "My SubCategory";
panel.parent = "My AddOn";
EXAMPLE -- Create a frame with an okay and a cancel method
--[[ Create a frame to use as the panel ]] --
local panel = CreateFrame("FRAME", "ExamplePanel");
panel.name = "My AddOn";
-- [[ When the player clicks okay, set the original value to the current setting ]] --
self.originalValue = MY_VARIABLE;
-- [[ When the player clicks cancel, set the current setting to the original value ]] --
MY_VARIABLE = self.originalValue;
-- [[ Add the panel to the Interface Options ]] --