---@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 element in an XML file: --- ---- Create a new frame in Lua --- --- local self = CreateFrame("Frame", "FunWidget", UIParent) --- --- --- --- --- ---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 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, ---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, ---Begins repositioning the frame via mouse movement. ---@param self Frame 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 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. --- @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, }