Skip to content

Instantly share code, notes, and snippets.

@Meorawr
Meorawr / RotatedFontString.lua
Last active January 12, 2022 13:41
Rotated FontString
local Button = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate");
Button:SetPoint("CENTER");
Button:SetText("Resistances");
local ButtonFontString = Button:GetFontString();
ButtonFontString:ClearAllPoints();
ButtonFontString:SetPoint("CENTER", -5, -10);
-- FontStrings can't be rotated like textures, but you can fake it with
-- an animation that either infinitely repeats or just never ends.
@Meorawr
Meorawr / ContinuationRegistry.lua
Last active October 19, 2021 15:52
Event Continuation Registry
local ContinuationRegistry = Mixin(CreateFrame("Frame"), CallbackRegistryMixin);
local function ProcessContinuations(registry, event)
ContinuationRegistry:UnregisterEvent(event);
ContinuationRegistry:TriggerEvent(event);
end
local function InvokeContinuation(func, event)
ContinuationRegistry:UnregisterCallback(event, func);
func(); -- May error, this is fine.
@Meorawr
Meorawr / ScrollableResizeLayoutFrame.lua
Last active December 12, 2022 15:37
Scrollable Auto-Resizing Layout Frame
local ContentFrameMixin = CreateFromMixins(ResizeLayoutMixin);
function ContentFrameMixin:OnLoad()
self.texturePool = CreateTexturePool(self, "OVERLAY");
end
function ContentFrameMixin:GeneratePage()
self.texturePool:ReleaseAll();
local MIN_TEXTURE_HEIGHT = 20;
@Meorawr
Meorawr / ScrollBoxSelectionDemo.lua
Last active December 24, 2023 11:51
ScrollBox Selection Demo
local SelectionDemoListItemMixin = CreateFromMixins(CallbackRegistryMixin);
SelectionDemoListItemMixin:GenerateCallbackEvents(
{
"OnClick",
}
);
function SelectionDemoListItemMixin:OnLoad()
CallbackRegistryMixin.OnLoad(self);
self:SetScript("OnClick", self.OnClick);
@Meorawr
Meorawr / ScrollBoxElementCallbackDemo.lua
Last active October 7, 2021 10:40
ScrollBox Element Callback Example
local ScrollableListButtonMixin = CreateFromMixins(CallbackRegistryMixin);
ScrollableListButtonMixin:GenerateCallbackEvents(
{
"OnClickThreeTimes",
}
);
function ScrollableListButtonMixin:OnLoad()
CallbackRegistryMixin.OnLoad(self);
self:SetScript("OnClick", self.OnClick);
@Meorawr
Meorawr / MacroFrameLooseIcons.lua
Last active September 23, 2021 13:37
MacroFrame Loose Icons Support
LoadAddOn("Blizzard_MacroUI");
local function OnMacroPopupDialogAccepted()
local macroIndex = MacroFrame.selectedMacro;
local macroIcon = GetSpellorMacroIconInfo(MacroPopupFrame.selectedIcon);
if type(macroIcon) == "string" then
macroIcon = GetFileIDFromPath([[Interface\Icons\]] .. macroIcon);
end
function SharedTooltip_InitBackdropForTooltip(tooltip)
local nineSlice = SharedTooltip_GetNineSliceFrame(tooltip);
Mixin(nineSlice, BackdropTemplateMixin);
nineSlice:SetScript("OnSizeChanged", nineSlice.OnSizeChanged);
nineSlice.backdropInfo = tooltip.backdropInfo;
nineSlice.backdropColor = tooltip.backdropColor;
nineSlice.backdropColorAlpha = tooltip.backdropColorAlpha;
nineSlice.backdropBorderColor = tooltip.backdropBorderColor;
nineSlice.backdropBorderColorAlpha = tooltip.backdropBorderColorAlpha;
@Meorawr
Meorawr / ScrollableListDemo.lua
Last active March 4, 2023 07:19
ScrollableListDemo
ScrollableListItemMixin = {};
function ScrollableListItemMixin:Init(elementData)
self.Background:SetColorTexture(elementData.color:GetRGBA());
self.Text:SetText(elementData.text);
end
ScrollableListMixin = {};
function ScrollableListMixin:OnLoad()
@Meorawr
Meorawr / ScrollingEditBox.lua
Last active July 23, 2021 12:05
ScrollingEditBox Demo
local WindowFrame = CreateFrame("Frame", nil, UIParent, "ButtonFrameTemplate")
WindowFrame:SetPoint("CENTER");
WindowFrame:SetSize(640, 480);
ButtonFrameTemplate_HidePortrait(WindowFrame);
local ScrollBar = CreateFrame("EventFrame", nil, WindowFrame, "WowTrimScrollBar");
ScrollBar:SetPoint("TOPRIGHT", -4, -60);
ScrollBar:SetPoint("BOTTOMRIGHT", -4, 28);
local EditFrame = CreateFrame("Frame", nil, WindowFrame, "ScrollingEditBoxTemplate");
AcceptSockets
C_AchievementInfo.GetRewardItemID
C_AchievementInfo.GetSupercedingAchievements
C_AchievementInfo.IsValidAchievement
C_AchievementInfo.SetPortraitTexture
C_EquipmentSet.AssignSpecToEquipmentSet
C_EquipmentSet.CanUseEquipmentSets
C_EquipmentSet.ClearIgnoredSlotsForSave
C_EquipmentSet.CreateEquipmentSet
C_EquipmentSet.DeleteEquipmentSet