Compare commits

...

2 Commits

Author SHA1 Message Date
162e312287 Update 2025-05-04 22:07:23 +02:00
eb4f1db8cb Update 2025-05-04 22:02:08 +02:00
8 changed files with 1322 additions and 201 deletions

306
ui/FontString.lua Normal file
View File

@@ -0,0 +1,306 @@
---@meta
---@class rect
---@field left number
---@field right number
---@field top number
---@field bottom number
---@class FontString : UIObject, Region, ScriptRegion
FontString = {
--- Returns localized text depending on the specified gender.
--- @param self FontString
--- @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,
--- Sets the text to be displayed in the fontstring.
--- @param self FontString
--- @param text string The text to display. Can include escape sequences for color and formatting.
--- Note: FontString has a limit of approximately 4000 characters.
--- @example
--- myFontString:SetText('|cff000000This text is black,|r |cffff0000while this text will be red.|r')
SetText = function(self, text) end,
--- Calculates the screen area covered by the characters between the specified indices.
--- @param leftIndex number The starting index of the character span.
--- @param rightIndex number The ending index of the character span.
--- @return rect areas The calculated screen area.
--- @example
--- local area = myFontString:CalculateScreenAreaFromCharacterSpan(1, 5)
CalculateScreenAreaFromCharacterSpan = function(self, leftIndex, rightIndex) end,
--- Checks if the fontstring can wrap non-space characters.
--- @return boolean wrap True if it can wrap non-space characters.
--- @example
--- local canWrap = myFontString:CanNonSpaceWrap()
CanNonSpaceWrap = function(self) end,
--- Checks if the fontstring can wrap words.
--- @return boolean wrap True if it can wrap words.
--- @example
--- local canWrap = myFontString:CanWordWrap()
CanWordWrap = function(self) end,
--- Finds the character index at the specified screen coordinates.
--- @param x number The x-coordinate.
--- @param y number The y-coordinate.
--- @return number characterIndex The index of the character at the specified coordinates.
--- @return boolean inside True if the coordinates are inside the fontstring.
--- @example
--- local index, isInside = myFontString:FindCharacterIndexAtCoordinate(100, 200)
FindCharacterIndexAtCoordinate = function(self, x, y) end,
--- Gets the field size of the fontstring.
--- @return number fieldSize The size of the field.
--- @example
--- local size = myFontString:GetFieldSize()
GetFieldSize = function(self) end,
--- Gets the font settings of the fontstring.
--- @return string fontFile The font file used.
--- @return number fontHeight The height of the font.
--- @return string flags The font flags.
--- @example
--- local fontFile, fontHeight, flags = myFontString:GetFont()
GetFont = function(self) end,
--- Gets the font object of the fontstring.
--- @return FontObject font The font object.
--- @example
--- local font = myFontString:GetFontObject()
GetFontObject = function(self) end,
--- Gets the indented word wrap setting.
--- @return boolean wrap True if indented word wrap is enabled.
--- @example
--- local indentedWrap = myFontString:GetIndentedWordWrap()
GetIndentedWordWrap = function(self) end,
--- Gets the horizontal justification of the fontstring.
--- @return string justifyH The horizontal justification.
--- @example
--- local justifyH = myFontString:GetJustifyH()
GetJustifyH = function(self) end,
--- Gets the vertical justification of the fontstring.
--- @return string justifyV The vertical justification.
--- @example
--- local justifyV = myFontString:GetJustifyV()
GetJustifyV = function(self) end,
--- Gets the line height of the fontstring.
--- @return number lineHeight The height of a line.
--- @example
--- local lineHeight = myFontString:GetLineHeight()
GetLineHeight = function(self) end,
--- Gets the maximum number of lines for the fontstring.
--- @return number maxLines The maximum number of lines.
--- @example
--- local maxLines = myFontString:GetMaxLines()
GetMaxLines = function(self) end,
--- Gets the number of lines currently displayed in the fontstring.
--- @return number numLines The number of lines.
--- @example
--- local numLines = myFontString:GetNumLines()
GetNumLines = function(self) end,
--- Gets the rotation of the fontstring.
--- @return number radians The rotation in radians.
--- @example
--- local rotation = myFontString:GetRotation()
GetRotation = function(self) end,
--- Gets the shadow color of the fontstring.
--- @return number colorR The red component of the shadow color.
--- @return number colorG The green component of the shadow color.
--- @return number colorB The blue component of the shadow color.
--- @return number? colorA Optional. The alpha component of the shadow color.
--- @example
--- local r, g, b, a = myFontString:GetShadowColor()
GetShadowColor = function(self) end,
--- Gets the shadow offset of the fontstring.
--- @return number offsetX The x offset of the shadow.
--- @return number offsetY The y offset of the shadow.
--- @example
--- local offsetX, offsetY = myFontString:GetShadowOffset()
GetShadowOffset = function(self) end,
--- Gets the spacing between lines in the fontstring.
--- @return number spacing The spacing value.
--- @example
--- local spacing = myFontString:GetSpacing()
GetSpacing = function(self) end,
--- Gets the height of the string displayed in the fontstring.
--- @return number height The height of the string.
--- @example
--- local height = myFontString:GetStringHeight()
GetStringHeight = function(self) end,
--- Gets the width of the string displayed in the fontstring.
--- @return number width The width of the string.
--- @example
--- local width = myFontString:GetStringWidth()
GetStringWidth = function(self) end,
--- Gets the text color of the fontstring.
--- @return number colorR The red component of the text color.
--- @return number colorG The green component of the text color.
--- @return number colorB The blue component of the text color.
--- @return number? colorA Optional. The alpha component of the text color.
--- @example
--- local r, g, b, a = myFontString:GetTextColor()
GetTextColor = function(self) end,
--- Gets the text scale of the fontstring.
--- @return number textScale The scale of the text.
--- @example
--- local textScale = myFontString:GetTextScale()
GetTextScale = function(self) end,
--- Gets the unbounded width of the string displayed in the fontstring.
--- @return number width The unbounded width.
--- @example
--- local width = myFontString:GetUnboundedStringWidth()
GetUnboundedStringWidth = function(self) end,
--- Gets the wrapped width of the string displayed in the fontstring.
--- @return number width The wrapped width.
--- @example
--- local width = myFontString:GetWrappedWidth()
GetWrappedWidth = function(self) end,
--- Checks if the text in the fontstring is truncated.
--- @return boolean isTruncated True if the text is truncated.
--- @example
--- local isTruncated = myFontString:IsTruncated()
IsTruncated = function(self) end,
--- Sets a gradient alpha for the fontstring.
--- @param start number The starting alpha value.
--- @param length number The length of the gradient.
--- @return boolean isWithinText True if the gradient is within the text.
--- @example
--- local isWithin = myFontString:SetAlphaGradient(0, 1)
SetAlphaGradient = function(self, start, length) end,
--- Sets a fixed color for the fontstring.
--- @param fixedColor boolean True to set a fixed color.
--- @example
--- myFontString:SetFixedColor(true)
SetFixedColor = function(self, fixedColor) end,
--- Sets the font of the fontstring.
--- @param fontFile string The font file to use.
--- @param fontHeight number The height of the font.
--- @param flags string The font flags.
--- @example
--- myFontString:SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
SetFont = function(self, fontFile, fontHeight, flags) end,
--- Sets the font object of the fontstring.
--- @param font FontObject The font object to set.
--- @example
--- myFontString:SetFontObject(myFontObject)
SetFontObject = function(self, font) end,
--- Sets formatted text for the fontstring.
--- @param text string The formatted text to set.
--- @example
--- myFontString:SetFormattedText("Hello %s", "World")
SetFormattedText = function(self, text) end,
--- Sets the indented word wrap setting.
--- @param wrap boolean True to enable indented word wrap.
--- @example
--- myFontString:SetIndentedWordWrap(true)
SetIndentedWordWrap = function(self, wrap) end,
--- Sets the horizontal justification of the fontstring.
--- @param justifyH string The horizontal justification to set.
--- @example
--- myFontString:SetJustifyH("CENTER")
SetJustifyH = function(self, justifyH) end,
--- Sets the vertical justification of the fontstring.
--- @param justifyV string The vertical justification to set.
--- @example
--- myFontString:SetJustifyV("MIDDLE")
SetJustifyV = function(self, justifyV) end,
--- Sets the maximum number of lines for the fontstring.
--- @param maxLines number The maximum number of lines to set.
--- @example
--- myFontString:SetMaxLines(3)
SetMaxLines = function(self, maxLines) end,
--- Sets the non-space wrap setting.
--- @param wrap boolean True to enable non-space wrap.
--- @example
--- myFontString:SetNonSpaceWrap(true)
SetNonSpaceWrap = function(self, wrap) end,
--- Sets the rotation of the fontstring.
--- @param radians number The rotation in radians.
--- @example
--- myFontString:SetRotation(math.rad(45))
SetRotation = function(self, radians) end,
--- Sets the shadow color of the fontstring.
--- @param colorR number The red component of the shadow color.
--- @param colorG number The green component of the shadow color.
--- @param colorB number The blue component of the shadow color.
--- @param a number? Optional. The alpha component of the shadow color.
--- @example
--- myFontString:SetShadowColor(0, 0, 0, 1) -- Black shadow
SetShadowColor = function(self, colorR, colorG, colorB, a) end,
--- Sets the shadow offset of the fontstring.
--- @param offsetX number The x offset of the shadow.
--- @param offsetY number The y offset of the shadow.
--- @example
--- myFontString:SetShadowOffset(1, -1)
SetShadowOffset = function(self, offsetX, offsetY) end,
--- Sets the spacing between lines in the fontstring.
--- @param spacing number The spacing value to set.
--- @example
--- myFontString:SetSpacing(2)
SetSpacing = function(self, spacing) end,
--- Sets the text color of the fontstring.
--- @param colorR number The red component of the text color.
--- @param colorG number The green component of the text color.
--- @param colorB number The blue component of the text color.
--- @param a number? Optional. The alpha component of the text color.
--- @example
--- myFontString:SetTextColor(1, 1, 1) -- White text
SetTextColor = function(self, colorR, colorG, colorB, a) end,
--- Sets the height of the text in the fontstring.
--- @param height number The height to set.
--- @example
--- myFontString:SetTextHeight(14)
SetTextHeight = function(self, height) end,
--- Sets the scale of the text in the fontstring.
--- @param textScale number The scale to set.
--- @example
--- myFontString:SetTextScale(1.5)
SetTextScale = function(self, textScale) end,
--- Sets the word wrap setting for the fontstring.
--- @param wrap boolean True to enable word wrap.
--- @example
--- myFontString:SetWordWrap(true)
SetWordWrap = function(self, wrap) end,
}

View File

@@ -1,197 +1,128 @@
---@meta
---Frame is in many ways the most fundamental widget object. Other types of widget derivatives such as FontStrings, Textures and Animations can only be created attached to a Frame or other derivative of a Frame. Frames provide the basis for interaction with the user, and registering and responding to game events.
---
---When an addon needs to respond to game events or state changes and needs no visible components, this is typically accomplished using a Frame. Visibly, widgets that display game information such as threat or cooldowns and aren't directly interactive beyond being draggable are typically Frames. They are also commonly used as ways to group other related frames, either visibly (such as the way the Talents pane groups the buttons representing your character's talents) or invisibly (such as the way MultiBarRight groups twelve action buttons).
---
---You create a plain frame by specifying "Frame" as the first argument to CreateFrame, or with a <Frame> element in an XML file:
---
---- Create a new frame in Lua
---
--- local self = CreateFrame("Frame", "FunWidget", UIParent)
---
--- <Frame name="FunWidget" parent="UIParent">
--- <!-- insert anchors, scripts, children and other components here in XML -->
--- </Frame>
---
---Frames in the FrameXML include the action bars (the frames that group the action buttons together), the panels that display information like your character status and quest log, and the grand-daddy of the rest of the UI, UIParent.
---@class Frame : UIObject
---@class Frame : ScriptRegion
Frame = {
---Sets whether the frame should automatically come to the front when clicked. When a frame with Toplevel behavior enabled is clicked, it automatically changes its frame level such that it is greater than (and therefore drawn "in front of") all other frames in its strata.
---@param self Frame
---@param enable boolean True to cause the frame to automatically come to the front when clicked; false otherwise
SetTopLevel = function(self, enable) end,
--- Aborts the current drag operation.
--- @example
--- myFrame:AbortDrag()
AbortDrag = function(self) end,
---Flags the frame for automatic saving and restoration of position and dimensions. The position and size of frames so flagged is automatically saved when the UI is shut down (as when quitting, logging out, or reloading) and restored when the UI next starts up (as when logging in or reloading). If the frame does not have a name (set at creation time) specified, its position will not be saved. As implied by its name, enabling this property is useful for frames which can be moved or resized by the user.
---
---This function is automatically called with the value true when frame:StartMoving() is called.
---
---In order for the saved position to be applied to the frame in later sessions, the frame must have been made movable with frame:SetMovable(true).
---@param self Frame
---@param enable boolean True to enable automatic saving and restoration of the frame's position and dimensions; false to disable
SetUserPlaced = function(self, enable) end,
--- Returns true if secure frame attributes can be changed.
--- @return boolean canChange True if attributes can be changed.
--- @example
--- local canChange = myFrame:CanChangeAttribute()
CanChangeAttribute = function(self) end,
---Begins repositioning the frame via mouse movement.
---@param self Frame
--- Creates a fontstring.
--- @param name string? Optional. The name of the fontstring.
--- @param drawLayer string? Optional. The layer to draw the fontstring.
--- @param templateName string? Optional. The name of a template to use.
--- @return FontString The created fontstring.
--- @example
--- local fontString = myFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
CreateFontString = function(self, name, drawLayer, templateName) end,
--- Draws a line.
--- @param name string? Optional. The name of the line.
--- @param drawLayer string? Optional. The layer to draw the line.
--- @param templateName string? Optional. The name of a template to use.
--- @param subLevel number? Optional. The sublevel of the line.
--- @return Line The created line.
--- @example
--- local line = myFrame:CreateLine(nil, "OVERLAY", "LineTemplate")
CreateLine = function(self, name, drawLayer, templateName, subLevel) end,
--- Creates a mask texture.
--- @param name string? Optional. The name of the mask texture.
--- @param drawLayer string? Optional. The layer to draw the mask texture.
--- @param templateName string? Optional. The name of a template to use.
--- @param subLevel number? Optional. The sublevel of the mask texture.
--- @return Texture The created mask texture.
--- @example
--- local maskTexture = myFrame:CreateMaskTexture(nil, "OVERLAY", "MaskTemplate")
CreateMaskTexture = function(self, name, drawLayer, templateName, subLevel) end,
--- Creates a texture.
--- @param name string? Optional. The name of the texture.
--- @param drawLayer string? Optional. The layer to draw the texture.
--- @param templateName string? Optional. The name of a template to use.
--- @param subLevel number? Optional. The sublevel of the texture.
--- @return Texture The created texture.
--- @example
--- local texture = myFrame:CreateTexture(nil, "BACKGROUND", "TextureTemplate")
CreateTexture = function(self, name, drawLayer, templateName, subLevel) end,
--- Disables drawing on the specified layer.
--- @param layer string The layer to disable.
--- @example
--- myFrame:DisableDrawLayer("BACKGROUND")
DisableDrawLayer = function(self, layer) end,
--- Enables drawing on the specified layer.
--- @param layer string The layer to enable.
--- @example
--- myFrame:EnableDrawLayer("BACKGROUND")
EnableDrawLayer = function(self, layer) end,
--- Sets the opacity of the frame.
--- @param alpha number The opacity value (0 to 1).
--- @example
--- myFrame:SetAlpha(0.5) -- Set to 50% opacity
SetAlpha = function(self, alpha) end,
--- Returns the frame's numeric identifier.
--- @return number id The frame's ID.
--- @example
--- local id = myFrame:GetID()
GetID = function(self) end,
--- Shows the frame.
--- @example
--- myFrame:Show()
Show = function(self) end,
--- Hides the frame.
--- @example
--- myFrame:Hide()
Hide = function(self) end,
--- Starts moving the frame via mouse movement.
--- @example
--- myFrame:StartMoving()
StartMoving = function(self) end,
---Begins resizing the frame via mouse movement.
---@param self Frame
StartSizing = function(self) end,
---Ends movement or resizing of the frame initiated with :StartMoving() or :StartSizing().
---@param self Frame
--- Stops moving the frame.
--- @example
--- myFrame:StopMovingOrSizing()
StopMovingOrSizing = function(self) end,
---Unregisters the frame from any events for which it is registered.
---@param self Frame
UnregisterAllEvents = function(self) end,
---Unregisters the frame for an event. Once unregistered, the frame's OnEvent script handler will not be called for that event.
---
---Unregistering from notifications for an event can be useful for improving addon performance at times when it's not necessary to process the event. For example, a frame which monitors target health does not need to receive the UNIT_HEALTH event while the player has no target. An addon that sorts the contents of the player's bags can register for the BAG_UPDATE event to keep track of when items are picked up, but unregister from the event while it performs its sorting.
---@param self Frame
---@param event string Name of an event
UnregisterEvent = function(self, event) end,
---Returns whether the mouse cursor is over the given region. This function replaces the previous MouseIsOver FrameXML function.
---
---If provided, the arguments are treated as offsets by which to adjust the hit rectangle when comparing it to the mouse. They are in screen coordinates; positive offsets move an edge right or up, negative values move it left or down. No frame edges are actually moved. For example:
---
--- if button:IsMouseOver(2, -2, -2, 2) then
---
---will return true if the mouse is within 2 pixels of the given frame.
---@overload fun(self: Frame): boolean
---@overload fun(self: Frame, topOffset: number): boolean
---@overload fun(self: Frame, topOffset: number, leftOffset: number): boolean
---@overload fun(self: Frame, topOffset: number, leftOffset: number, bottomOffset: number): boolean
---@overload fun(self: Frame, topOffset: number, leftOffset: number, bottomOffset: number, rightOffset: number): boolean
---@param self Frame
---@param topOffset number The amount by which to displace the top edge of the test rectangle
---@param leftOffset number The amount by which to displace the left edge of the test rectangle
---@param bottomOffset number The amount by which to displace the bottom edge of the test rectangle
---@param rightOffset number The amount by which to displace the right edge of the test rectangle
---@return boolean isOver true if the mouse is over the region; otherwise false
IsMouseOver = function(self, topOffset, leftOffset, bottomOffset, rightOffset) end,
---Sets the width of the frame.
---@param self Frame
---@param width number The width of the frame
SetWidth = function(self, width) end,
---Sets the height of the frame.
---@param self Frame
---@param height number The height of the frame
SetHeight = function(self, height) end,
---Sets the point of the frame.
---This method sets an attachment point of a UI component.
---@overload fun(self: Frame, point: string): nil
---@overload fun(self: Frame, point: string, relativeTo: Frame): nil
---@overload fun(self: Frame, point: string, relativeTo: Frame, relativePoint: string): nil
---@overload fun(self: Frame, point: string, relativeTo: Frame, relativePoint: string, offsetX: number): nil
---@overload fun(self: Frame, point: string, relativeTo: Frame, relativePoint: string, offsetX: number, offsetY: number): nil
---@param self Frame
---@param point string The point of the frame to adjust based on the anchor.
---@param relativeTo Frame The frame to anchor to (defaults to parent if omitted).
---@param relativePoint string The point of the relative frame (defaults to point if omitted).
---@param offsetX number The x-offset (defaults to 0 if not specified).
---@param offsetY number The y-offset (defaults to 0 if not specified).
SetPoint = function(self, point, relativeTo, relativePoint, offsetX, offsetY) end,
---@class backdrop
---@field bgFile string The texture file to use as the frame background (.blp or .tga format).
---@field edgeFile string The texture file to use as the frame edge (.blp or .tga format).
---@field tile boolean Whether the background texture is tiled or stretched.
---@field tileSize number Control how large each copy of the bgFile becomes on-screen.
---@field edgeSize number Control how large each copy of the edgeFile becomes on-screen (i.e., border thickness and corner size).
---@field insets table Controls how far into the frame the background will be drawn (use higher values for thicker edges).
---Sets the backdrop of the frame.
---This method allows you to set a background and border for the frame.
---@param self Frame
---@param backdrop backdrop A table containing the backdrop settings.
---@example
--- Frame:SetBackdrop({
--- bgFile = "Interface/Tooltips/UI-Tooltip-Background",
--- edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
--- tile = true,
--- tileSize = 16,
--- edgeSize = 16,
--- insets = { left = 4, right = 4, top = 4, bottom = 4 }
--- });
SetBackdrop = function(self, backdrop) end,
--- Sets the color of the backdrop border.
---@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: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.
--- Sets whether the frame can be moved.
--- @param movable boolean True to allow moving.
--- @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,
--- myFrame:SetMovable(true)
SetMovable = function(self, movable) 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.
--- Sets the frame's level.
--- @param frameLevel number The level to set.
--- @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,
--- myFrame:SetFrameLevel(5)
SetFrameLevel = function(self, frameLevel) end,
--- Sets the size scaling of the region.
--- @param self Frame
--- @param scale number The scale of the region. Must be greater than 0.
--- Sets the frame's strata.
--- @param strata string The strata to set.
--- @example
--- MinimapCluster:SetScale(1.2); -- Scales MinimapCluster and its child regions to 120%
SetScale = function(self, scale) end,
--- myFrame:SetFrameStrata("DIALOG")
SetFrameStrata = function(self, strata) 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.
--- Registers the frame for a specific event.
--- @param eventName string The name of the event to register.
--- @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,
--- myFrame:RegisterEvent("PLAYER_LOGIN")
RegisterEvent = function(self, eventName) end,
--- Unregisters an event from the frame.
--- @param eventName string The name of the event to unregister.
--- @example
--- myFrame:UnregisterEvent("PLAYER_LOGIN")
UnregisterEvent = function(self, eventName) end,
}

57
ui/Line.lua Normal file
View File

@@ -0,0 +1,57 @@
---@meta
---@class Line : TextureBase
Line = {
--- Clears all anchor points from the line.
--- @example
--- myLine:ClearAllPoints()
ClearAllPoints = function(self) end,
--- Returns the end point of the line.
--- @return string relativePoint The relative point.
--- @return Frame relativeTo The frame to which the end point is relative.
--- @return number offsetX The x offset of the end point.
--- @return number offsetY The y offset of the end point.
--- @example
--- local relativePoint, relativeTo, offsetX, offsetY = myLine:GetEndPoint()
GetEndPoint = function(self) end,
--- Returns the start point of the line.
--- @return string relativePoint The relative point.
--- @return Frame relativeTo The frame to which the start point is relative.
--- @return number offsetX The x offset of the start point.
--- @return number offsetY The y offset of the start point.
--- @example
--- local relativePoint, relativeTo, offsetX, offsetY = myLine:GetStartPoint()
GetStartPoint = function(self) end,
--- Returns the thickness of the line.
--- @return number thickness The thickness of the line.
--- @example
--- local thickness = myLine:GetThickness()
GetThickness = function(self) end,
--- Sets the end point of the line.
--- @param relativePoint string The relative point.
--- @param relativeTo Frame The frame to which the end point is relative.
--- @param offsetX number? Optional. The x offset of the end point.
--- @param offsetY number? Optional. The y offset of the end point.
--- @example
--- myLine:SetEndPoint("TOP", otherFrame, 0, 0)
SetEndPoint = function(self, relativePoint, relativeTo, offsetX, offsetY) end,
--- Sets the start point of the line.
--- @param relativePoint string The relative point.
--- @param relativeTo Frame The frame to which the start point is relative.
--- @param offsetX number? Optional. The x offset of the start point.
--- @param offsetY number? Optional. The y offset of the start point.
--- @example
--- myLine:SetStartPoint("BOTTOM", otherFrame, 0, 0)
SetStartPoint = function(self, relativePoint, relativeTo, offsetX, offsetY) end,
--- Sets the thickness of the line.
--- @param thickness number The thickness to set.
--- @example
--- myLine:SetThickness(2)
SetThickness = function(self, thickness) end,
}

96
ui/Region.lua Normal file
View File

@@ -0,0 +1,96 @@
---@meta
---@class Region : ScriptRegion
Region = {
--- Returns the region's opacity.
--- @return number alpha The opacity of the region.
--- @example
--- local alpha = myRegion:GetAlpha()
GetAlpha = function(self) end,
--- Returns the layer in which the region is drawn.
--- @return string layer The layer of the region.
--- @return number sublayer The sublayer of the region.
--- @example
--- local layer, sublayer = myRegion:GetDrawLayer()
GetDrawLayer = function(self) end,
--- Returns the scale of the region after propagating from its parents.
--- @return number effectiveScale The effective scale of the region.
--- @example
--- local effectiveScale = myRegion:GetEffectiveScale()
GetEffectiveScale = function(self) end,
--- Returns the scale of the region.
--- @return number scale The scale of the region.
--- @example
--- local scale = myRegion:GetScale()
GetScale = function(self) end,
--- Returns the vertex color shading of the region.
--- @return number colorR The red component of the vertex color.
--- @return number colorG The green component of the vertex color.
--- @return number colorB The blue component of the vertex color.
--- @return number colorA The alpha component of the vertex color.
--- @example
--- local r, g, b, a = myRegion:GetVertexColor()
GetVertexColor = function(self) end,
--- Returns true if the region is ignoring parent alpha.
--- @return boolean isIgnoring True if the region is ignoring parent alpha.
--- @example
--- local isIgnoring = myRegion:IsIgnoringParentAlpha()
IsIgnoringParentAlpha = function(self) end,
--- Returns true if the region is ignoring parent scale.
--- @return boolean isIgnoring True if the region is ignoring parent scale.
--- @example
--- local isIgnoring = myRegion:IsIgnoringParentScale()
IsIgnoringParentScale = function(self) end,
--- Returns true if the region is fully loaded.
--- @return boolean isLoaded True if the region is loaded.
--- @example
--- local isLoaded = myRegion:IsObjectLoaded()
IsObjectLoaded = function(self) end,
--- Sets the opacity of the region.
--- @param alpha number The opacity value to set (0 to 1).
--- @example
--- myRegion:SetAlpha(0.5) -- Set to 50% opacity
SetAlpha = function(self, alpha) end,
--- Sets the layer in which the region is drawn.
--- @param layer string The layer to set.
--- @param sublevel number? Optional. The sublevel to set.
--- @example
--- myRegion:SetDrawLayer("ARTWORK", 1)
SetDrawLayer = function(self, layer, sublevel) end,
--- Sets whether the region should ignore its parent's alpha.
--- @param ignore boolean True to ignore parent alpha.
--- @example
--- myRegion:SetIgnoreParentAlpha(true)
SetIgnoreParentAlpha = function(self, ignore) end,
--- Sets whether the region should ignore its parent's scale.
--- @param ignore boolean True to ignore parent scale.
--- @example
--- myRegion:SetIgnoreParentScale(true)
SetIgnoreParentScale = function(self, ignore) end,
--- Sets the size scaling of the region.
--- @param scale number The scale value to set.
--- @example
--- myRegion:SetScale(1.5) -- Scale to 150%
SetScale = function(self, scale) end,
--- Sets the vertex shading color of the region.
--- @param colorR number The red component of the color.
--- @param colorG number The green component of the color.
--- @param colorB number The blue component of the color.
--- @param a number? Optional. The alpha component of the color.
--- @example
--- myRegion:SetVertexColor(1, 0, 0) -- Set to red
SetVertexColor = function(self, colorR, colorG, colorB, a) end,
}

399
ui/ScriptRegion.lua Normal file
View File

@@ -0,0 +1,399 @@
---@meta
---@class ScriptRegion
ScriptRegion = {
--- Returns true if protected properties of the region can be changed by non-secure scripts.
--- @return boolean canChange True if properties can be changed.
--- @example
--- local canChange = myScriptRegion:CanChangeProtectedState()
CanChangeProtectedState = function(self) end,
--- Sets whether the region should receive mouse input.
--- @param enable boolean True to enable mouse input.
--- @example
--- myScriptRegion:EnableMouse(true)
EnableMouse = function(self, enable) end,
--- Sets whether the region should receive mouse hover events.
--- @param enable boolean True to enable mouse hover events.
--- @example
--- myScriptRegion:EnableMouseMotion(true)
EnableMouseMotion = function(self, enable) end,
--- Sets whether the region should receive mouse wheel input.
--- @param enable boolean True to enable mouse wheel input.
--- @example
--- myScriptRegion:EnableMouseWheel(true)
EnableMouseWheel = function(self, enable) end,
--- Returns the offset in pixels to the bottom edge of the region.
--- @return number bottom The offset to the bottom edge.
--- @example
--- local bottomOffset = myScriptRegion:GetBottom()
GetBottom = function(self) end,
--- Returns the offset in pixels to the center of the region.
--- @return number x The x-coordinate of the center.
--- @return number y The y-coordinate of the center.
--- @example
--- local centerX, centerY = myScriptRegion:GetCenter()
GetCenter = function(self) end,
--- Returns the height of the region.
--- @param ignoreRect boolean? Optional. If true, ignores the rectangle.
--- @return number height The height of the region.
--- @example
--- local height = myScriptRegion:GetHeight()
GetHeight = function(self, ignoreRect) end,
--- Returns the offset in pixels to the left edge of the region.
--- @return number left The offset to the left edge.
--- @example
--- local leftOffset = myScriptRegion:GetLeft()
GetLeft = function(self) end,
--- Returns the coordinates and size of the region.
--- @return number left The left coordinate.
--- @return number bottom The bottom coordinate.
--- @return number width The width of the region.
--- @return number height The height of the region.
--- @example
--- local left, bottom, width, height = myScriptRegion:GetRect()
GetRect = function(self) end,
--- Returns the offset in pixels to the right edge of the region.
--- @return number right The offset to the right edge.
--- @example
--- local rightOffset = myScriptRegion:GetRight()
GetRight = function(self) end,
--- Returns the scaled coordinates and size of the region.
--- @return number left The left coordinate.
--- @return number bottom The bottom coordinate.
--- @return number width The width of the region.
--- @return number height The height of the region.
--- @example
--- local left, bottom, width, height = myScriptRegion:GetScaledRect()
GetScaledRect = function(self) end,
--- Returns the widget script handler.
--- @param scriptTypeName string The name of the script type.
--- @param bindingType string? Optional. The binding type.
--- @return function script The script handler.
--- @example
--- local scriptHandler = myScriptRegion:GetScript("OnClick")
GetScript = function(self, scriptTypeName, bindingType) end,
--- Returns the width and height of the region.
--- @param ignoreRect boolean? Optional. If true, ignores the rectangle.
--- @return number width The width of the region.
--- @return number height The height of the region.
--- @example
--- local width, height = myScriptRegion:GetSize()
GetSize = function(self, ignoreRect) end,
--- Returns the script name and line number where the region was created.
--- @return string location The script location.
--- @example
--- local location = myScriptRegion:GetSourceLocation()
GetSourceLocation = function(self) end,
--- Returns the offset in pixels to the top edge of the region.
--- @return number top The offset to the top edge.
--- @example
--- local topOffset = myScriptRegion:GetTop()
GetTop = function(self) end,
--- Returns the width of the region.
--- @param ignoreRect boolean? Optional. If true, ignores the rectangle.
--- @return number width The width of the region.
--- @example
--- local width = myScriptRegion:GetWidth()
GetWidth = function(self, ignoreRect) end,
--- Returns true if the region supports the given script type.
--- @param scriptName string The name of the script.
--- @return boolean hasScript True if the script is supported.
--- @example
--- local hasScript = myScriptRegion:HasScript("OnClick")
HasScript = function(self, scriptName) end,
--- Hides the region.
--- @example
--- myScriptRegion:Hide()
Hide = function(self) end,
--- Securely post-hooks a widget script handler.
--- @param scriptTypeName string The name of the script type.
--- @param script function The script handler.
--- @param bindingType string? Optional. The binding type.
--- @example
--- myScriptRegion:HookScript("OnClick", function() print("Clicked!") end)
HookScript = function(self, scriptTypeName, script, bindingType) end,
--- Returns true if the region has cross-region anchoring restrictions applied.
--- @return boolean isRestricted True if anchoring is restricted.
--- @example
--- local isRestricted = myScriptRegion:IsAnchoringRestricted()
IsAnchoringRestricted = function(self) end,
--- Returns true if the region is being dragged.
--- @return boolean isDragging True if the region is being dragged.
--- @example
--- local isDragging = myScriptRegion:IsDragging()
IsDragging = function(self) end,
--- Returns true if the region can receive mouse clicks.
--- @return boolean enabled True if mouse clicks are enabled.
--- @example
--- local isEnabled = myScriptRegion:IsMouseClickEnabled()
IsMouseClickEnabled = function(self) end,
--- Returns true if the region can receive mouse input.
--- @return boolean enabled True if mouse input is enabled.
--- @example
--- local isEnabled = myScriptRegion:IsMouseEnabled()
IsMouseEnabled = function(self) end,
--- Returns true if the region can receive mouse hover events.
--- @return boolean enabled True if mouse hover events are enabled.
--- @example
--- local isEnabled = myScriptRegion:IsMouseMotionEnabled()
IsMouseMotionEnabled = function(self) end,
--- Returns true if the mouse cursor is hovering over the region.
--- @return boolean isMouseMotionFocus True if the mouse is over the region.
--- @example
--- local isMouseOver = myScriptRegion:IsMouseMotionFocus()
IsMouseMotionFocus = function(self) end,
--- Returns true if the mouse cursor is hovering over the region.
--- @param offsetTop number? Optional. The top offset.
--- @param offsetBottom number? Optional. The bottom offset.
--- @param offsetLeft number? Optional. The left offset.
--- @param offsetRight number? Optional. The right offset.
--- @return boolean isMouseOver True if the mouse is over the region.
--- @example
--- local isMouseOver = myScriptRegion:IsMouseOver()
IsMouseOver = function(self, offsetTop, offsetBottom, offsetLeft, offsetRight) end,
--- Returns true if the region can receive mouse wheel input.
--- @return boolean enabled True if mouse wheel input is enabled.
--- @example
--- local isEnabled = myScriptRegion:IsMouseWheelEnabled()
IsMouseWheelEnabled = function(self) end,
--- Returns whether the region is currently protected.
--- @return boolean isProtected True if the region is protected.
--- @return boolean isProtectedExplicitly True if the protection is explicit.
--- @example
--- local isProtected, isExplicit = myScriptRegion:IsProtected()
IsProtected = function(self) end,
--- Returns true if the region can be positioned on the screen.
--- @return boolean isValid True if the region is valid.
--- @example
--- local isValid = myScriptRegion:IsRectValid()
IsRectValid = function(self) end,
--- Returns true if the region should be shown.
--- @return boolean isShown True if the region is shown.
--- @example
--- local isShown = myScriptRegion:IsShown()
IsShown = function(self) end,
--- Returns true if the region and its parents are shown.
--- @return boolean isVisible True if the region is visible.
--- @example
--- local isVisible = myScriptRegion:IsVisible()
IsVisible = function(self) end,
--- Sets whether the region should receive mouse clicks.
--- @param enabled boolean True to enable mouse clicks.
--- @example
--- myScriptRegion:SetMouseClickEnabled(true)
SetMouseClickEnabled = function(self, enabled) end,
--- Sets whether the region should receive mouse hover events.
--- @param enabled boolean True to enable mouse hover events.
--- @example
--- myScriptRegion:SetMouseMotionEnabled(true)
SetMouseMotionEnabled = function(self, enabled) end,
--- Sets the parent of the region.
--- @param parent Frame? The parent frame.
--- @example
--- myScriptRegion:SetParent(UIParent)
SetParent = function(self, parent) end,
--- Allows the region to propagate mouse clicks to underlying regions or the world frame.
--- @param button1 string? The first button to pass through.
--- @example
--- myScriptRegion:SetPassThroughButtons("LeftButton")
SetPassThroughButtons = function(self, button1) end,
--- Sets the widget script handler.
--- @param scriptTypeName string The name of the script type.
--- @param script function? The script handler.
--- @example
--- myScriptRegion:SetScript("OnClick", function() print("Clicked!") end)
SetScript = function(self, scriptTypeName, script) end,
--- Shows or hides the region.
--- @param show boolean? Optional. True to show, false to hide.
--- @example
--- myScriptRegion:SetShown(true)
SetShown = function(self, show) end,
--- Shows the region.
--- @example
--- myScriptRegion:Show()
Show = function(self) end,
--- Adjusts the x and y offset of the region.
--- @param x number The x offset.
--- @param y number The y offset.
--- @example
--- myScriptRegion:AdjustPointsOffset(10, 20)
AdjustPointsOffset = function(self, x, y) end,
--- Removes all anchor points from the region.
--- @example
--- myScriptRegion:ClearAllPoints()
ClearAllPoints = function(self) end,
--- Removes an anchor point from the region by name.
--- @param point string The name of the anchor point.
--- @example
--- myScriptRegion:ClearPoint("TOP")
ClearPoint = function(self, point) end,
--- Resets the x and y offset on the region to zero.
--- @example
--- myScriptRegion:ClearPointsOffset()
ClearPointsOffset = function(self) end,
--- Returns the number of anchor points for the region.
--- @return number numPoints The number of anchor points.
--- @example
--- local numPoints = myScriptRegion:GetNumPoints()
GetNumPoints = function(self) end,
--- Returns an anchor point for the region.
--- @param anchorIndex number? Optional. The index of the anchor point.
--- @return string point The anchor point.
--- @return Frame relativeTo The frame to which the anchor is relative.
--- @return string relativePoint The relative point.
--- @return number offsetX The x offset.
--- @return number offsetY The y offset.
--- @example
--- local point, relativeTo, relativePoint, offsetX, offsetY = myScriptRegion:GetPoint()
GetPoint = function(self, anchorIndex) end,
--- Returns an anchor point by name for the region.
--- @param point string The name of the anchor point.
--- @return string point The anchor point.
--- @return Frame relativeTo The frame to which the anchor is relative.
--- @return string relativePoint The relative point.
--- @return number offsetX The x offset.
--- @return number offsetY The y offset.
--- @example
--- local point, relativeTo, relativePoint, offsetX, offsetY = myScriptRegion:GetPointByName("TOP")
GetPointByName = function(self, point) end,
--- Positions the region the same as another region.
--- @param relativeTo Frame The frame to position relative to.
--- @param doResize boolean? Optional. True to resize the region.
--- @example
--- myScriptRegion:SetAllPoints(otherFrame)
SetAllPoints = function(self, relativeTo, doResize) end,
--- Sets the height of the region.
--- @param height number The height to set.
--- @example
--- myScriptRegion:SetHeight(100)
SetHeight = function(self, height) end,
--- Sets an anchor point for the region.
--- @param point string The anchor point.
--- @param relativeTo Frame The frame to which the anchor is relative.
--- @param relativePoint string The relative point.
--- @param offsetX number The x offset.
--- @param offsetY number The y offset.
--- @example
--- myScriptRegion:SetPoint("TOP", otherFrame, "BOTTOM", 0, 0)
SetPoint = function(self, point, relativeTo, relativePoint, offsetX, offsetY) end,
--- Sets the width and height of the region.
--- @param x number The width to set.
--- @param y number The height to set.
--- @example
--- myScriptRegion:SetSize(200, 100)
SetSize = function(self, x, y) end,
--- Sets the width of the region.
--- @param width number The width to set.
--- @example
--- myScriptRegion:SetWidth(200)
SetWidth = function(self, width) end,
-- --- @alias OnEnter
-- --- Invoked when the mouse cursor enters the frame's interactive area.
-- --- @param self ScriptRegion
-- --- @param motion table The motion data.
-- --- @example
-- --- myScriptRegion:SetScript("OnEnter", function(self, motion) print("Mouse entered") end)
--
-- --- @alias OnHide
-- --- Invoked when the frame's visibility changes to hidden.
-- --- @param self ScriptRegion
-- --- @example
-- --- myScriptRegion:SetScript("OnHide", function(self) print("Frame hidden") end)
--
-- --- @alias OnLeave
-- --- Invoked when the mouse cursor leaves the frame's interactive area.
-- --- @param self ScriptRegion
-- --- @param motion table The motion data.
-- --- @example
-- --- myScriptRegion:SetScript("OnLeave", function(self, motion) print("Mouse left") end)
--
-- --- @alias OnMouseDown
-- --- Invoked when a mouse button is pressed while the cursor is over the frame.
-- --- @param self ScriptRegion
-- --- @param button string The button that was pressed.
-- --- @example
-- --- myScriptRegion:SetScript("OnMouseDown", function(self, button) print("Mouse button pressed: " .. button) end)
--
-- --- @alias OnMouseUp
-- --- Invoked when the mouse button is released following a mouse down action in the frame.
-- --- @param self ScriptRegion
-- --- @param button string The button that was released.
-- --- @example
-- --- myScriptRegion:SetScript("OnMouseUp", function(self, button) print("Mouse button released: " .. button) end)
--
-- --- @alias OnMouseWheel
-- --- Invoked when the frame receives a mouse wheel scrolling action.
-- --- @param self ScriptRegion
-- --- @param delta number The amount of scrolling.
-- --- @example
-- --- myScriptRegion:SetScript("OnMouseWheel", function(self, delta) print("Mouse wheel scrolled: " .. delta) end)
--
-- --- @alias OnShow
-- --- Invoked when the frame becomes visible.
-- --- @param self ScriptRegion
-- --- @example
-- --- myScriptRegion:SetScript("OnShow", function(self) print("Frame shown") end)
--
-- --- @alias OnLoad
-- --- Invoked when the object is created.
-- --- @param self ScriptRegion
-- --- @example
-- --- myScriptRegion:SetScript("OnLoad", function(self) print("Object loaded") end)
--
-- --- @alias OnUpdate
-- --- Invoked on every frame.
-- --- @param self ScriptRegion
-- --- @param elapsed number The time elapsed since the last frame.
-- --- @example
-- --- myScriptRegion:SetScript("OnUpdate", function(self, elapsed) print("Frame updated: " .. elapsed) end)
}

136
ui/Texture.lua Normal file
View File

@@ -0,0 +1,136 @@
---@meta
---@class Texture : TextureBase
Texture = {
--- Adds a mask texture to the texture.
--- @param mask Texture The mask texture to add.
--- @example
--- myTexture:AddMaskTexture(myMaskTexture)
AddMaskTexture = function(self, mask) end,
--- Returns the mask texture at the specified index.
--- @param index number The index of the mask texture.
--- @return Texture mask The mask texture at the specified index.
--- @example
--- local mask = myTexture:GetMaskTexture(1)
GetMaskTexture = function(self, index) end,
--- Returns the number of mask textures applied to the texture.
--- @return number count The number of mask textures.
--- @example
--- local count = myTexture:GetNumMaskTextures()
GetNumMaskTextures = function(self) end,
--- Removes a mask texture from the texture.
--- @param mask Texture The mask texture to remove.
--- @example
--- myTexture:RemoveMaskTexture(myMaskTexture)
RemoveMaskTexture = function(self, mask) end,
--- Sets the texture to an atlas.
--- @param atlas string The atlas to set.
--- @param useAtlasSize boolean? Optional. Whether to use the atlas size.
--- @param filterMode string? Optional. The filter mode to use.
--- @param resetTexCoords boolean? Optional. Whether to reset texture coordinates.
--- @example
--- myTexture:SetAtlas("MyAtlas", true)
SetAtlas = function(self, atlas, useAtlasSize, filterMode, resetTexCoords) end,
--- Sets the blend mode of the texture.
--- @param blendMode string The blend mode to set.
--- @example
--- myTexture:SetBlendMode("ADD")
SetBlendMode = function(self, blendMode) end,
--- Sets the texture to a solid color.
--- @param colorR number The red component of the color.
--- @param colorG number The green component of the color.
--- @param colorB number The blue component of the color.
--- @param a number? Optional. The alpha component of the color.
--- @example
--- myTexture:SetColorTexture(1, 0, 0) -- Set to red
SetColorTexture = function(self, colorR, colorG, colorB, a) end,
--- Sets the texture to be desaturated.
--- @param desaturated boolean? Optional. True to desaturate the texture.
--- @example
--- myTexture:SetDesaturated(true)
SetDesaturated = function(self, desaturated) end,
--- Sets the desaturation level of the texture.
--- @param desaturation number The desaturation level to set.
--- @example
--- myTexture:SetDesaturation(0.5) -- Set to 50% desaturation
SetDesaturation = function(self, desaturation) end,
--- Sets a gradient color shading for the texture.
--- @param orientation string The orientation of the gradient.
--- @param minColor table The minimum color.
--- @param maxColor table The maximum color.
--- @example
--- myTexture:SetGradient("HORIZONTAL", {1, 0, 0}, {0, 0, 1}) -- Red to Blue
SetGradient = function(self, orientation, minColor, maxColor) end,
--- Sets whether the texture should tile horizontally.
--- @param tiling boolean? Optional. True to enable horizontal tiling.
--- @example
--- myTexture:SetHorizTile(true)
SetHorizTile = function(self, tiling) end,
--- Applies a mask to the texture.
--- @param file string The file path of the mask.
--- @example
--- myTexture:SetMask("Interface\\Textures\\Mask")
SetMask = function(self, file) end,
--- Applies a rotation to the texture.
--- @param radians number The rotation in radians.
--- @param normalizedRotationPoint table? Optional. The normalized rotation point.
--- @example
--- myTexture:SetRotation(math.rad(45)) -- Rotate 45 degrees
SetRotation = function(self, radians, normalizedRotationPoint) end,
--- Sets the texture to snap to the pixel grid.
--- @param snap boolean? Optional. True to enable snapping.
--- @example
--- myTexture:SetSnapToPixelGrid(true)
SetSnapToPixelGrid = function(self, snap) end,
--- Sets the coordinates for cropping or transforming the texture.
--- @param left number The left coordinate.
--- @param right number The right coordinate.
--- @param bottom number The bottom coordinate.
--- @param top number The top coordinate.
--- @example
--- myTexture:SetTexCoord(0, 1, 0, 1) -- Full texture
SetTexCoord = function(self, left, right, bottom, top) end,
--- Sets the texel snapping bias for the texture.
--- @param bias number The texel snapping bias to set.
--- @example
--- myTexture:SetTexelSnappingBias(0.5)
SetTexelSnappingBias = function(self, bias) end,
--- Sets the texture to an image.
--- @param textureAsset string The texture asset to set.
--- @param wrapModeHorizontal string? Optional. The horizontal wrap mode.
--- @param wrapModeVertical string? Optional. The vertical wrap mode.
--- @param filterMode string? Optional. The filter mode.
--- @example
--- myTexture:SetTexture("Interface\\Textures\\MyTexture")
SetTexture = function(self, textureAsset, wrapModeHorizontal, wrapModeVertical, filterMode) end,
--- Sets whether the texture should tile vertically.
--- @param tiling boolean? Optional. True to enable vertical tiling.
--- @example
--- myTexture:SetVertTile(true)
SetVertTile = function(self, tiling) end,
--- Sets a vertex offset for the texture.
--- @param vertexIndex number The index of the vertex.
--- @param offsetX number The x offset to set.
--- @param offsetY number The y offset to set.
--- @example
--- myTexture:SetVertexOffset(1, 5, 5)
SetVertexOffset = function(self, vertexIndex, offsetX, offsetY) end,
}

217
ui/TextureBase.lua Normal file
View File

@@ -0,0 +1,217 @@
---@meta
---@class TextureBase : Region
TextureBase = {
--- Returns the atlas for the texture.
--- @return string atlas The atlas of the texture.
--- @example
--- local atlas = myTexture:GetAtlas()
GetAtlas = function(self) end,
--- Returns the blend mode of the texture.
--- @return string blendMode The blend mode of the texture.
--- @example
--- local blendMode = myTexture:GetBlendMode()
GetBlendMode = function(self) end,
--- Returns the desaturation level of the texture.
--- @return number desaturation The desaturation level of the texture.
--- @example
--- local desaturation = myTexture:GetDesaturation()
GetDesaturation = function(self) end,
--- Returns true if the texture is tiling horizontally.
--- @return boolean tiling True if the texture is tiling horizontally.
--- @example
--- local isTiling = myTexture:GetHorizTile()
GetHorizTile = function(self) end,
--- Returns the rotation of the texture.
--- @return number radians The rotation in radians.
--- @return table normalizedRotationPoint The normalized rotation point.
--- @example
--- local radians, rotationPoint = myTexture:GetRotation()
GetRotation = function(self) end,
--- Returns the texture space coordinates of the texture.
--- @return number ULx The upper-left x coordinate.
--- @return number ULy The upper-left y coordinate.
--- @return number LLx The lower-left x coordinate.
--- @return number LLy The lower-left y coordinate.
--- @return number URx The upper-right x coordinate.
--- @return number URy The upper-right y coordinate.
--- @return number LRx The lower-right x coordinate.
--- @return number LRy The lower-right y coordinate.
--- @example
--- local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy = myTexture:GetTexCoord()
GetTexCoord = function(self) end,
--- Returns the texel snapping bias for the texture.
--- @return number bias The texel snapping bias.
--- @example
--- local bias = myTexture:GetTexelSnappingBias()
GetTexelSnappingBias = function(self) end,
--- Returns the FileID for the texture.
--- @return number textureFile The FileID of the texture.
--- @example
--- local textureFile = myTexture:GetTexture()
GetTexture = function(self) end,
--- Returns the FileID for the texture.
--- @return number textureFile The FileID of the texture.
--- @example
--- local textureFile = myTexture:GetTextureFileID()
GetTextureFileID = function(self) end,
--- Returns the FileID for the texture.
--- @return number textureFile The FileID of the texture.
--- @example
--- local textureFile = myTexture:GetTextureFilePath()
GetTextureFilePath = function(self) end,
--- Returns true if the texture is tiling vertically.
--- @return boolean tiling True if the texture is tiling vertically.
--- @example
--- local isTiling = myTexture:GetVertTile()
GetVertTile = function(self) end,
--- Returns a vertex offset for the texture.
--- @param vertexIndex number The index of the vertex.
--- @return number offsetX The x offset of the vertex.
--- @return number offsetY The y offset of the vertex.
--- @example
--- local offsetX, offsetY = myTexture:GetVertexOffset(1)
GetVertexOffset = function(self, vertexIndex) end,
--- Returns true if a blocking load is requested.
--- @return boolean blocking True if a blocking load is requested.
--- @example
--- local isBlocking = myTexture:IsBlockingLoadRequested()
IsBlockingLoadRequested = function(self) end,
--- Returns true if the texture is desaturated.
--- @return boolean desaturated True if the texture is desaturated.
--- @example
--- local isDesaturated = myTexture:IsDesaturated()
IsDesaturated = function(self) end,
--- Returns true if the texture is snapping to the pixel grid.
--- @return boolean snap True if the texture is snapping to the pixel grid.
--- @example
--- local isSnapping = myTexture:IsSnappingToPixelGrid()
IsSnappingToPixelGrid = function(self) end,
--- Sets the texture to an atlas.
--- @param atlas string The atlas to set.
--- @param useAtlasSize boolean? Optional. Whether to use the atlas size.
--- @param filterMode string? Optional. The filter mode to use.
--- @param resetTexCoords boolean? Optional. Whether to reset texture coordinates.
--- @example
--- myTexture:SetAtlas("MyAtlas", true)
SetAtlas = function(self, atlas, useAtlasSize, filterMode, resetTexCoords) end,
--- Sets the blend mode of the texture.
--- @param blendMode string The blend mode to set.
--- @example
--- myTexture:SetBlendMode("ADD")
SetBlendMode = function(self, blendMode) end,
--- Sets whether blocking loads are requested.
--- @param blocking boolean? Optional. True to request blocking loads.
--- @example
--- myTexture:SetBlockingLoadsRequested(true)
SetBlockingLoadsRequested = function(self, blocking) end,
--- Sets the texture to a solid color.
--- @param colorR number The red component of the color.
--- @param colorG number The green component of the color.
--- @param colorB number The blue component of the color.
--- @param a number? Optional. The alpha component of the color.
--- @example
--- myTexture:SetColorTexture(1, 0, 0) -- Set to red
SetColorTexture = function(self, colorR, colorG, colorB, a) end,
--- Sets the texture to be desaturated.
--- @param desaturated boolean? Optional. True to desaturate the texture.
--- @example
--- myTexture:SetDesaturated(true)
SetDesaturated = function(self, desaturated) end,
--- Sets the desaturation level of the texture.
--- @param desaturation number The desaturation level to set.
--- @example
--- myTexture:SetDesaturation(0.5) -- Set to 50% desaturation
SetDesaturation = function(self, desaturation) end,
--- Sets a gradient color shading for the texture.
--- @param orientation string The orientation of the gradient.
--- @param minColor table The minimum color.
--- @param maxColor table The maximum color.
--- @example
--- myTexture:SetGradient("HORIZONTAL", {1, 0, 0}, {0, 0, 1}) -- Red to Blue
SetGradient = function(self, orientation, minColor, maxColor) end,
--- Sets whether the texture should tile horizontally.
--- @param tiling boolean? Optional. True to enable horizontal tiling.
--- @example
--- myTexture:SetHorizTile(true)
SetHorizTile = function(self, tiling) end,
--- Applies a mask to the texture.
--- @param file string The file path of the mask.
--- @example
--- myTexture:SetMask("Interface\\Textures\\Mask")
SetMask = function(self, file) end,
--- Applies a rotation to the texture.
--- @param radians number The rotation in radians.
--- @param normalizedRotationPoint table? Optional. The normalized rotation point.
--- @example
--- myTexture:SetRotation(math.rad(45)) -- Rotate 45 degrees
SetRotation = function(self, radians, normalizedRotationPoint) end,
--- Sets the texture to snap to the pixel grid.
--- @param snap boolean? Optional. True to enable snapping.
--- @example
--- myTexture:SetSnapToPixelGrid(true)
SetSnapToPixelGrid = function(self, snap) end,
--- Sets the coordinates for cropping or transforming the texture.
--- @param left number The left coordinate.
--- @param right number The right coordinate.
--- @param bottom number The bottom coordinate.
--- @param top number The top coordinate.
--- @example
--- myTexture:SetTexCoord(0, 1, 0, 1) -- Full texture
SetTexCoord = function(self, left, right, bottom, top) end,
--- Sets the texel snapping bias for the texture.
--- @param bias number The texel snapping bias to set.
--- @example
--- myTexture:SetTexelSnappingBias(0.5)
SetTexelSnappingBias = function(self, bias) end,
--- Sets the texture to an image.
--- @param textureAsset string The texture asset to set.
--- @param wrapModeHorizontal string? Optional. The horizontal wrap mode.
--- @param wrapModeVertical string? Optional. The vertical wrap mode.
--- @param filterMode string? Optional. The filter mode.
--- @example
--- myTexture:SetTexture("Interface\\Textures\\MyTexture")
SetTexture = function(self, textureAsset, wrapModeHorizontal, wrapModeVertical, filterMode) end,
--- Sets whether the texture should tile vertically.
--- @param tiling boolean? Optional. True to enable vertical tiling.
--- @example
--- myTexture:SetVertTile(true)
SetVertTile = function(self, tiling) end,
--- Sets a vertex offset for the texture.
--- @param vertexIndex number The index of the vertex.
--- @param offsetX number The x offset to set.
--- @param offsetY number The y offset to set.
--- @example
--- myTexture:SetVertexOffset(1, 5, 5)
SetVertexOffset = function(self, vertexIndex, offsetX, offsetY) end,
}

View File

@@ -1,21 +0,0 @@
---@meta
---UIObject is an abstract UI object type that is used to group together methods that are common to all user interface types. All of the various user interface elements in World of Warcraft are derived from UIObject.
---@class UIObject
UIObject = {
---Returns the widget object's name
---@param self UIObject
---@return string Name of the object
GetName = function(self) end,
---Returns the widget object's widget type
---@param self UIObject
---@return string Name of the object's type (e.g. Frame, Button, FontString, etc.)
GetObjectType = function(self) end,
--- Returns whether the object belongs to a given widget type
---@param self UIObject
---@param type string Name of the object's type (e.g. Frame, Button, FontString, etc.)
---@return number|nil 1 if the object belongs to the given type (or a subtype thereof); otherwise nil
IsObjectType = function(self, type) end,
}