From e5f4ad0cbc3884f91ba8c4856c6b46b48dc6f205 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sun, 4 May 2025 21:37:45 +0200 Subject: [PATCH] Update --- Globals.lua | 4 ++++ ui/Frame.lua | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 Globals.lua diff --git a/Globals.lua b/Globals.lua new file mode 100644 index 0000000..0b5e22b --- /dev/null +++ b/Globals.lua @@ -0,0 +1,4 @@ +---@meta + +---@type Frame +UIParent = {} diff --git a/ui/Frame.lua b/ui/Frame.lua index 46f6d3e..8b81388 100644 --- a/ui/Frame.lua +++ b/ui/Frame.lua @@ -130,4 +130,68 @@ Frame = { ---@example --- Frame:SetBackdropBorderColor(1, 0, 0, 1); -- Sets the border color to opaque red SetBackdropBorderColor = function(self, red, green, blue, alpha) end, + + --- Sets the color of the backdrop. + ---@param self Frame + ---@param red number The red component of the border color (0 to 1). + ---@param green number The green component of the border color (0 to 1). + ---@param blue number The blue component of the border color (0 to 1). + ---@param alpha number Optional. The alpha (transparency) of the border color (0 to 1). + ---@example + --- Frame:SetBackdropColor(1, 0, 0, 1); -- Sets the border color to opaque red + SetBackdropColor = function(self, red, green, blue, alpha) end, + + --- Gets the height and width, respectively, of an object. + ---@param self Frame + ---@return number # width The width of the frame. + GetWidth = function(self) end, + + --- Gets the height of the frame. + ---@param self Frame + ---@return number # height The height of the frame. + GetHeight = function(self) end, + + --- Sets the parent of the region. + --- @param self Frame + --- @param parent Frame? Reference to the parent widget. Unsets the parent if omitted. + --- Children inherit alpha and scale unless disallowed with SetIgnoreParentAlpha and SetIgnoreParentScale. + --- @example + --- local f = CreateFrame("Frame") + --- f:SetScale(0.5) + --- f:SetParent(UIParent) + --- print(UIParent:GetScale()) -- 0.63999998569489 + --- print(f:GetScale(), f:GetEffectiveScale()) -- 0.5, 0.31999999284744 + SetParent = function(self, parent) end, + + --- Sets the widget script handler. + --- @param self Frame + --- @param scriptTypeName string Name of the script type, for example "OnShow". + --- @param script function|nil The script handler to call or explicitly nil to remove any existing script. + --- Setting a script will remove any scripts that were previously hooked with HookScript. + --- @example + --- local function OnEvent(self, event) + --- print(event) + --- end + --- local f = CreateFrame("Frame") + --- f:RegisterEvent("PLAYER_STARTED_MOVING") + --- f:SetScript("OnEvent", OnEvent) + SetScript = function(self, scriptTypeName, script) end, + + --- Sets the size scaling of the region. + --- @param self Frame + --- @param scale number The scale of the region. Must be greater than 0. + --- @example + --- MinimapCluster:SetScale(1.2); -- Scales MinimapCluster and its child regions to 120% + SetScale = function(self, scale) end, + + --- Returns localized text depending on the specified gender. + --- @param self Frame + --- @param token string Reputation index. + --- @param gender number? Optional. Gender ID (1 for male, 2 for female, etc.). + --- @param ordinal unknown? Optional. Used for ordinal numbers. + --- @return string # The localized text. + --- @example + --- local text = GetText("FACTION_STANDING_LABEL1") -- Returns "Hated" + --- local femaleText = GetText("FACTION_STANDING_LABEL1", 3) -- Returns "Hated" for female + GetText = function(self, token, gender, ordinal) end, }